All lessons

Module 2: Probability for decisions · Lesson 2.1 · about 20 min

Probability rules with pictures

Probability as counting: the complement, "or" and "and" rules, independence and conditional probability, shown on a grid of 100 customers so every rule is something you can count.

Key points, meanings and formulas on one page: choose "Save as PDF" in the print box.

Module 2 · about 20 minutes · school maths. You’ll be able to use the complement, addition and multiplication rules, tell when events are independent, and compute a conditional probability.

A probability is a share of all the possible cases, so every rule of probability is just careful counting.

In everyday terms: picture 100 customers standing in a hall. “The chance a customer used a coupon” is how many of the 100 did. “The chance a coupon user returned the item” means: send everyone else out of the hall, then count again.

1. Probability is counting

A probability is a number from 0 (never) to 1 (always), often written as a percentage. For data, it is usually just a share: if 40 of 100 customers bought shoes, the probability a random customer bought shoes is 0.4. Every rule below is counting in disguise, so the grid below lets you count.

Try it: probability by counting people
P(A or B) = P(A) + P(B) − P(A and B)
P(B | A): socks, given shoes
independent? P(A)·P(B) vs P(A and B)

Each square is one of 100 customers (made up). Dark: bought both. First colour: shoes only. Second colour: socks only. Blank: neither. Counting squares is all probability is: P(B | A) looks only at the shoe buyers and asks what share of them also bought socks.

2. The complement

P(not A)=1−P(A)

If 4 % of orders are returned, 96 % are not. Often the complement is easier to work out: “at least one of these 5 servers fails” is 1 − P(none fail).

3. “Or”: the addition rule

P(A or B)=P(A)+P(B)−P(A and B)

Adding counts everyone in A and everyone in B, so people in both get counted twice; subtract them once. If A and B cannot happen together (mutually exclusive, like “paid by card” and “paid by cash” for a single payment), the overlap is 0 and you just add.

4. “Given”: conditional probability

P(B|A), read “probability of B given A”, restricts attention to the cases where A happened:

P(B|A)=P(A and B)P(A)

On the grid: look only at the shoe buyers and count what share also bought socks. Analysts use conditional probabilities constantly, usually without the name: conversion rate given mobile, churn rate given a complaint, return rate given a discount.

Order matters: P(socks|shoes) and P(shoes|socks) are different numbers. Mixing them up is a famous error, and Lesson 2.2 is about it.

5. “And”: the multiplication rule and independence

Rearranging the definition gives

P(A and B)=P(A)×P(B|A)

Two events are independent when knowing one tells you nothing about the other: P(B|A)=P(B). Then the rule simplifies to P(A and B)=P(A)×P(B). Coin flips are independent. Customer purchases usually are not: people who buy shoes are more likely to buy socks. That dependence is exactly what market basket analysis (“customers who bought this also bought…”) measures, and its “lift” is

lift=P(A and B)P(A)P(B)

Lift above 1 means the items go together.

P(A)
Share of all cases where A happens, from 0 (never) to 1 (always).
P(not A) = 1 − P(A)
The complement: everything that is not A.
P(A or B) = P(A) + P(B) − P(A and B)
Add, but take away the overlap you counted twice.
P(A | B)
"A given B": the share of the B cases that are also A. The bar means "only look at B".
Independent
Knowing B tells you nothing about A: P(A | B) = P(A).
Physical meaning
Conditioning is zooming in. P(returned | discount) zooms in on discounted orders only and asks what share of that smaller crowd came back.

“P(A | B) and P(B | A) are the same thing.” The share of discounted orders that were returned (90 of 600 = 15 %) is not the share of returned orders that had a discount (90 of 150 = 60 %). Always ask: out of which group?

Watch it happen, one step at a time:

The table. 2,000 orders: 600 used a discount, 150 were returned, and 90 did both.
Complement. P(kept) = 1 − 150/2,000 = 1 − 0.075 = 0.925.
Or. P(discount or returned) = 600/2,000 + 150/2,000 − 90/2,000 = 660/2,000 = 0.33. The 90 would be counted twice without the subtraction.
Given. Zoom in on the 600 discounted orders: 90 were returned, so P(returned | discount) = 0.15.
Compare. Without a discount: 60 of 1,400 ≈ 0.043. Discounted orders come back about 3.5 times as often, so the two are not independent.
Maths and principle

Principle: probabilities of overlapping events cannot simply be added or multiplied; you must account for the overlap, or for how one event changes the other.

Equations: complement 1−P(A); or P(A)+P(B)−P(A∩B); given P(B|A)=P(A∩B)/P(A); and P(A)P(B|A). (∩ means “and”, ∪ means “or”.)

Analogy: P(B | A) is like filtering a table to the rows where A is true, then computing the share of B. It is literally a SQL WHERE followed by an average.

6. Worked example

Made-up numbers. An online shop’s 2,000 orders last month:

Used a discount No discount Total
Returned 90 60 150
Kept 510 1,340 1,850
Total 600 1,400 2,000
  • P(returned) = 150 ÷ 2,000 = 7.5 %.
  • P(returned | discount) = 90 ÷ 600 = 15 %. P(returned | no discount) = 60 ÷ 1,400 ≈ 4.3 %.
  • These differ a lot, so returns and discounts are not independent. Discount orders come back about 3.5 times as often.
  • P(discount or returned) = 600/2,000 + 150/2,000 − 90/2,000 = 660 ÷ 2,000 = 33 %.

Whether discounts cause returns is a different question (Lesson 8.3); the table only shows they go together.

7. Practice

  1. 5 % of parcels are damaged. What is P(not damaged)?
  2. Two independent servers each fail on 2 % of days. What is the chance at least one fails on a given day?
  3. 60 % of visitors are on mobile; 3 % of mobile visitors buy. What share of all visitors are mobile buyers?
Answers
  1. 95 %.
  2. 1 − P(neither fails) = 1 − 0.98 × 0.98 = 1 − 0.9604 = 3.96 %.
  3. P(mobile and buy) = 0.6 × 0.03 = 1.8 %.

Try it on your own data: the probability tree draws “and” and “given” as branches, the sample space builder builder counts outcomes for dice and cards, and cross-tab and chi-square builds a table like the one above from a CSV.

New words: probability, complement, mutually exclusive, conditional probability, independent, lift.

  • Probability = favourable cases ÷ all cases; a two-way table of counts makes every rule visible.
  • Complement: P(not A) = 1 − P(A).
  • Or: add, then subtract the overlap.
  • Given: divide by the size of the group you are looking inside; P(A | B) ≠ P(B | A).
  • Independent events: P(A and B) = P(A) × P(B).

Check yourself

130 % of customers buy coffee, 20 % buy a pastry and 10 % buy both. What share buy coffee or a pastry?
2Using the same numbers, what is P(pastry | coffee), the chance a coffee buyer also buys a pastry?
3A website is down 1 % of the time and the payment provider is down 2 % of the time, independently. How often are both down at once?

Sources

Your ticks stay in this browser. Save them as a file on the course home.

Updated 2026-11-22. Numbers in the examples are made up to show the idea unless a source is given. Simulations run in your browser; nothing you type is sent anywhere.