Mathematics: Analysis & Approaches HL · Statistics & Probability · 20 min read · Updated 2026-05-11
Conditional probability and Bayes' theorem — IB Mathematics: Analysis and Approaches HL
IB Mathematics: Analysis and Approaches HL · Statistics & Probability · 20 min read
Covers: This module covers conditional probability definition, tree diagram applications, the law of total probability, and Bayes' theorem for single and multiple events, with worked examples for common IB exam problems.
You should already know:
Basic probability rules and set notation
Tree diagram construction
Calculate conditional probability using the definition and restricted sample spaces
Apply the law of total probability to sequential probability problems
Use Bayes' theorem to reverse conditional probability for single and multiple events
Solve common IB exam problems including medical testing and reliability questions
1. Conditional Probability: Definition & Basic Rules ★★☆☆☆ ⏱ 5 min
Conditional Probability
P(A|B)
The probability of event $A$ occurring, given that event $B$ is already known to have occurred. It restricts the sample space to only outcomes where $B$ occurs.
Example: Probability the second card drawn from a deck is an ace, given the first card drawn was an ace.
From the definition, the core formula for conditional probability is derived directly from the joint probability of $A$ and $B$:
P(A|B) = \frac{P(A \cap B)}{P(B)}, \quad P(B) > 0
A bag contains 5 red marbles and 3 blue marbles. Two marbles are drawn without replacement. What is the probability the second marble is red, given the first was blue?
Define events: $A = \{\text{second marble is red}\}$, $B = \{\text{first marble is blue}\}$
Calculate joint and marginal probabilities:
P(A \cap B) = \frac{3}{8} \times \frac{5}{7} = \frac{15}{56}, \quad P(B) = \frac{3}{8} = \frac{21}{56}
Apply the conditional probability formula:
P(A|B) = \frac{15/56}{21/56} = \frac{15}{21} = \frac{5}{7}
2. Tree Diagrams & Law of Total Probability ★★☆☆☆ ⏱ 6 min
Tree diagrams are ideal for sequential probability problems. Each branch is labeled with the conditional probability of that step given all prior steps. The law of total probability lets us calculate the total probability of an outcome from all possible paths.
Multiply probabilities along each path to get joint probabilities
Add joint probabilities for all paths that lead to the outcome you want
Confirm the sum of all joint probabilities equals 1
Two machines produce widgets: Machine A makes 60% of widgets, 2% defective. Machine B makes 40% of widgets, 5% defective. What is the probability a randomly selected widget is defective?
Define events: $A = \{\text{widget from A}\}$, $B = \{\text{widget from B}\}$, $D = \{\text{widget defective}\}$
Label tree branches with given conditional probabilities: $P(D|A) = 0.02$, $P(D|B) = 0.05$
Apply the law of total probability:
P(D) = P(D|A)P(A) + P(D|B)P(B) = (0.02 \times 0.6) + (0.05 \times 0.4) = 0.012 + 0.02 = 0.032
3. Bayes' Theorem for Two Events ★★★☆☆ ⏱ 7 min
Bayes' Theorem
A formula to reverse conditional probability, calculating the posterior probability of a prior event given an observed outcome, from known prior and conditional probabilities.
P(B|A) = \frac{P(A|B) P(B)}{P(A)}, \quad P(A) = P(A|B)P(B) + P(A|B')P(B')
A disease affects 1% of a population. A test for the disease returns positive for 95% of people with the disease, and positive for 10% of people without the disease. What is the probability a person who tests positive actually has the disease?
Define events: $D = \{\text{has disease}\}$, $+ = \{\text{tests positive}\}$. Given: $P(D) = 0.01$, $P(+|D) = 0.95$, $P(+|D') = 0.10$
Calculate total probability of testing positive:
P(+) = P(+|D)P(D) + P(+|D')P(D') = (0.95 \times 0.01) + (0.10 \times 0.99) = 0.1085
Apply Bayes' theorem:
P(D|+) = \frac{P(+|D)P(D)}{P(+)} = \frac{0.0095}{0.1085} \approx 0.088
Even with a 95% accurate test, only ~9% of positive results are true positives for rare diseases. This is a very common IB exam question.
4. Extended Bayes' Theorem for Multiple Events ★★★☆☆ ⏱ 6 min
For $n$ mutually exclusive, exhaustive events $B_1, B_2, ..., B_n$, Bayes' theorem extends directly to calculate the posterior probability of any individual event:
P(B_i|A) = \frac{P(A|B_i) P(B_i)}{\sum_{k=1}^n P(A|B_k) P(B_k)}
Three boxes have counters: Box 1: 1 red, 2 blue; Box 2: 2 red, 1 blue; Box 3: 3 red, 6 blue. A box is chosen uniformly at random, then a counter drawn is red. What is the probability the counter came from Box 2?
Define events: $B_i = \{\text{Box } i \text{ chosen}\}$, $R = \{\text{red counter drawn}\}$. Given: $P(B_1) = P(B_2) = P(B_3) = \frac{1}{3}$
Conditional probabilities: $P(R|B_1) = \frac{1}{3}$, $P(R|B_2) = \frac{2}{3}$, $P(R|B_3) = \frac{3}{9} = \frac{1}{3}$
Calculate denominator (total probability of red):
\sum P(R|B_k)P(B_k) = \frac{1}{3} \left( \frac{1}{3} + \frac{2}{3} + \frac{1}{3} \right) = \frac{4}{9}
Apply extended Bayes' theorem:
P(B_2|R) = \frac{P(R|B_2)P(B_2)}{4/9} = \frac{(2/3)(1/3)}{4/9} = \frac{1}{2}
Common Pitfalls
Why: Mixing up which event is the given event that restricts the sample space
Why: Treating dependent draws as independent, leading to incorrect joint probabilities
Why: Base rate neglect and confusion about the direction of conditional probability
Why: The denominator of Bayes' theorem relies on all possible outcomes being included and non-overlapping
Quick Reference Cheatsheet