IB Diploma Mathematics AA · Statistics and probability
Conditional probability and independence
1Conditional probability
Conditional probability is the chance of $A$ when you already know $B$ has happened. It is written $P(A \mid B)$, read "A given B".
$$P(A \mid B) = \frac{P(A \cap B)}{P(B)}$$
Knowing $B$ shrinks the sample space to just $B$.
From a Venn diagram
- In the class of 30: 18 play football, 12 play tennis, 5 play both.
- A tennis player is picked. What is the probability they also play football?
- $P(F \mid T) = \frac{n(F \cap T)}{n(T)} = \frac{5}{12}$.
Check yourself
What does P(A | B) mean?
Show the answer
The probability of A, given that B has happened
The bar means "given".
2Independent events
Two events are independent if one happening does not change the probability of the other.
Test for independence:
$$P(A \cap B) = P(A) \times P(B)$$
Equivalently, $P(A \mid B) = P(A)$.
Are they independent?
- Class of 30: $P(F) = \frac{18}{30} = 0.6$, $P(T) = \frac{12}{30} = 0.4$, $P(F \cap T) = \frac{5}{30} = 0.167$.
- $P(F) \times P(T) = 0.24$.
- $0.167 \ne 0.24$, so football and tennis are not independent.
Do not confuse independent with mutually exclusive. Mutually exclusive events cannot both happen, so if one happens the other definitely does not. That makes them strongly dependent.
Check yourself
P(A) = 0.3, P(B) = 0.5, P(A ∩ B) = 0.15. Are A and B independent?
Show the answer
Yes, because 0.3 × 0.5 = 0.15
The product of the probabilities equals the intersection.
3Conditional probability on tree diagrams
The second set of branches on a tree diagram are already conditional probabilities: they are probabilities given the first branch.
A medical test
- 2% of people have a disease. A test is positive for 95% of people with it, and for 10% of people without it.
- $P(D \cap +) = 0.02 \times 0.95 = 0.019$.
- $P(D' \cap +) = 0.98 \times 0.10 = 0.098$.
- $P(+) = 0.019 + 0.098 = 0.117$.
- $P(D \mid +) = \frac{0.019}{0.117} = 0.162$.
So even with a positive test, there is only about a 16% chance the person has the disease. Most positives come from the large healthy group.
Check yourself
Why can a positive result from a good test still mean a low chance of disease?
Show the answer
The disease is rare, so most positives come from healthy people
False positives from the large healthy group outnumber true positives.
4Choosing the right tool
- Venn diagram: overlapping categories, often with counts.
- Two-way table: two categories, such as gender and choice of subject. Conditional probabilities come from one row or column.
- Tree diagram: events in stages, especially without replacement.
- Sample space grid: two simple experiments, such as two dice.
A two-way table
- Of 100 students, 40 are in year 11 and 60 in year 12. 25 of the year 11s and 30 of the year 12s walk to school.
- $P(\text{walks}) = \frac{55}{100}$.
- $P(\text{year 11} \mid \text{walks}) = \frac{25}{55} = \frac{5}{11}$.
- $P(\text{walks} \mid \text{year 11}) = \frac{25}{40} = \frac{5}{8}$.
Notice that the two conditional probabilities are different. The order matters.
Check yourself
Is P(A | B) the same as P(B | A)?
Show the answer
Not in general
They divide the same intersection by different totals.
5Two-way tables
Two-way tables make conditional probability easy.
A two-way table of 100 students
- Year 11: 30 play sport, 20 do not (total 50).
- Year 12: 25 play sport, 25 do not (total 50).
- Totals: 55 play sport, 45 do not.
Reading the table
- $P(\text{sport} \mid \text{Year 11}) = \frac{30}{50} = 0.6$.
- $P(\text{Year 11} \mid \text{sport}) = \frac{30}{55} \approx 0.545$.
- Independence test: $P(\text{sport}) = 0.55 \ne 0.6$, so not independent.
Check yourself
From the table, what is $P(\text{sport} \mid \text{Year 12})$?
Show the answer
0.5
$\frac{25}{50}$.
6Testing for independence
Events $A$ and $B$ are independent if $P(A \cap B) = P(A) \times P(B)$, or equivalently $P(A \mid B) = P(A)$.
Worked example
- $P(A) = 0.4$, $P(B) = 0.5$, $P(A \cap B) = 0.2$.
- $P(A) \times P(B) = 0.2$, which equals $P(A \cap B)$.
- So $A$ and $B$ are independent.
Do not confuse independent with mutually exclusive: mutually exclusive events cannot happen together, so $P(A \cap B) = 0$.
Check yourself
If $P(A) = 0.3$, $P(B) = 0.6$ and $A$, $B$ are independent, what is $P(A \cap B)$?
Show the answer
0.18
Multiply.
7Going deeper: tables, trees and a test for independence
The formula is $P(A \mid B) = \frac{P(A \cap B)}{P(B)}$. In words: restrict attention to the cases where $B$ happened.
Worked example (two-way table): of 100 people, 60 were vaccinated and 6 of those became ill. Of the 40 who were not vaccinated, 14 became ill.
- $P(\text{ill}) = \frac{6 + 14}{100} = 0.2$.
- $P(\text{ill} \mid \text{vaccinated}) = \frac{6}{60} = 0.1$.
- $P(\text{vaccinated} \mid \text{ill}) = \frac{6}{20} = 0.3$.
- Steps 2 and 3 are different questions with different denominators. Confusing them is the most common error in this topic.
- Independence test: $P(\text{ill} \mid \text{vaccinated}) = 0.1$ and $P(\text{ill}) = 0.2$. They differ, so illness and vaccination are not independent.
Worked example (tree diagram): machine A makes 60% of a factory's output and 2% of its items are defective. Machine B makes 40%, with 5% defective.
- $P(A \cap \text{defective}) = 0.6 \times 0.02 = 0.012$.
- $P(B \cap \text{defective}) = 0.4 \times 0.05 = 0.020$.
- $P(\text{defective}) = 0.032$.
- $P(A \mid \text{defective}) = \frac{0.012}{0.032} = 0.375$.
- Machine A makes most of the items but a minority of the defective ones.
Three equivalent tests for independence
- $P(A \cap B) = P(A) \times P(B)$.
- $P(A \mid B) = P(A)$.
- $P(B \mid A) = P(B)$.
$P(A) = 0.3$, $P(B) = 0.5$, $P(A \cap B) = 0.15$. Since $0.3 \times 0.5 = 0.15$, the events are independent.
Choosing a tool
- Two-way table: when counts are given for two categories.
- Tree diagram: when events happen in sequence, or probabilities are given as conditional.
- Venn diagram: when information is about overlaps of two or three sets.
- Formula: when probabilities are given directly.
Useful rearrangement: $P(A \cap B) = P(A) \times P(B \mid A)$. This is what multiplying along a tree does.
Common mistakes
- Using the whole sample as the denominator in a conditional probability.
- Assuming independence without being told or checking.
- Reading "given" the wrong way round.
Check yourself
P(A) = 0.4 and P(B | A) = 0.25. What is P(A ∩ B)?
Show the answer
0.1
P(A ∩ B) = P(A) × P(B | A) = 0.4 × 0.25.
Now test yourself
This lesson has a 8-question quiz and 5 exam-style questions with mark schemes in Impera. Free, with your progress saved.
Practise in Impera