Conditional Probability
Explore P(A | B) with an interactive Venn diagram and a probability tree
Venn diagram(circle and overlap areas are proportional to the probabilities)
Only the 50 people in B count now. Of them, 30 are also in A, so P(A | B) = 0.30 / 0.50 = 0.600.
Probability tree(leaf: joint probability, with the count out of 100)
Conditional probabilities
- P(A | B) = P(A∩B) / P(B)
- 0.600
- P(B | A) = P(A∩B) / P(A)
- 0.750
- P(A | B′)
- 0.200
- P(A ∪ B) = P(A) + P(B) − P(A∩B)
- 0.60
Independence check
- P(A) × P(B)
- 0.2000
- P(A ∩ B)
- 0.3000
Not independent: B makes A more likely.
Contingency table
| Out of 100 | B | B′ | Total |
|---|---|---|---|
| A | 30 | 10 | 40 |
| A′ (not A) | 20 | 40 | 60 |
| Total | 50 | 50 | 100 |
What conditioning means
The conditional probability P(A | B), read "the probability of A given B", is the chance that A happens once you know that B has happened. Knowing B rules out every outcome outside B, so B becomes the new universe. Within it, the outcomes where A also happens are exactly A ∩ B, so P(A | B) = P(A ∩ B) / P(B).
The order matters. P(A | B) and P(B | A) share a numerator, P(A ∩ B), but divide it by different things. If 30% of people are in both A and B, 50% are in B and 40% are in A, then P(A | B) = 0.30 / 0.50 = 0.6 while P(B | A) = 0.30 / 0.40 = 0.75. Mixing the two up is one of the most common errors in reasoning about chance.
Two events are independent when learning one tells you nothing about the other: P(A | B) = P(A). Independence is not the same as being disjoint. Disjoint events with positive probabilities are strongly dependent, because if one happens the other cannot.
Shrink the universe
Multiplication rule
Independence
Counts make it concrete
Key formulas
Definition
P(A | B) = P(A ∩ B) / P(B)
- A ∩ B
- both A and B happen
- P(B)
- probability of the condition, must be greater than 0
Multiplication rule and total probability
P(A ∩ B) = P(A) P(B | A), P(B) = P(A) P(B | A) + P(A′) P(B | A′)
- A′
- the complement of A, “not A”
Valid overlap
max(0, P(A) + P(B) − 1) ≤ P(A ∩ B) ≤ min(P(A), P(B))
Rules at a glance
| Rule | Formula | Note |
|---|---|---|
| Conditional probability | P(A | B) = P(A ∩ B) / P(B) | Needs P(B) > 0 |
| Multiplication rule | P(A ∩ B) = P(A) P(B | A) | Multiply along tree branches |
| Addition rule | P(A ∪ B) = P(A) + P(B) − P(A ∩ B) | Subtract the overlap counted twice |
| Complement | P(A′ | B) = 1 − P(A | B) | Conditioning keeps total probability 1 |
| Total probability | P(B) = P(B | A) P(A) + P(B | A′) P(A′) | Add the leaves of the tree that end in B |
| Independence | P(A ∩ B) = P(A) P(B) | Equivalent to P(A | B) = P(A) |
How to use this visualizer
- 1Set P(A) and P(B) with the sliders. The P(A ∩ B) slider only allows values that can actually happen: the overlap cannot exceed the smaller event, and it must be at least P(A) + P(B) − 1.
- 2Click circle B (or press Given B). Everything outside B fades out and the read-out below the diagram explains P(A | B) as a fraction of B. Click A to condition on A instead, or outside both circles to undo.
- 3Follow the same numbers through the probability tree: multiply P(A) by P(B | A) along the branches to reach P(A ∩ B) at the leaf.
- 4Read the contingency table as counts out of 100 or 1,000 people. The highlighted column or row is the population you are conditioning on.
- 5Use the independence panel to compare P(A ∩ B) with P(A) × P(B), and try the presets to see disjoint, nested and independent events.
Common mistake: confusing P(A | B) with P(B | A)
Most professional basketball players are tall, so P(tall | plays in the NBA) is close to 1. That does not make P(plays in the NBA | tall) large: there are millions of tall people and only a few hundred NBA players. Swapping the condition and the event is called the confusion of the inverse, and Bayes' theorem is the tool that converts one into the other correctly.Practice problems
Problem 1: Students and subjects
Show solutionHide solution
P(M) = 120/200 = 0.6, P(Ph) = 80/200 = 0.4, P(M ∩ Ph) = 50/200 = 0.25
P(Ph | M) = 50 / 120 ≈ 0.417
P(M | Ph) = 50 / 80 = 0.625
P(M ∪ Ph) = 0.6 + 0.4 − 0.25 = 0.75, so P(neither) = 1 − 0.75 = 0.25 (50 students)
P(M) × P(Ph) = 0.6 × 0.4 = 0.24, which is not equal to 0.25, so they are not independent (slightly positively associated).
P(Ph | M) ≈ 0.417, P(M | Ph) = 0.625, P(neither) = 0.25; not independent
Problem 2: Two aces
Show solutionHide solution
P(both aces) = P(1st ace) × P(2nd ace | 1st ace) = 4/52 × 3/51 = 12/2652 = 1/221 ≈ 0.00452
P(2nd ace) = 4/52 × 3/51 + 48/52 × 4/51 = (12 + 192)/2652 = 204/2652 = 1/13 ≈ 0.0769
P(1st ace | 2nd ace) = (1/221) / (1/13) = 13/221 = 1/17 ≈ 0.0588
The second card on its own is just as likely to be an ace as the first; only knowing the first card changes it.
1/221 ≈ 0.0045; 1/13 ≈ 0.077; 1/17 ≈ 0.059
Related topics
Discussion
Questions, ideas or a different approach? Join the conversation.