Vertex Learn

Two-way tables and conditional probability

What this lesson covers

  • A conditional probability restricts attention to one row or column of the table.
  • P(A given B) and P(B given A) use different totals and are usually different.
Key idea

Two variables, one table

  • A two-way table counts two things at once.
  • Here: a part-time job, and passing all externals.
  • 250 Year 12 students.
Passed allDid notTotal
Part-time job543690
No job12040160
Total17476250
Worked example

Read the totals first

  • Rows, then columns.
  • Both must reach 250.
  1. job: 54 + 36 = 90row total
  2. no job: 120 + 40 = 160row total
  3. passed: 54 + 120 = 174column total
  4. did not: 36 + 40 = 76column total
  5. rows: 90 + 160 = 250grand total
  6. columns: 174 + 76 = 250consistent
Worked example

Plain probabilities: out of everyone

  • No condition: ÷ 250.
  • "And" is a single cell.
  1. P(pass) = 174 ÷ 250out of everyone
  2. = 0.696
  3. P(job and pass) = 54 ÷ 250one cell
  4. = 0.216
  5. P(no job) = 160 ÷ 250a row total
  6. = 0.64
Key idea

"Given" changes the total

  • "Given a job" means: only look at the job row.
  • The total becomes 90, not 250.
  • P(pass | job) = 54 ÷ 90 = 0.6.
Passed allDid notTotal
Part-time job543690
No job12040160
Total17476250
Key idea

Try it: given changes the total

Worked example

Compare the two groups

  • Each row, its own total.
  • No job: passed more often.
Two columns. Among 90 with a job, 0.6 passed. Among 160 with no job, 0.75 passed.
  1. P(pass | job) = 54 ÷ 90job row: 90
  2. = 0.6
  3. P(pass | no job) = 120 ÷ 160
  4. = 0.75no-job row: 160
Key idea

Try it: compare the two groups

Worked example

The reverse is a different question

  • Only the pass column.
  • Not 0.6: order matters.
  1. P(job | pass) = 54 ÷ 174pass column: 174
  2. = 0.31034…calculator
  3. = 0.31034 d.p.
  4. P(job | pass) ≠ P(pass | job)
Key idea

Saying it in words

  • 0.6: of the students with a job, 60% passed.
  • 0.3103: of those who passed, 31% had a job.
  • Different groups, different stories.
Key idea

Finding the right total

  • Underline the word after "given".
  • That names the row or column you are in.
  • Its total is your denominator.
Key idea

Try it: pick the right total

Key idea

What the table cannot say

  • It shows passing and jobs are linked.
  • It does not show a job causes failing.
  • Other factors could explain both.
Key idea

Where the marks are

  • Achieved: probabilities from the table.
  • Merit: conditional probabilities, chosen correctly.
  • Excellence: interpreting them in context.
Summary

What to take away

  • "Given" picks the total.
No conditiondivide by the grand total
"and"one cell ÷ grand total
"given"the given row or column total
Order mattersP(A | B) ≠ P(B | A)
Checkrow and column totals agree

Common mistakes

  • P(pass | job) = 54 ÷ 250 = 0.216
    "Given a job" means only the job row, so the total is 90: 54 ÷ 90 = 0.6.
  • P(job | pass) is the same as P(pass | job), 0.6.
    Order matters: "given pass" uses the pass column total, so P(job | pass) = 54 ÷ 174 = 0.3103.
  • P(job and pass) = 54 ÷ 90 = 0.6
    "And" with no condition is one cell out of everyone: 54 ÷ 250 = 0.216.
  • Students with a job passed less often, so a job causes failing.
    The table shows a link, not a cause; other factors could explain both.
Your turn

Your turn: eight questions

  • Draw the two-way table first.
  • Underline "given" in 2, 3 and 4.
Question
DataCoffee: 72 poor, 108 good sleep. None: 24 poor, 96 good.
1P(a randomly chosen adult sleeps poorly)?
2P(sleeps poorly | drinks coffee)?
3P(drinks coffee | sleeps poorly)?
4P(sleeps well | no coffee)?
5P(drinks coffee and sleeps well)?
6Aroha writes P(drinks coffee | sleeps well) = 108 ÷ 180. What is her mistake?
7P(sleeps poorly | drinks coffee) = 0.4. What does this mean?
8P(poor sleep | coffee) is 0.4 and P(poor sleep | no coffee) is 0.2. Does this show coffee causes poor sleep?
1
2
3
4
5
6
7
8
Show answer

