Conditional Probability from Tables

The given row’s total is the new denominator.

Reading a two-way table

A class of 22 children is sorted two ways at once: whether each child walks to school or rides, and whether each child is a girl or a boy. 7 girls walk, 5 boys walk, 4 girls ride and 6 boys ride.

The totals sit at the ends of the rows and columns. The walks row holds 7 + 5 = 12 children and the rides row 4 + 6 = 10. The girls column holds 7 + 4 = 11 and the boys column 5 + 6 = 11. Both ways of adding give 22.

Pick one child at random from all 22. Then P(walks) = 12/22 = 6/11, and the chance of a girl who walks is P(girl ∩ walks) = 7/22. Both have the whole class, 22, on the bottom.

girlsboystotalwalks7512rides4610total111122

The 22 children: the four cells, the row totals 12 and 10, the column totals 11 and 11, and the grand total 22.

A condition narrows the table

Now the child is picked from the walkers only. P(girl | walks) is read "the probability of a girl, given walks". The bar means "given that", and what comes after it is already known.

Knowing the child walks rules out every child in the rides row. Only the walks row is left, and its total, 12, becomes the denominator in place of 22.

girlsboystotalwalks7512rides4610total111122

Given walks, only the walks row counts, and its total is 12.

Read the answer from one row

Of the 12 walkers, 7 are girls. So P(girl | walks) = 7/12.

Set it beside the probabilities from the whole class. P(girl) = 11/22 = 1/2, and P(girl ∩ walks) = 7/22. The 7 on top is the same in 7/22 and 7/12; the condition changes only what it is divided by.

girlsboystotalwalks7512rides4610total111122

The 7 girls who walk, out of the 12 walkers: P(girl | walks) = 7/12.

The condition turned round

P(walks | girl) asks something different: the child is known to be a girl, and the question is whether she walks. Now the whole is the girls column, 11 children, and 7 of them walk. So P(walks | girl) = 7/11.

P(girl | walks) = 7/12 and P(walks | girl) = 7/11 have the same top and different bottoms. Whatever comes after the bar picks the row or column, and its total is the denominator.

girlsboystotalwalks7512rides4610total111122

Given girl, only the girls column counts: 7 of its 11 children walk.

The same answer by formula

The row can be read in probabilities instead of counts. P(girl | walks) = P(girl ∩ walks) / P(walks) = 7/22 ÷ 12/22 = 7/12. The 22s cancel, which is the table's way of saying that only the walks row matters.

In general, P(B | A) = P(A ∩ B) / P(A): the part of A that is also in B, as a fraction of A.

Comparing two groups

Do girls or boys in this class walk more often? Compare P(walks | girl) = 7/11 with P(walks | boy) = 5/11. A girl is more likely to walk.

Here both columns hold 11 children, so the counts 7 and 5 happen to compare fairly. When the groups are different sizes, the counts mislead and each must first be divided by its own total. In the application below, 24 late trains on wet days and 14 on dry days look close, but the wet days number 60 and the dry days 140.

The usual mistakes

Dividing by the grand total. 7/22 is P(girl ∩ walks), a child picked from the whole class who is a girl and walks. Given walks, the riders cannot be picked, so the denominator is 12.

Using the wrong margin. The girls total, 11, is the denominator for P(walks | girl), not for P(girl | walks).

Comparing counts from groups of different sizes. Divide each count by its own row or column total first.

Late trains

In the application below, 200 rail journeys are sorted by the weather and by whether the train was late. The given weather chooses the row, that row's total is the denominator, and the two conditional probabilities are compared by dividing one by the other.

Worked example: Late Trains on Wet and Dry Days, and How Many Times as Likely a Delay Is on a Wet Day

Question A rail company recorded 200 journeys on one line. 60 of them were on wet days, and 24 of those were late. The other 140 were on dry days, and 14 of those were late. (a) A journey on a wet day is chosen at random. Find the probability that it was late. (b) How many times as likely is a journey to be late on a wet day as on a dry day?

  1. 1.Complete the two-way table. On wet days 60 − 24 = 36 journeys were on time, and on dry days 140 − 14 = 126. The Late column totals 24 + 14 = 38 and the On time column 36 + 126 = 162.

    LateOn timeTotalWet243660Dry14126140Total3816220060 − 24 = 36 and 140 − 14 = 12624 + 14 = 38 and 36 + 126 = 162
    LateOn timeTotalWet243660Dry14126140Total3816220060 − 24 = 36 and 140 − 14 = 12624 + 14 = 38 and 36 + 126 = 162
    Complete the table: 36 and 126 journeys were on time, and the columns total 38 and 162.
  2. 2.(a) Given a wet day, the whole is the Wet row, 60 journeys, and 24 of them were late: P(L | R) = 2460 = 25.

    LateOn timeTotalWet243660Dry14126140Total38162200given wet: 24/60 = 2/5
    LateOn timeTotalWet243660Dry14126140Total38162200given wet: 24/60 = 2/5
    (a) Given a wet day, the whole is the Wet row: P(L | R) = 2460 = 25.
  3. 3.Given a dry day, the whole is the Dry row, 140 journeys: P(L | R') = 14140 = 110.

    LateOn timeTotalWet243660Dry14126140Total38162200given dry: 14/140 = 1/10
    LateOn timeTotalWet243660Dry14126140Total38162200given dry: 14/140 = 1/10
    Given a dry day, the whole is the Dry row: P(L | R') = 14140 = 110.
  4. 4.(b) Divide one conditional probability by the other: 25 ÷ 110 = 25 × 10 = 4. A journey is 4 times as likely to be late on a wet day.

    LateOn timeTotalWet243660Dry14126140Total381622002/5 is 4 times 1/10
    LateOn timeTotalWet243660Dry14126140Total381622002/5 is 4 times 1/10
    (b) 25 ÷ 110 = 4: a delay is 4 times as likely on a wet day.
  5. 5.Check: over all 200 journeys, P(L) = 38200 = 19100. That is not equal to P(L | R) = 25, so lateness and the weather are not independent, which agrees with (b).

    LateOn timeTotalWet243660Dry14126140Total38162200all journeys: 38/200 = 19/100not equal to 2/5, so not independent
    LateOn timeTotalWet243660Dry14126140Total38162200all journeys: 38/200 = 19/100not equal to 2/5, so not independent
    P(L) = 38200 = 19100 is not P(L | R), so lateness depends on the weather.

Answer: (a) 25; (b) 4 times as likely

Common mistakes

  • Answering (a) with 24200. That is P(L ∩ R), the probability that a journey chosen from all 200 was both wet and late. Given a wet day, only the 60 wet journeys can be chosen.
  • Comparing the counts 24 and 14 and saying a wet day is less than twice as likely to bring a delay. There were far fewer wet journeys, so the counts must first be divided by their own row totals.

More sets and counting problems, worked step by step →

Practice Conditional Probability from Tables in the app