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.
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 all | Did not | Total | |
|---|---|---|---|
| Part-time job | 54 | 36 | 90 |
| No job | 120 | 40 | 160 |
| Total | 174 | 76 | 250 |
Read the totals first
- Rows, then columns.
- Both must reach 250.
- job: 54 + 36 = 90row total
- no job: 120 + 40 = 160row total
- passed: 54 + 120 = 174column total
- did not: 36 + 40 = 76column total
- rows: 90 + 160 = 250grand total
- columns: 174 + 76 = 250consistent
Plain probabilities: out of everyone
- No condition: ÷ 250.
- "And" is a single cell.
- P(pass) = 174 ÷ 250out of everyone
- = 0.696
- P(job and pass) = 54 ÷ 250one cell
- = 0.216
- P(no job) = 160 ÷ 250a row total
- = 0.64
"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 all | Did not | Total | |
|---|---|---|---|
| Part-time job | 54 | 36 | 90 |
| No job | 120 | 40 | 160 |
| Total | 174 | 76 | 250 |
Try it: given changes the total
Compare the two groups
- Each row, its own total.
- No job: passed more often.
- P(pass | job) = 54 ÷ 90job row: 90
- = 0.6
- P(pass | no job) = 120 ÷ 160
- = 0.75no-job row: 160
Try it: compare the two groups
The reverse is a different question
- Only the pass column.
- Not 0.6: order matters.
- P(job | pass) = 54 ÷ 174pass column: 174
- = 0.31034…calculator
- = 0.31034 d.p.
- P(job | pass) ≠ P(pass | job)
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.
Finding the right total
- Underline the word after "given".
- That names the row or column you are in.
- Its total is your denominator.
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.
Where the marks are
- Achieved: probabilities from the table.
- Merit: conditional probabilities, chosen correctly.
- Excellence: interpreting them in context.
What to take away
- "Given" picks the total.
| No condition | divide by the grand total |
| "and" | one cell ÷ grand total |
| "given" | the given row or column total |
| Order matters | P(A | B) ≠ P(B | A) |
| Check | row 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: four questions
- Draw the two-way table first.
- Underline "given" in 2, 3 and 4.
| Question | |
|---|---|
| Data | Coffee: 72 poor, 108 good sleep. None: 24 poor, 96 good. |
| 1 | P(a randomly chosen adult sleeps poorly)? |
| 2 | P(sleeps poorly | drinks coffee)? |
| 3 | P(drinks coffee | sleeps poorly)? |
| 4 | P(sleeps well | no coffee)? |
Show answer
1. (72 + 24) ÷ 300 = 0.32. 2. 72 ÷ 180 = 0.4. 3. 72 ÷ 96 = 0.75. 4. 96 ÷ 120 = 0.8.
The answers: questions 1 and 2
- coffee: 72 + 108 = 180row total
- no coffee: 24 + 96 = 120row total
- poorly: 72 + 24 = 96column total
- check: 180 + 120 = 300grand total
- 1. P(poorly) = 96 ÷ 300out of everyone
- = 0.32
- 2. P(poorly | coffee) = 72 ÷ 180coffee row
- = 0.4
The answers: questions 3 and 4
- 3. P(coffee | poorly) = 72 ÷ 96poorly column
- = 0.75
- 4. P(well | no coffee) = 96 ÷ 120no-coffee row
- = 0.8
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
- Put the numbers in a two-way table. Rows: phone, no phone. Columns: less than 7 hours, 7 or more.
- Find the totals first. Phone row: 84 + 126 = 210. No-phone row: 18 + 72 = 90. Together 300.
- Less than 7 hours column: 84 + 18 = 102.
- There is no "given" in the question, so the total is everyone: 300.
- P(less than 7 hours) = 102 ÷ 300 = 0.34.
- The classic mistake is to give 84 ÷ 300. That is only the phone students who slept less, not all of them.
- Check: the other column is 126 + 72 = 198, and 102 + 198 = 300.
Full working
- phone: 84 + 126 = 210; no phone: 18 + 72 = 90row totals
- less than 7 h: 84 + 18 = 102column total
- P(less than 7 h) = 102 ÷ 300no condition, so out of everyone
- 0.34
Sample questions: Merit
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
- Find the totals: phone row 210, no-phone row 90, less-than-7 column 102.
- First: given phone in bedroom. Only the phone row counts, so the total is 210.
- P(less than 7 given phone) = 84 ÷ 210 = 0.4.
- Second: given slept less than 7 hours. Only that column counts, so the total is 102.
- P(phone given less than 7) = 84 ÷ 102 = 0.8235.
- Both use the same cell, 84, but different totals, so the answers differ.
- 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.
- The second is bigger because most students in the survey (210 of 300) had a phone in their room anyway.
- The classic mistake is to treat the two as the same. Underline the word after "given" to find your total.
Full working
- P(short given phone) = 84 ÷ 210 = 0.4the phone row total
- P(phone given short) = 84 ÷ 102 = 0.8235the short-sleep column total
- same cell, different totals
- 0.4 and 0.8235
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
- Build the table. Rows: under 25, 25 and over. Columns: claim, no claim.
- Under 25: 35% of 400 = 0.35 × 400 = 140 drivers. So 25 and over: 400 − 140 = 260.
- Claims: 60 under 25, and 100 − 60 = 40 aged 25 and over.
- P(claim given under 25): the under-25 row only, total 140. 60 ÷ 140 = 0.4286.
- P(under 25 given claim): the claim column only, total 100. 60 ÷ 100 = 0.6.
- To compare age groups, each needs its own claim rate. 25 and over: 40 ÷ 260 = 0.1538.
- So young drivers claimed at a rate of about 43%, nearly three times the 15% of older drivers.
- And 60% of all claims came from the under-25 drivers, even though they were only 35% of the drivers.
- The classic mistake is to compare 60 and 40 claims directly. The groups are different sizes, so compare rates.
Full working
- under 25: 0.35 × 400 = 140; 25 and over: 260complete the table
- claims 25 and over: 100 − 60 = 40
- P(claim given under 25) = 60 ÷ 140 = 0.4286row total
- P(under 25 given claim) = 60 ÷ 100 = 0.6column total
- P(claim given 25 and over) = 40 ÷ 260 = 0.1538
- 0.4286; 0.6; 0.4286 against 0.1538
Sample questions: Excellence
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
- 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.
- P(short given phone) = 84 ÷ 210 = 0.4.
- P(short given no phone) = 18 ÷ 90 = 0.2.
- 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.
- For independence, the no-phone row would need the same rate, 0.4.
- 0.4 × 90 = 36, so 36 of the 90 no-phone students would need to be short sleepers.
- 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.
- What the survey can tell us: in this group, short sleep was more common among students with a phone in the room.
- 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.
- Also, if the 300 were not a random sample, the result may not hold for other Year 12 students.
Full working
- P(short given phone) = 84 ÷ 210 = 0.4
- P(short given no phone) = 18 ÷ 90 = 0.2
- 0.4 ≠ 0.2so not independent
- 0.4 × 90 = 36same rate in both rows
- check: 120 ÷ 300 = 0.4
- not independent; 36 needed; association, not cause
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
- Name the unknown: x vaccinated people got sick. Then 3x + 10 unvaccinated people got sick.
- Total sick: x + 3x + 10 = 4x + 10.
- "Of everyone who got sick, 20% were vaccinated" is a given-sick probability. Its total is the sick column: x ÷ (4x + 10) = 0.2.
- Multiply both sides by (4x + 10): x = 0.8x + 2.
- So 0.2x = 2 and x = 10.
- Then 3 × 10 + 10 = 40 unvaccinated people got sick, and 50 got sick altogether. Check: 10 ÷ 50 = 0.2.
- Now the comparison uses row totals. P(sick given vaccinated) = 10 ÷ 200 = 0.05.
- P(sick given not vaccinated) = 40 ÷ 300 = 0.1333.
- 0.1333 ÷ 0.05 = 2.67, so unvaccinated people were about 2.7 times as likely to get sick.
- 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.
- The classic mistake is to mix up P(vaccinated given sick) and P(sick given vaccinated). They use different totals.
Full working
- vaccinated sick x, unvaccinated sick 3x + 10, total sick 4x + 10
- x ÷ (4x + 10) = 0.2P(vaccinated given sick)
- x = 0.8x + 2, so x = 10
- P(sick given vaccinated) = 10 ÷ 200 = 0.05
- P(sick given not vaccinated) = 40 ÷ 300 = 0.1333
- x = 10; 0.05 against 0.1333
Practise this
Report a mistake
More in AS 91267
Probability: when to add and when to multiply7 min
Two-way tables and conditional probability6 min
Probability trees from written information, forwards and backwards8 min
Expected value and expected numbers7 min
Relative risk: above 1, below 1, and evaluating a claim7 min
The normal distribution: probabilities and z-values8 min
Inverse normal: finding a value, the mean or the standard deviation8 min
Comparing distributions: shape, centre and spread7 min
Probability rules: 7 exam questions solved step by step10 min
Two-way tables: 7 exam questions solved step by step10 min
Probability trees: 7 exam questions solved step by step10 min
Expected value: 7 exam questions solved step by step10 min
Relative risk: 7 exam questions solved step by step9 min
Normal distribution: 7 exam questions solved step by step10 min
Inverse normal: 7 exam questions solved step by step10 min
Comparing distributions: 7 exam questions solved step by step10 minIs your child on track?
Take the free placement test