1. (72 + 24) ÷ 300 = 0.32. 2. 72 ÷ 180 = 0.4. 3. 72 ÷ 96 = 0.75. 4. 96 ÷ 120 = 0.8. 5. 0.36. "And" is one cell over the grand total: 108 ÷ 300 = 0.36. 6. Given sleeps well, the total is the good-sleep column, 108 + 96 = 204, so 108 ÷ 204 = 0.5294. She used the coffee row total. 7. Of the adults who drink coffee, 40% sleep poorly. The given group (coffee drinkers) is the total: 72 ÷ 180. 8. No. The table shows coffee and poor sleep are linked, but it cannot show cause: other factors (such as stress or shift work) could explain both.

Worked example

The answers: questions 1 and 2

  1. coffee: 72 + 108 = 180row total
  2. no coffee: 24 + 96 = 120row total
  3. poorly: 72 + 24 = 96column total
  4. check: 180 + 120 = 300grand total
  5. 1. P(poorly) = 96 ÷ 300out of everyone
  6. = 0.32
  7. 2. P(poorly | coffee) = 72 ÷ 180coffee row
  8. = 0.4
Worked example

The answers: questions 3 and 4

  1. 3. P(coffee | poorly) = 72 ÷ 96poorly column
  2. = 0.75
  3. 4. P(well | no coffee) = 96 ÷ 120no-coffee row
  4. = 0.8
Your turn

Sample question: Achieved

A survey of 300 Year 12 students recorded whether they keep their phone in their bedroom at night and whether they slept less than 7 hours. Phone in bedroom: 84 slept less than 7 hours and 126 did not. No phone in bedroom: 18 slept less than 7 hours and 72 did not. Find the probability that a randomly chosen student slept less than 7 hours.

Hint

Add the column for less than 7 hours, then divide by everyone, 300.

Answer

P(less than 7 hours) = 102 ÷ 300 = 0.34

Step by step
  1. Put the numbers in a two-way table. Rows: phone, no phone. Columns: less than 7 hours, 7 or more.
  2. Find the totals first. Phone row: 84 + 126 = 210. No-phone row: 18 + 72 = 90. Together 300.
  3. Less than 7 hours column: 84 + 18 = 102.
  4. There is no "given" in the question, so the total is everyone: 300.
  5. P(less than 7 hours) = 102 ÷ 300 = 0.34.
  6. The classic mistake is to give 84 ÷ 300. That is only the phone students who slept less, not all of them.
  7. Check: the other column is 126 + 72 = 198, and 102 + 198 = 300.
Full working
  1. phone: 84 + 126 = 210; no phone: 18 + 72 = 90row totals
  2. less than 7 h: 84 + 18 = 102column total
  3. P(less than 7 h) = 102 ÷ 300no condition, so out of everyone
  4. 0.34
Your turn

Sample questions: Merit

1

A survey of 300 Year 12 students recorded whether they keep their phone in their bedroom at night and whether they slept less than 7 hours. Phone in bedroom: 84 slept less than 7 hours and 126 did not. No phone: 18 slept less than 7 hours and 72 did not. Find P(slept less than 7 hours given phone in bedroom) and P(phone in bedroom given slept less than 7 hours). Explain in words why they are different.

Hint

The word after "given" tells you which row or column total to divide by.

Answer

0.4 and 0.8235

Step by step
  1. Find the totals: phone row 210, no-phone row 90, less-than-7 column 102.
  2. First: given phone in bedroom. Only the phone row counts, so the total is 210.
  3. P(less than 7 given phone) = 84 ÷ 210 = 0.4.
  4. Second: given slept less than 7 hours. Only that column counts, so the total is 102.
  5. P(phone given less than 7) = 84 ÷ 102 = 0.8235.
  6. Both use the same cell, 84, but different totals, so the answers differ.
  7. In words: of the students with a phone in the room, 40% slept less than 7 hours. Of the students who slept less than 7 hours, about 82% had a phone in the room.
  8. The second is bigger because most students in the survey (210 of 300) had a phone in their room anyway.
  9. The classic mistake is to treat the two as the same. Underline the word after "given" to find your total.
