Conditional Probability and Independence
Update probabilities when you learn new information with P(A|B) = P(A∩B)/P(B), use the multiplication rule and trees, and test events for independence.
Welcome back!
Step 1 of 12Learn
When information changes the odds
You draw one card from a shuffled deck. The probability it's a king is 4/52 = 1/13. Now a friend peeks and tells you, "It's a face card." With that information, the deck has effectively shrunk to the 12 face cards, 4 of which are kings, so the probability is now 4/12 = 1/3.
That is conditional probability: the probability of A given that B has occurred, written P(A | B). Knowing B restricts the sample space to B, and you ask what fraction of B also lies in A:
P(A | B) = P(A ∩ B) / P(B), provided P(B) > 0.
For the cards: P(king ∩ face) = 4/52 and P(face) = 12/52, so P(king | face) = (4/52)/(12/52) = 1/3.
Conditional probabilities are everywhere once you look. The chance of rain given dark clouds. The chance a customer buys given they added an item to the cart. The chance a patient has a disease given a positive test.
The order of the condition matters enormously. P(face | king) = 1, since every king is a face card, but P(king | face) = 1/3. Swapping them, sometimes called confusing the inverse, is one of the most consequential mistakes in probability. It causes real errors in medicine and in court, as you will see in the Bayes lesson.
Step 2 of 12Learn
Two-way tables
Real data often arrive as a table of counts. Here is a survey of 200 students:
| Drinks coffee | No coffee | Total | |
|---|---|---|---|
| Sleeps < 7 h | 60 | 20 | 80 |
| Sleeps ≥ 7 h | 40 | 80 | 120 |
| Total | 100 | 100 | 200 |
Overall, P(short sleep) = 80/200 = 0.40. But among coffee drinkers, P(short sleep | coffee) = 60/100 = 0.60, while among non-drinkers it is 20/100 = 0.20. The condition changes the answer a lot.
Notice how to read a conditional from a table: restrict to the row or column of the condition, then take a fraction within it. P(coffee | short sleep) uses the short-sleep row: 60/80 = 0.75. That's a different number from P(short sleep | coffee) = 0.60, because the denominators differ.
The table also shows the multiplication rule, which is just the definition rearranged:
P(A ∩ B) = P(B) · P(A | B) = P(A) · P(B | A)
P(coffee ∩ short sleep) = P(coffee) · P(short | coffee) = 0.5 × 0.6 = 0.30, matching 60/200.
One caution: a table like this shows association, not cause. Short sleepers might drink coffee because they're tired, or a third factor such as exam season might drive both.
Step 3 of 12Practice · Work it out
Using the survey table (200 students: 60 coffee and short sleep, 40 coffee and long sleep, 20 no coffee and short sleep, 80 no coffee and long sleep), what is P(no coffee | sleeps ≥ 7 h)? Give a decimal to two places.
Step 4 of 12Practice · Chart
The 200 students by sleep and coffee
Each bar is one row of the two-way table. Conditioning on a row means looking inside one bar only.
Tap the group where coffee drinkers are the larger share.
Tap the bar that answers the question, then press Check.
| Item | Drinks coffee | No coffee |
|---|---|---|
| Sleeps < 7 h | 60 | 20 |
| Sleeps ≥ 7 h | 40 | 80 |
Step 5 of 12Learn
Trees and drawing without replacement
For experiments that happen in stages, a tree diagram keeps conditional probabilities organized. Each branch is labeled with the probability of that step given everything before it. To get the probability of a path, multiply along it. To get the probability of an event, add the paths that lead to it.
Example. A bag holds 5 red and 3 blue marbles. Draw two without replacement.
- First red: 5/8. Then second red given first red: 4/7. Path probability 5/8 × 4/7 = 20/56.
- First red then blue: 5/8 × 3/7 = 15/56.
- First blue then red: 3/8 × 5/7 = 15/56.
- Both blue: 3/8 × 2/7 = 6/56.
The four paths add to 56/56 = 1, a good check. P(one of each color) = 15/56 + 15/56 = 30/56 ≈ 0.536.
Without replacement, the second draw depends on the first: the bag has changed. With replacement, the probabilities would be 5/8 and 3/8 at every draw.
Two aces. Drawing two cards from a deck: P(both aces) = 4/52 × 3/51 = 12/2652 = 1/221, about 0.45%. A common error is to square 4/52, which assumes replacement and gives 1/169.
Step 6 of 12Practice · Work it out
A box has 4 working and 2 faulty batteries. You pick two at random without replacement. What is the probability that both are working? Give a decimal to three places.
Step 7 of 12Learn
Independence
Events A and B are independent if knowing one occurred does not change the probability of the other: P(A | B) = P(A). Plugging into the multiplication rule gives the standard test:
A and B are independent if and only if P(A ∩ B) = P(A) · P(B).
Separate coin flips, separate dice and draws with replacement are independent by design. In data, independence is a claim you check. In the survey, P(short sleep) = 0.40 but P(short sleep | coffee) = 0.60, so sleep and coffee are not independent.
Independence can also hold in surprising places. Roll one die. Let A = "even" = {2, 4, 6} and B = "1 or 2" = {1, 2}. P(A ∩ B) = P({2}) = 1/6, and P(A)·P(B) = 1/2 × 1/3 = 1/6. They are independent, even though they share an outcome.
For independent events, "and" becomes multiplication: the chance of 10 heads in a row is (1/2)10 = 1/1024.
The gambler's fallacy. At a Monte Carlo casino in 1913, black came up 26 times in a row on a roulette wheel, and gamblers lost fortunes betting on red because it was "due." Spins are independent. After 26 blacks, the chance of black on the next spin is exactly what it always was. A long streak is rare before it starts, but once it has happened, it carries no information about the next spin.
Step 8 of 12Practice · True or false
If A and B are independent, then A and the complement of B are also independent.
Step 9 of 12Note
Step 10 of 12Compare
Mutually exclusive vs independent
| Aspect | Mutually exclusive | Independent |
|---|---|---|
| Meaning | A and B cannot both happen | Knowing A tells you nothing about B |
| Test | P(A ∩ B) = 0 | P(A ∩ B) = P(A)·P(B) |
| If A happens… | P(B | A) drops to 0 | P(B | A) stays P(B) |
| Example | Rolling a 2 and rolling a 5 on one die | A coin flip and a die roll |
| Can be both? | Only if one event has probability 0 | Only if one event has probability 0 |
Step 11 of 12Practice · What would you do?
What would you do?
A roulette wheel (18 red, 18 black, 2 green pockets) has just landed on red seven times in a row. Jordan says, "Black is overdue; the odds must be better than usual." Taylor says, "Red is hot; the wheel might be biased toward red." Assuming the wheel is fair and spins are independent, who is right about the next spin?
Step 12 of 12Practice · Choose one
For two events, P(A) = 0.3, P(B) = 0.5 and P(A ∩ B) = 0.15. Which statement is correct?
Lesson complete!