impera Open Impera

IB MYP Extended Mathematics · Statistics and probability

Conditional probability

1What conditional probability means

A conditional probability is the probability of an event given that another event has happened. The extra information changes the set of possible outcomes.

Notation: $P(A \mid B)$ is "the probability of A given B".

Worked example

A die

  1. A fair die is rolled. P(the score is 6) = 1/6.
  2. You are told the score is even. Now only 2, 4 and 6 are possible.
  3. P(6 given even) = 1/3.
  4. The information has changed the probability.

The idea: the condition shrinks the sample space to the outcomes where B happened. The probability is the fraction of those in which A also happened.

$$P(A \mid B) = \frac{P(A \cap B)}{P(B)}$$

In words: the probability of both, divided by the probability of the condition.

Order matters. $P(A \mid B)$ and $P(B \mid A)$ are different questions with different answers: the probability that a card is a king given that it is a picture card is 1/3; the probability that it is a picture card given that it is a king is 1.

Check yourself

A fair die is rolled and the score is greater than 2. What is the probability that it is a 5?

  • 1/2

  • 1/3

  • 1/6

  • 1/4

Show the answer

1/4

The possible scores are 3, 4, 5 and 6, and one of the four is 5.

2Two-way tables

A two-way table makes conditional probabilities easy to read. The condition tells you which row or column total to divide by.

Worked example

Sport and gender

  1. Of 100 students, 60 are girls and 40 are boys. 24 of the girls and 26 of the boys play a sport.
  2. In all, 50 play a sport and 50 do not.
  3. $P(\text{sport}) = \frac{50}{100} = 0.5$.
  4. $P(\text{sport} \mid \text{girl}) = \frac{24}{60} = 0.4$. Divide by the number of girls.
  5. $P(\text{girl} \mid \text{sport}) = \frac{24}{50} = 0.48$. Divide by the number who play sport.
  6. $P(\text{boy} \mid \text{no sport}) = \frac{14}{50} = 0.28$.

Steps 4 and 5 use the same 24 students but different totals. Reading "given" as "out of" helps: "given girl" means "out of the girls".

Check with the formula: $P(\text{sport} \cap \text{girl}) = 0.24$ and $P(\text{girl}) = 0.6$, so $0.24 \div 0.6 = 0.4$.

Check yourself

In a group of 50 people, 20 wear glasses, and 8 of those are left-handed. What is P(left-handed | glasses)?

  • 0.8

  • 0.25

  • 0.16

  • 0.4

Show the answer

0.4

Out of the 20 who wear glasses, 8 are left-handed: 8 ÷ 20.

3Tree diagrams without replacement

In a tree diagram, the probabilities on the second set of branches are conditional: they depend on what happened first.

Worked example

Counters without replacement

  1. A bag has 5 red and 3 blue counters. Two are taken, one after the other, and not put back.
  2. First pick: P(red) = 5/8, P(blue) = 3/8.
  3. Second pick, given the first was red: 4 reds remain among 7, so P(red) = 4/7 and P(blue) = 3/7.
  4. Second pick, given the first was blue: P(red) = 5/7 and P(blue) = 2/7.
  5. P(both red) = 5/8 × 4/7 = 20/56 = 5/14.
  6. P(one of each) = 5/8 × 3/7 + 3/8 × 5/7 = 30/56 = 15/28.
  7. P(both blue) = 3/8 × 2/7 = 6/56 = 3/28.
  8. Check: 20/56 + 30/56 + 6/56 = 1.

Multiplying along the branches uses the rearranged formula:

$$P(A \cap B) = P(A) \times P(B \mid A)$$

Worked example

A conditional question from the tree

  1. Given that the two counters are the same colour, what is the probability that both are red?
  2. P(same colour) = 20/56 + 6/56 = 26/56.
  3. P(both red | same colour) = (20/56) ÷ (26/56) = 20/26 = 10/13.
Check yourself

A box has 4 good and 2 faulty bulbs. Two are taken without replacement. What is the probability that both are faulty?

  • 1/9

  • 1/3

  • 1/15

  • 2/15

Show the answer

1/15

2/6 × 1/5 = 2/30.

4Independent events

Two events are independent if knowing that one happened does not change the probability of the other.

Tests for independence, which are all equivalent:

  • $P(A \mid B) = P(A)$
  • $P(B \mid A) = P(B)$
  • $P(A \cap B) = P(A) \times P(B)$
Worked example

Testing independence

  1. $P(A) = 0.5$, $P(B) = 0.4$ and $P(A \cap B) = 0.2$.
  2. $P(A) \times P(B) = 0.5 \times 0.4 = 0.2$.
  3. This equals $P(A \cap B)$, so A and B are independent.
  4. Check another way: $P(A \mid B) = 0.2 \div 0.4 = 0.5 = P(A)$.
Worked example

The sport table

  1. $P(\text{sport}) = 0.5$ but $P(\text{sport} \mid \text{girl}) = 0.4$.
  2. They differ, so playing sport and gender are not independent in this group.

Do not confuse independent with mutually exclusive. Mutually exclusive events cannot happen together, so $P(A \cap B) = 0$. If one happens, the other certainly does not, which makes them strongly dependent.

Picking with replacement gives independent events. Picking without replacement gives dependent events.

Check yourself

P(A) = 0.3, P(B) = 0.6 and P(A ∩ B) = 0.18. Are A and B independent?

  • Yes, because 0.3 × 0.6 = 0.18

  • No, because they can happen together

  • No, because 0.3 + 0.6 is not 0.18

  • It cannot be decided

Show the answer

Yes, because 0.3 × 0.6 = 0.18

The product of the probabilities equals the probability of both.

5Reversing the condition

Many real questions ask for a probability "the wrong way round": you know $P(\text{positive} \mid \text{ill})$, and you want $P(\text{ill} \mid \text{positive})$. Using natural frequencies (imagining a large group) is the clearest method.

Worked example

A medical test

  1. 1% of people have a condition. The test is positive for 90% of people who have it, and gives a false positive for 5% of people who do not.
  2. Imagine 1,000 people. 10 have the condition, and 990 do not.
  3. Of the 10 with it, 9 test positive.
  4. Of the 990 without it, 5% test positive: 49.5.
  5. Total positives: 58.5.
  6. $P(\text{has it} \mid \text{positive}) = \dfrac{9}{58.5} \approx 0.154$.

Only about 15% of positive results are true positives. The condition is rare, so the few false positives from the very large healthy group outnumber the true positives.

This surprises most people, who confuse $P(\text{positive} \mid \text{ill}) = 0.9$ with $P(\text{ill} \mid \text{positive}) = 0.15$. The same confusion appears in courts ("the prosecutor's fallacy") and in news reports about risk.

With the formula: $P(\text{ill} \cap \text{positive}) = 0.01 \times 0.9 = 0.009$; $P(\text{positive}) = 0.009 + 0.99 \times 0.05 = 0.0585$; $0.009 \div 0.0585 = 0.154$.

Check yourself

Why can a positive result from an accurate test still mean a low chance of having a rare condition?

  • False positives from the large healthy group outnumber the true positives

  • Rare conditions cannot be tested for accurately, so results are random

  • The test is wrong more often than it is right for every group of people

  • Positive results are always false when the condition is rare in a group

Show the answer

False positives from the large healthy group outnumber the true positives

When very few people have the condition, even a small false positive rate produces many false alarms.

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