Full working
  1. P(short given phone) = 84 ÷ 210 = 0.4the phone row total
  2. P(phone given short) = 84 ÷ 102 = 0.8235the short-sleep column total
  3. same cell, different totals
  4. 0.4 and 0.8235
2

An insurer looked at 400 drivers. 35% were under 25. 60 of the under-25 drivers made a claim, and 100 drivers made a claim in total. Find the probability that a driver made a claim given they were under 25, and the probability that a driver was under 25 given they made a claim. Compare the claim rates of the two age groups.

Hint

Build the two-way table from the words first. 35% of 400 gives the under-25 row total.

Answer

P(claim given under 25) = 0.4286; P(under 25 given claim) = 0.6; claim rate 0.4286 under 25 against 0.1538 for 25 and over

Step by step
  1. Build the table. Rows: under 25, 25 and over. Columns: claim, no claim.
  2. Under 25: 35% of 400 = 0.35 × 400 = 140 drivers. So 25 and over: 400 − 140 = 260.
  3. Claims: 60 under 25, and 100 − 60 = 40 aged 25 and over.
  4. P(claim given under 25): the under-25 row only, total 140. 60 ÷ 140 = 0.4286.
  5. P(under 25 given claim): the claim column only, total 100. 60 ÷ 100 = 0.6.
  6. To compare age groups, each needs its own claim rate. 25 and over: 40 ÷ 260 = 0.1538.
  7. So young drivers claimed at a rate of about 43%, nearly three times the 15% of older drivers.
  8. And 60% of all claims came from the under-25 drivers, even though they were only 35% of the drivers.
  9. The classic mistake is to compare 60 and 40 claims directly. The groups are different sizes, so compare rates.
Full working
  1. under 25: 0.35 × 400 = 140; 25 and over: 260complete the table
  2. claims 25 and over: 100 − 60 = 40
  3. P(claim given under 25) = 60 ÷ 140 = 0.4286row total
  4. P(under 25 given claim) = 60 ÷ 100 = 0.6column total
  5. P(claim given 25 and over) = 40 ÷ 260 = 0.1538
  6. 0.4286; 0.6; 0.4286 against 0.1538
Your turn

Sample questions: Excellence

1

A survey of 300 Year 12 students found: phone in bedroom, 84 slept less than 7 hours and 126 did not; no phone, 18 slept less than 7 hours and 72 did not. Use conditional probabilities to decide whether short sleep is independent of having a phone in the bedroom. How many of the 90 no-phone students would need to be short sleepers for the two to be independent? Explain what the survey can and cannot tell us.

Hint

Independent means the chance of short sleep is the same in both rows. Compare P(short given phone) with P(short given no phone).

Answer

0.4 against 0.2, so not independent; 36 of the 90 would be needed; the survey shows an association but not that phones cause short sleep

Step by step
  1. Recall: two events are independent when knowing one does not change the chance of the other. In a table, the rows give the same conditional probability.
  2. P(short given phone) = 84 ÷ 210 = 0.4.
  3. P(short given no phone) = 18 ÷ 90 = 0.2.
  4. 0.4 is twice 0.2. Knowing a student has a phone in the room changes the chance of short sleep, so the events are not independent.
  5. For independence, the no-phone row would need the same rate, 0.4.
  6. 0.4 × 90 = 36, so 36 of the 90 no-phone students would need to be short sleepers.
  7. Check: then 84 + 36 = 120 short sleepers in all, and 120 ÷ 300 = 0.4, the same as in each row. That is what independence looks like.
  8. What the survey can tell us: in this group, short sleep was more common among students with a phone in the room.
  9. What it cannot tell us: that phones cause short sleep. Students who stay up late for other reasons, such as part-time jobs or stress, might also be the ones who keep their phone nearby.
  10. Also, if the 300 were not a random sample, the result may not hold for other Year 12 students.
