IB Maths AA HL
Topic 4 — Statistics & Probability
Paper 1 & 2
HL only
~8 min read
Bayes’ Theorem
Bayes’ theorem flips a conditional probability — given P(A | B), it tells you P(B | A). Use it whenever a question gives you the conditional probabilities going one way (the “second branches” of a tree) and asks for one going the other way. Both the two-event and three-event versions are in the formula booklet — your job is to pick the right pieces and substitute carefully.
📘 What you need to know
- Purpose: reverse a conditional — find P(B | A) when you already know P(A | B).
- Two-event formula: P(B | A) = P(B) · P(A | B)P(B) · P(A | B) + P(B′) · P(A | B′)
- Three-event formula: same idea — denominator sums all Bi·P(A | Bi) terms.
- Both versions are in the formula booklet — don’t waste memory memorising them.
- Numerator = the one specific path you want; denominator = sum of all paths leading to A.
- Triggered by: “given that A occurred…” combined with conditionals provided “the other way”.
- The events Bi must be mutually exclusive and cover the sample space (an exhaustive partition).
- A tree diagram is the safest tool — every Bayes calculation can be read directly off a tree.
The two-event formula
Bayes’ theorem — two events
P(B | A) = P(B) · P(A | B)P(B) · P(A | B) + P(B′) · P(A | B′)
Read the structure as: your target path divided by the total probability of A. The denominator is just P(A) split into the two ways A can happen — through B, or through B′.
Why it works: P(B | A) = P(A ∩ B) / P(A). The numerator is P(B) · P(A | B); the denominator is found by summing the two paths through B and B′. That’s it — Bayes is just clever bookkeeping on a tree.
The three-event formula
If the sample space is split into three (or more) mutually exclusive cases B1, B2, B3, the structure is identical — the denominator just has more terms.
Bayes’ theorem — three events
P(Bi | A) = P(Bi) · P(A | Bi)P(B1) · P(A | B1) + P(B2) · P(A | B2) + P(B3) · P(A | B3)
The IB syllabus caps you at three categories. The numerator picks out the one you want; the denominator collects every path that produces A.
Bayes on a tree diagram
Every Bayes problem maps onto the same tree shape. The first set of branches gives the priors P(Bi); the second set gives the conditionals P(A | Bi). Multiply along each path to get the joint probabilities — these are the building blocks of Bayes.
Numerator
P(Bi) · P(A | Bi)
the single path leading to your target outcome
Denominator
∑ P(Bj) · P(A | Bj)
total probability of A — sum across ALL branches
🧭 Recipe — applying Bayes’ theorem
- Define the events: pick clear letters for the categories Bi and the observed outcome A.
- List priors and conditionals: P(Bi) for each category, P(A | Bi) for each branch.
- Compute path probabilities: multiply P(Bi) · P(A | Bi) for every category.
- Substitute into Bayes: target path on top, sum of all paths on the bottom.
- Simplify and sense-check: result must be between 0 and 1.
Worked examples
WE 1 · HLTwo-event Bayes: medical test
A disease affects 2% of a population. A diagnostic test correctly returns positive for 90% of people who have the disease, and incorrectly returns positive for 5% of people who don’t have it. A randomly chosen person tests positive — find the probability they actually have the disease.
Step 1: Define events
D = has disease, +ve = tests positive
P(D) = 0.02, P(D′) = 0.98
P(+ve | D) = 0.90, P(+ve | D′) = 0.05
Step 2: Build numerator and denominator
Path through D: 0.02 × 0.90 = 0.018
Path through D′: 0.98 × 0.05 = 0.049
Step 3: Apply Bayes
P(D | +ve) = 0.018 / (0.018 + 0.049) = 0.018 / 0.067
= 18/67 ≈ 0.269
P(D | +ve) ≈ 0.269
a positive test still leaves only ~27% chance of disease — counter-intuitive but correct
WE 2 · HLTwo-event Bayes: which machine produced the defect?
A factory has two machines. Machine A produces 60% of items with a defect rate of 3%. Machine B produces 40% of items with a defect rate of 8%. An item is selected at random and found to be defective. Find the probability that it was made by Machine B.
Step 1: List priors and conditionals
P(A) = 0.6, P(B) = 0.4
P(def | A) = 0.03, P(def | B) = 0.08
Step 2: Path probabilities
A path: 0.6 × 0.03 = 0.018
B path: 0.4 × 0.08 = 0.032
Step 3: Bayes — target is B
P(B | def) = 0.032 / (0.018 + 0.032)
= 0.032 / 0.050 = 0.64
P(B | defective) = 0.64
B made fewer items but its higher defect rate dominates the conditional
WE 3 · HLThree-event Bayes: which bus did the late student take?
Each morning, students arrive at a school on one of three buses: Bus 1 carries 20%, Bus 2 carries 50%, and Bus 3 carries 30%. The probability of arriving late is 0.10 for Bus 1, 0.04 for Bus 2, and 0.15 for Bus 3. Given that a student arrived late, find the probability they took Bus 3.
Step 1: Priors and conditionals
P(B₁) = 0.20, P(B₂) = 0.50, P(B₃) = 0.30
P(L | B₁) = 0.10, P(L | B₂) = 0.04, P(L | B₃) = 0.15
Step 2: Path probabilities
B₁ path: 0.20 × 0.10 = 0.020
B₂ path: 0.50 × 0.04 = 0.020
B₃ path: 0.30 × 0.15 = 0.045
Step 3: Apply three-event Bayes
P(B₃ | L) = 0.045 / (0.020 + 0.020 + 0.045)
= 0.045 / 0.085 = 9/17 ≈ 0.529
P(took Bus 3 | late) = 9/17 ≈ 0.529
denominator ALWAYS sums every path leading to A — even the ones you don’t care about
WE 4 · HLTwo-event Bayes: spam filter
An email server’s spam filter receives mail of which 25% is genuine spam. The filter correctly flags 92% of spam, but it also flags 4% of legitimate emails as spam. Given that an email has been flagged as spam, find the probability it really is spam.
Step 1: Define events
S = email is spam, F = flagged
P(S) = 0.25, P(S′) = 0.75
P(F | S) = 0.92, P(F | S′) = 0.04
Step 2: Path probabilities
S path: 0.25 × 0.92 = 0.230
S′ path: 0.75 × 0.04 = 0.030
Step 3: Apply Bayes
P(S | F) = 0.230 / (0.230 + 0.030)
= 0.230 / 0.260 = 23/26 ≈ 0.885
P(S | flagged) = 23/26 ≈ 0.885
about 12% of flagged mail is genuine — the source of “false-positive” complaints
WE 5 · HLThree-event Bayes: which supplier sent the red ball?
A box of balls is supplied by three companies: Supplier X (40%), Supplier Y (35%), and Supplier Z (25%). The proportion of red balls supplied is 50% from X, 30% from Y, and 80% from Z. A ball is drawn at random and is red. Find the probability it came from Supplier Z.
Step 1: Priors and conditionals
P(X) = 0.40, P(Y) = 0.35, P(Z) = 0.25
P(R | X) = 0.50, P(R | Y) = 0.30, P(R | Z) = 0.80
Step 2: Path probabilities
X path: 0.40 × 0.50 = 0.200
Y path: 0.35 × 0.30 = 0.105
Z path: 0.25 × 0.80 = 0.200
Step 3: Apply three-event Bayes
P(Z | R) = 0.200 / (0.200 + 0.105 + 0.200)
= 0.200 / 0.505 = 40/101 ≈ 0.396
P(Z | red) = 40/101 ≈ 0.396
X and Z contribute equal joint probability — Z’s higher red-rate cancels its smaller share
WE 6 · HLTwo-event Bayes: was it raining?
A weather forecast says there’s a 70% chance of rain tomorrow. If it rains, the probability of heavy traffic is 0.85. If it doesn’t rain, the probability of heavy traffic is 0.30. A driver reports heavy traffic. Find the probability that it rained.
Step 1: Define and list
R = rain, H = heavy traffic
P(R) = 0.70, P(R′) = 0.30
P(H | R) = 0.85, P(H | R′) = 0.30
Step 2: Path probabilities
R path: 0.70 × 0.85 = 0.595
R′ path: 0.30 × 0.30 = 0.090
Step 3: Apply Bayes
P(R | H) = 0.595 / (0.595 + 0.090)
= 0.595 / 0.685 = 119/137 ≈ 0.869
P(R | heavy traffic) ≈ 0.869
heavy traffic tilts the rain probability up from 0.70 (prior) to 0.87 (posterior)
💡 Top tips
- Always sketch a tree first — it reveals the priors, the conditionals, and which paths you need.
- Numerator = ONE path; denominator = SUM of paths — this rhythm fits every Bayes question.
- Use the formula booklet — Bayes is supplied; copy the structure and substitute.
- Check the partition: the categories Bi must be mutually exclusive and exhaustive.
- Keep full decimals until the final step — rounded path probabilities can shift the answer noticeably.
⚠ Common mistakes
- Confusing P(A | B) with P(B | A) — that’s the whole point of Bayes; never just swap them.
- Missing a path in the denominator — every category must contribute, even the “small” ones.
- Forgetting to multiply by the prior P(Bi) — the conditional alone is not the path probability.
- Using two-event Bayes when there are three categories — switch to the extended form when the partition has more than two pieces.
- Dropping P(B′) when the prior isn’t 0.5 — the complement still has a meaningful share.
Next: Venn Diagrams. The visual companion to probability — every union, intersection, complement and conditional has a place inside a circle picture. They make set-based questions almost effortless once you can fill them in confidently.
Need help with Statistics & Probability?
Get 1-on-1 help from an IB examiner who knows exactly what Paper 1 & 2 are looking for.
Book Free Session →