Conditional Probability and Independence
What You’ll Learn
Section titled “What You’ll Learn”In this lesson you’ll learn what conditional probability means, how to compute it, how to use tree diagrams and two-way tables, how to test whether two events are independent, and why and are not the same thing.
The Concept
Section titled “The Concept”Probability with information
Section titled “Probability with information”Conditional probability is the probability of an event given that you already know something else happened.
Read the bar as “given.” is “the probability of given .”
The intuition: knowing happened shrinks your world. Instead of the whole sample space, you’re now working inside only. So you ask what fraction of also contains . That’s exactly what the formula computes: the overlap divided by the new, smaller universe.
A quick example. Roll a die. . But given that the roll is even, the world shrinks to and
The information doubled the probability.
Note that conditioning can move a probability in either direction. Given that the roll is odd, .
Rearranging into the multiplication rule
Section titled “Rearranging into the multiplication rule”Multiply both sides by :
This is the general multiplication rule from the last lesson. The two formulas are the same statement rearranged.
Testing for independence
Section titled “Testing for independence”Events and are independent if knowing one changes nothing:
Equivalently, and often easier to check:
If that equation holds, they’re independent. If it fails, they’re dependent. This is a test you can actually run on data, not just a description.
The direction of conditioning matters
Section titled “The direction of conditioning matters”This is the most important idea in the lesson, and the one that causes real-world harm.
These are different questions with different answers. Confusing them is called the prosecutor’s fallacy or, more generally, confusion of the inverse.
An example that makes the gap obvious:
- is fairly low. Plenty of four-legged things aren’t dogs.
- is nearly 1.
Same two properties, wildly different probabilities depending on which you condition on.
The consequential version:
- is usually high. That’s the test being good.
- can be surprisingly low for a rare disease.
Getting these mixed up is why a positive screening result is far less alarming than most people assume. The next lesson, on Bayes’ theorem, is entirely about converting one direction into the other.
Tree diagrams
Section titled “Tree diagrams”For sequential events, a tree diagram organizes everything.
The rules for reading a tree:
- Probabilities on branches leaving any single node sum to 1.
- Multiply along a path to get the probability of that full sequence.
- Add across paths to get the probability of an event that several paths satisfy.
- Second-level branches show conditional probabilities, given the first-level outcome.
Trees are the most reliable way to avoid errors in multi-step problems, because they force you to write down every case.
Two-way tables
Section titled “Two-way tables”When you have counts in two categories, a contingency table makes conditional probabilities easy to read.
| Passed | Failed | Total | |
|---|---|---|---|
| Studied | 42 | 8 | 50 |
| Did not study | 12 | 18 | 30 |
| Total | 54 | 26 | 80 |
Everything comes from reading the right row, column, or cell:
- (use the grand total)
- (restrict to the “studied” row)
- (restrict to the “passed” column)
Notice those last two are both about studying and passing, and they differ (0.84 versus 0.778) because the conditioning direction differs. The denominator is what changes. That’s the whole trick: conditioning tells you which total to divide by.
Are studying and passing independent here? Check:
Not equal, so they’re dependent. Studying is associated with passing, which is reassuring.
Worked Examples
Section titled “Worked Examples”Example 1: Straight from the formula.
, , . Find and determine independence.
Solution.
Since , the events are independent.
Confirm the other way: ✓
Example 2: Cards without replacement.
Two cards are drawn without replacement. Given the first is a heart, find the probability the second is also a heart.
Solution. After removing one heart, 51 cards remain with 12 hearts.
Lower than the unconditional , because a heart is now missing from the deck.
Example 3: Tree diagram.
Factory A makes 60% of a company’s widgets with a 2% defect rate. Factory B makes 40% with a 5% defect rate. A widget is chosen at random. Find the probability it’s defective.
Solution. Four paths through the tree:
Check: ✓
Defective can come from either factory, so add those paths:
Example 4: Reversing the condition.
Using Example 3, a widget is found defective. What’s the probability it came from Factory B?
Solution. Now condition on defectiveness, so the denominator is .
So 62.5% of defective widgets come from Factory B, even though B makes only 40% of all widgets. Its higher defect rate makes it overrepresented among failures.
Compare the two directions: but . Same two events, and the probabilities differ by more than tenfold. This calculation is Bayes’ theorem, which the next lesson formalizes.
Example 5: Two-way table.
Of 200 people, 90 own a car, 70 own a bike, and 40 own both. Find and test independence.
Solution.
For independence, compare to .
Since , they’re dependent. Car owners are somewhat more likely to own bikes than the general group.
Equivalently: , but . Not equal, so dependent.
Example 6: The prosecutor’s fallacy.
A forensic match occurs in 1 in 10,000 innocent people. A defendant matches. A prosecutor argues there’s a 1 in 10,000 chance the defendant is innocent. What’s wrong?
Solution. The prosecutor swapped the conditioning.
The evidence gives .
The claim made is about , which is a different quantity entirely.
Suppose the match came from searching a database of 500,000 people. Among innocent people you’d expect roughly matches by chance. If one guilty person also matches, then given a match, the probability of innocence is about , not 0.01%.
The prior probability of guilt, and how the suspect was found, both matter enormously. This error has contributed to real wrongful convictions.
Real-World Applications
Section titled “Real-World Applications”Medical diagnosis is the highest-stakes application. Clinicians must convert test sensitivity, , into the thing the patient wants to know, . Studies have repeatedly shown that many physicians get this conversion wrong, systematically overestimating disease probability after a positive screening test.
Spam filters compute from the more easily measured . The classic Naive Bayes filter is exactly this lesson plus an independence assumption.
Legal reasoning suffers from the prosecutor’s fallacy, and courts in several countries have overturned convictions specifically over misused conditional probability. The Sally Clark case in the UK is the best-known example.
Machine learning classifiers output conditional probabilities, and calibration (making sure a stated 70% confidence really corresponds to being right 70% of the time) is an active engineering concern.
Insurance underwriting conditions on everything it can legally observe: age, location, history. Each variable that changes the conditional probability of a claim changes the premium.
In A/B testing, conditioning matters for interpretation. The conversion rate among users who saw a feature is a conditional probability, and it differs from the rate among all users assigned to that group.
Retrying will remove your ✅ checkmark until you pass again.