Full working
  1. P(short given phone) = 84 ÷ 210 = 0.4
  2. P(short given no phone) = 18 ÷ 90 = 0.2
  3. 0.4 ≠ 0.2so not independent
  4. 0.4 × 90 = 36same rate in both rows
  5. check: 120 ÷ 300 = 0.4
  6. not independent; 36 needed; association, not cause
2

In a study, 200 people were vaccinated and 300 were not. The number of unvaccinated people who got sick was 10 more than three times the number of vaccinated people who got sick. Of everyone who got sick, 20% were vaccinated. Find how many vaccinated people got sick, then compare P(sick given vaccinated) with P(sick given not vaccinated).

Hint

Let x be the vaccinated people who got sick. Write P(vaccinated given sick) using x and set it equal to 0.2.

Answer

x = 10; P(sick given vaccinated) = 0.05 and P(sick given not vaccinated) = 0.1333, so unvaccinated people were about 2.7 times as likely to get sick

Step by step
  1. Name the unknown: x vaccinated people got sick. Then 3x + 10 unvaccinated people got sick.
  2. Total sick: x + 3x + 10 = 4x + 10.
  3. "Of everyone who got sick, 20% were vaccinated" is a given-sick probability. Its total is the sick column: x ÷ (4x + 10) = 0.2.
  4. Multiply both sides by (4x + 10): x = 0.8x + 2.
  5. So 0.2x = 2 and x = 10.
  6. Then 3 × 10 + 10 = 40 unvaccinated people got sick, and 50 got sick altogether. Check: 10 ÷ 50 = 0.2.
  7. Now the comparison uses row totals. P(sick given vaccinated) = 10 ÷ 200 = 0.05.
  8. P(sick given not vaccinated) = 40 ÷ 300 = 0.1333.
  9. 0.1333 ÷ 0.05 = 2.67, so unvaccinated people were about 2.7 times as likely to get sick.
  10. Notice that 20% of the sick were vaccinated, but that does not mean the vaccine fails 20% of the time. Only 5% of vaccinated people got sick.
  11. The classic mistake is to mix up P(vaccinated given sick) and P(sick given vaccinated). They use different totals.
Full working
  1. vaccinated sick x, unvaccinated sick 3x + 10, total sick 4x + 10
  2. x ÷ (4x + 10) = 0.2P(vaccinated given sick)
  3. x = 0.8x + 2, so x = 10
  4. P(sick given vaccinated) = 10 ÷ 200 = 0.05
  5. P(sick given not vaccinated) = 40 ÷ 300 = 0.1333
  6. x = 10; 0.05 against 0.1333

Challenge

1

A Dunedin school surveyed 600 students on whether they used the library last week. 40% of the students are seniors and the rest are juniors. P(used the library given senior) = 0.35 and P(senior given used the library) = 0.5. Complete the two-way table, then find P(used the library given junior) and P(senior given did not use the library).

Hint

Start with the senior row total, then use the first conditional to fill one cell. The second conditional tells you that same cell is half of the library column.

Answer

Table: senior 84 library, 156 not; junior 84 library, 276 not. P(library given junior) = 0.2333; P(senior given no library) = 0.3611

Step by step
  1. Seniors: 0.4 × 600 = 240, so juniors are 360.
  2. "Given senior" uses the senior row: 0.35 × 240 = 84 seniors used the library.
  3. "Given used the library" uses the library column: 84 is half of it, so the column total is 168 and 168 − 84 = 84 juniors used it.
  4. Fill the rest: seniors not using it 240 − 84 = 156, juniors 360 − 84 = 276, so 432 did not use it.
  5. P(library given junior) = 84 ÷ 360 = 0.2333. P(senior given no library) = 156 ÷ 432 = 0.3611.
  6. Check: 84 + 156 + 84 + 276 = 600.
Full working
  1. seniors = 0.4 × 600 = 240, juniors = 360
  2. senior and library = 0.35 × 240 = 84senior row
  3. library column = 84 ÷ 0.5 = 168, junior and library = 84library column
  4. senior not = 156, junior not = 276, not total = 432
  5. P(library given junior) = 84 ÷ 360 = 0.2333junior row
  6. P(senior given not) = 156 ÷ 432 = 0.3611not-library column
  7. 0.2333 and 0.3611
