L2-04 · Calculate conditional probability
A conditional probability counts inside one group. The group you condition on becomes the whole, so its total goes on the bottom of the fraction. If knowing one thing does not change the chance of the other, the two events are independent.
What you will learn¶
I can find a conditional probability from a two-way table by dividing by the right total.
I can test whether two events are independent by comparing P(A | B) with P(A).
I can explain why independent and mutually exclusive are different ideas.
Story: Do musicians like math more?¶
Maya’s school club ran an imagined survey of 200 students. These are made-up numbers, not a real school. Each student answered two questions. Do you play an instrument? Do you like math? Leo put the answers into a two-way table with a total for every row and column.
Of the 200 students, 60 play an instrument. Of those 60, 36 like math and 24 do not. Of the 140 who play no instrument, 64 like math and 76 do not. Leo checks the table: 60 + 140 = 200, and 100 students like math in all.
Maya asks a sharper question. “If I only look at the students who play an instrument, what fraction like math?” Now the 60 players are the whole group. So the answer is 36 out of 60, which is 0.6. In symbols, P(math | instrument) = 36 / 60 = 0.6. The bar means “given”.
Leo compares this with the whole survey. There, 100 out of 200 is 0.5, so P(math) = 0.5. Knowing that a student plays an instrument changes the chance from 0.5 to 0.6. So in this survey, liking math and playing an instrument are not independent.
“So playing music makes you like math?” Leo asks. Maya shakes her head. “The table only shows that the two go together here. It does not say which one causes the other, or whether something else causes both.” The rule they used is P(A | B) = P(A and B) / P(B), as long as P(B) is more than 0.
Conditioning on one row makes that row’s total the bottom of the fraction.
What the animation shows. A two-way table shows an imagined survey of 200 students with made-up numbers. The row for students who play an instrument lights up and the other rows fade. The 36 in that row moves up to the top of a fraction, and the row total 60 moves to the bottom. The screen reads 36 out of 60 is 0.6. Next, the whole survey counts again. The total of students who like math gives 100 out of 200 is 0.5. The two answers are different, so the events are not independent in this survey.
Hands-on: Doubles and big sums¶
About 20 minutes.
You need:
Two dice.
A paper cup to shake them in (optional).
Paper and a pencil.
A calculator (optional).
Steps:
Draw a two-way table. The rows are “double” and “not a double”. The columns are “sum above 7” and “sum 7 or less”. Add a total row and a total column.
Roll both dice. A double means both dice show the same number. Make a tally mark in the right cell.
Roll at least 36 times. Then fill in all the totals and check that they add up to your number of rolls.
Find P(double) from your counts: all doubles divided by all rolls.
Find P(double | sum above 7): doubles with a sum above 7, divided by the total of the “sum above 7” column.
Now find the exact answers. List all 36 equally likely pairs, from (1,1) to (6,6). Count the doubles and the pairs with a sum above 7.
Compare the exact P(double) with the exact P(double | sum above 7). Are the two events independent? Then compare your counts with the exact answers.
Practice together¶
Use the 36 equally likely pairs from two dice. What is P(double)? What is P(double | sum above 7)? Are the two events independent?
Check your answer
There are 6 doubles, so P(double) = 6/36 = 1/6. There are 15 pairs with a sum above 7. Only 3 of them are doubles: (4,4), (5,5) and (6,6). So P(double | sum above 7) = 3/15 = 1/5. Since 1/5 is not 1/6, the events are not independent.
Try it yourself¶
1. In another imagined class of 40 students (made-up numbers), 20 have a pet. Of the 16 who walk to school, 8 have a pet. Find P(pet) and P(pet | walks). Are the two events independent in this class?
Check your answer
P(pet) = 20/40 = 0.5. P(pet | walks) = 8/16 = 0.5. They are equal, so in this class having a pet and walking to school are independent.
2. Roll two dice. Event A is “a double”. Event B is “an odd sum”. Can A and B happen together? Are they independent?
Check your answer
A double always has an even sum, so A and B can never happen together. They are mutually exclusive. They are not independent: P(A) = 1/6, but P(A | B) = 0. Knowing B happened tells you A did not.
Talk about it¶
Why does the bottom number change when you add the word “given”?
Leo’s table shows musicians like math a bit more in the made-up survey. What else could explain that?
Mutually exclusive events can never happen together. Why does that make them depend on each other?
Check yourself¶
1. In the imagined survey, what is P(math | instrument)?
A. 36 out of 200
B. 36 out of 100
C. 36 out of 60
Show the answer
C. 36 out of 60
The condition is “plays an instrument”, so only the 60 players count. Of them, 36 like math, which is 36 out of 60.
2. For two events with P(B) more than 0, which statement shows they are independent?
A. A and B can never happen together.
B. P(A | B) = P(A)
C. P(A and B) = P(B)
Show the answer
B. P(A | B) = P(A)
Independent means knowing B does not change the chance of A, so P(A | B) = P(A). Events that never happen together are mutually exclusive, which is different.
3. Remember Lesson 2. A rule predicts a height of 11 cm, and the measured height is 12 cm. What is the residual? (Review of L2-02)
A. 23 cm
B. 11 cm
C. 1 cm
Show the answer
C. 1 cm
A residual is observed minus predicted. That is 12 cm minus 11 cm, which is 1 cm.
Words to know¶
- conditional probability
- The chance of one event when we already know a second event happened. We write P(A | B) and say “the probability of A given B”.
- independent
- Two events are independent when knowing that one happened does not change the chance of the other. In symbols, P(A | B) = P(A).
- mutually exclusive
- Two events are mutually exclusive when they can never happen together, like rolling a 2 and rolling a 5 on one roll of a die.
For grown-ups: about this lesson
Why it matters. The lesson builds conditional probability from a two-way table, where the row or column total is visibly the denominator. Two-way tables and conditional probability are presented this way in OpenStax Barbara Illowsky and Susan Dean, 2023, and independence is defined there as P(A | B) = P(A), separate from mutual exclusivity Barbara Illowsky and Susan Dean, 2023. The standards ask students to read two-way tables (8.SP.4) and to understand conditional probability as P(A and B) / P(B) and independence as P(A | B) = P(A) (S-CP.3) NGA Center and CCSSO, 2010. The survey is made up and is labeled so on every surface. The dice task gives an exact check: 3 of the 15 pairs with a sum above 7 are doubles, so 1/5, not 1/6.
Watch for these mix-ups.
P(A | B) and P(B | A) are the same. (They have different denominators; in the survey, 36 of 60 players like math, but 36 of 100 math-likers play.)
Mutually exclusive means independent. (If two possible events cannot happen together, knowing one rules out the other, so they are dependent.)
A difference in a table shows a cause. (It shows an association in this group only; a common cause or chance could explain it.)
Rolled counts that give slightly different fractions disprove the exact answer. (Thirty-six rolls vary a lot; pooled rolls get closer to 1/6 and 1/5.)
To make it easier. Give the completed survey table and ask only for P(math) and P(math | instrument). Skip the dice table and use the list of 36 pairs.
To make it harder. Find P(instrument | math) from the same table and explain why it differs from P(math | instrument). Then change one cell so the events become independent while all totals still add up.
Limits. The survey numbers are invented for teaching. A real survey of 200 students estimates a pattern with sampling error, so two fractions that differ a little could still come from independent events in the wider population.
On the computer. Grown-ups can see where this idea leads later in Lab: Bayes’ rule, written for older learners.
Sources for this guide. Barbara Illowsky and Susan Dean, 2023Barbara Illowsky and Susan Dean, 2023NGA Center and CCSSO, 2010
Next: L2-05 · Reverse a condition with Bayes’ rule
- Barbara Illowsky and Susan Dean. (2023). 3.4 Contingency Tables. OpenStax, Introductory Statistics 2e. https://openstax.org/books/introductory-statistics-2e/pages/3-4-contingency-tables
- Barbara Illowsky and Susan Dean. (2023). 3.2 Independent and Mutually Exclusive Events. OpenStax, Introductory Statistics 2e. https://openstax.org/books/introductory-statistics-2e/pages/3-2-independent-and-mutually-exclusive-events
- NGA Center and CCSSO. (2010). Common Core State Standards for Mathematics. Common Core State Standards Initiative. https://learning.ccsso.org/wp-content/uploads/2022/11/Math_Standards1.pdf