2

In a survey of 400 students about playing sport and playing music, P(music given sport) = P(sport given music) = 0.3, and 49% of the students do neither. How many students do both? Are sport and music independent for these students? Explain.

Hint

Both conditionals have the same top number, the number who do both. If the two fractions are equal, what must be true about the totals underneath?

Answer

36 students do both (120 play sport, 120 play music); yes, independent, since P(music given sport) = 0.3 = P(music)

Step by step
  1. P(music given sport) = both ÷ sport total and P(sport given music) = both ÷ music total. Same top, same answer, so the sport total equals the music total. Call it k.
  2. Then both = 0.3k, so sport only = 0.7k and music only = 0.7k.
  3. At least one = 0.7k + 0.7k + 0.3k = 1.7k, and that is 51% of 400 = 204. So k = 120 and both = 36.
  4. Table: both 36, sport only 84, music only 84, neither 196. Total 400.
  5. P(music) = 120 ÷ 400 = 0.3, the same as P(music given sport). Knowing a student plays sport does not change the chance they play music, so the two are independent.
Full working
  1. both ÷ n(sport) = both ÷ n(music), so n(sport) = n(music) = ksame numerator
  2. both = 0.3k, sport only = music only = 0.7k
  3. 1.7k = 0.51 × 400 = 204at least one = 1 − neither
  4. k = 120, both = 0.3 × 120 = 36
  5. P(music) = 120 ÷ 400 = 0.3 = P(music given sport)so independent
  6. 36 students; independent
3

In a survey of 500 Year 12 students, 30% play a musical instrument. Students who play an instrument are twice as likely to get Excellence in maths as students who do not. Altogether 65 students got Excellence. Complete the two-way table and find P(plays an instrument given Excellence). A teacher says, "Players are twice as likely to get Excellence, so most Excellence students must play an instrument." Evaluate this claim. Keeping the same two Excellence rates, what fraction of students would need to play an instrument for exactly half of the Excellence students to be players?

Hint

Let P(Excellence given no instrument) = p, so P(Excellence given instrument) = 2p. Write the Excellence column total in terms of p and set it equal to 65.

Answer

Table: instrument 30 Excellence, 120 not; no instrument 35 Excellence, 315 not. P(instrument given Excellence) = 613 ≈ 0.4615. The claim is wrong: players are only 150 of the 500 students, so fewer than half of the Excellence students play. One third of the students would need to play.

Step by step
  1. Players: 0.3 × 500 = 150. Non-players: 350.
  2. Excellence: 150 × 2p + 350 × p = 650p = 65, so p = 0.1. Players get Excellence at rate 0.2 and non-players at 0.1.
  3. Table: players 30 Excellence and 120 not; non-players 35 Excellence and 315 not. Excellence column 65, not-Excellence column 435. Check: 30 + 120 + 35 + 315 = 500.
  4. "Given Excellence" uses the Excellence column: 30 ÷ 65 = 613 ≈ 0.4615.
  5. The teacher has mixed up P(Excellence given instrument) with P(instrument given Excellence). Players have the higher rate, but there are far fewer of them, so only 30 of the 65 Excellence students play.
  6. For half: with n players, 0.2n = 0.1(500 − n), so 0.3n = 50 and n = 5003, one third of the students.
Full working
  1. players = 0.3 × 500 = 150, non-players = 350
  2. 150 × 2p + 350 × p = 650p = 65, so p = 0.1Excellence column
  3. players: 30 E, 120 not; non-players: 35 E, 315 not
  4. P(instrument given E) = 30 ÷ 65 = 613 ≈ 0.4615Excellence column
  5. 613 < 12, so the claim is wrongfewer players overall
  6. 0.2n = 0.1(500 − n), 0.3n = 50, n = 5003one third of 500
  7. 613 ≈ 0.4615; one third of the students

More challenge problems

Practice

Practise this

Worksheet with answersWithout answersDownload PDF
2026 practice paper with worked answersOpen the paper
Report a mistake

More in AS 91267

Is your child on track?

Take the free placement test