Conditional Probability
Understand P(A|B), independent vs dependent events, and Bayes' theorem.
What is Conditional Probability?
Conditional probability: Probability of event A given that event B has occurred
Notation: P(A|B) (read "probability of A given B")
Meaning: Adjust probability based on new information
Formula:
P(A|B) = P(A and B) / P(B) where P(B) > 0
Understanding P(A|B)
P(A|B) ≠ P(A) (usually)
B happening changes the sample space
Focus only on outcomes where B occurred
Example 1: Card Draw
Draw card from standard deck
A: Card is ace B: Card is spade
Find P(A|B):
P(A) = 4/52 (without condition)
But given B (card is spade):
- Sample space reduced to 13 spades
- Only 1 ace of spades
P(A|B) = 1/13
Example 2: Two Dice
Roll two dice
A: Sum is 8 B: First die shows 3
Find P(A|B):
Given first die is 3, need second die to be 5 for sum of 8
P(A|B) = 1/6 (second die must be 5)
Using the Formula
P(A|B) = P(A and B) / P(B)
Example: Family with Two Children
Family has 2 children, at least one is a girl (B)
What's probability both are girls (A)?
Sample space: (GG, GB, BG, BB)
Event B (at least one girl): (GG, GB, BG)
P(B) = 3/4
Event (A and B) (both girls): (GG)
P(A and B) = 1/4
Calculate:
P(A|B) = (1/4) / (3/4) = 1/3
Answer: 1/3
(Not 1/2 as might be expected!)
Multiplication Rule
Rearrange conditional probability formula:
P(A and B) = P(B) · P(A|B)
Or: P(A and B) = P(A) · P(B|A)
Use: Find probability of both events
Example: Drawing Without Replacement
Bag: 3 red, 2 blue marbles
Draw 2 without replacement
P(both red)?
First draw: P(red) = 3/5
Second draw given first red: P(red|first red) = 2/4
P(both red):
= P(first red) · P(second red | first red)
= (3/5) · (2/4)
= 6/20
= 3/10
Answer: 3/10
Independent Events
Independent: P(A|B) = P(A)
B doesn't affect probability of A
Test for independence:
A and B independent if and only if:
P(A and B) = P(A) · P(B)
Example 1: Coin Flips
Flip coin twice
A: First flip heads B: Second flip heads
P(A) = 1/2
P(B) = 1/2
P(A and B) = 1/4
Check: (1/2)(1/2) = 1/4 ✓
Independent
Example 2: Cards With Replacement
Draw card, replace, draw again
A: First is ace B: Second is ace
P(A) = 4/52
P(B) = 4/52 (replaced, so same)
P(A and B) = (4/52)² = 16/2704
Check: (4/52)(4/52) = 16/2704 ✓
Independent
Example 3: NOT Independent
Draw 2 cards without replacement
A: First is ace B: Second is ace
P(A) = 4/52
P(B|A) = 3/51 (only 3 aces left)
P(A and B) = (4/52)(3/51)
Check independence: (4/52)(4/52) ≠ (4/52)(3/51)
NOT independent (dependent)
Tree Diagrams for Conditional Probability
Visual tool showing all paths and probabilities
Example: Medical Test
Disease: 1% of population Test: 95% accurate if disease, 90% accurate if no disease
P(D) = 0.01 (disease)
P(no D) = 0.99
Tree:
P(+|D)=0.95 ─ D and + : 0.01(0.95) = 0.0095
D=0.01
P(-|D)=0.05 ─ D and - : 0.01(0.05) = 0.0005
P(+|no D)=0.10 ─ no D and + : 0.99(0.10) = 0.099
no D=0.99
P(-|no D)=0.90 ─ no D and - : 0.99(0.90) = 0.891
P(positive test) = 0.0095 + 0.099 = 0.1085
Bayes' Theorem
Reverse conditional probability
Formula:
P(A|B) = [P(B|A) · P(A)] / P(B)
Use: Find P(A|B) when you know P(B|A)
Example: Disease Test (continued)
Person tests positive. Probability they have disease?
Want: P(D|+)
Know:
- P(+|D) = 0.95
- P(D) = 0.01
- P(+) = 0.1085
Bayes' Theorem:
P(D|+) = [P(+|D) · P(D)] / P(+)
= (0.95 · 0.01) / 0.1085
= 0.0095 / 0.1085
≈ 0.0876
≈ 8.8%
Only 8.8% chance of having disease despite positive test!
(Because disease is rare)
False Positives and False Negatives
False positive: Test positive, but no disease
False negative: Test negative, but have disease
From example:
- P(false positive) = P(+|no D) = 0.10
- P(false negative) = P(-|D) = 0.05
Law of Total Probability
If events B₁, B₂, ..., Bₙ partition sample space:
P(A) = P(A|B₁)P(B₁) + P(A|B₂)P(B₂) + ... + P(A|Bₙ)P(Bₙ)
Use: Find P(A) by considering all cases
Example: Jar Selection
Jar 1: 2 red, 3 blue Jar 2: 4 red, 1 blue
Pick jar randomly, then pick marble
P(red)?
P(Jar 1) = 1/2, P(Jar 2) = 1/2
P(red|Jar 1) = 2/5
P(red|Jar 2) = 4/5
Total:
P(red) = P(red|Jar1)·P(Jar1) + P(red|Jar2)·P(Jar2)
= (2/5)(1/2) + (4/5)(1/2)
= 1/5 + 2/5
= 3/5
Answer: 3/5
Real-World Applications
Medical testing: Interpreting test results
Quality control: Defect detection
Machine learning: Spam filters, classification
Insurance: Risk assessment
Criminal justice: DNA evidence interpretation
Example: Spam Filter
P(spam) = 0.3 (30% of emails are spam)
P(word "free" | spam) = 0.8
P(word "free" | not spam) = 0.1
Email contains "free". Probability it's spam?
First, find P("free"):
P("free") = 0.8(0.3) + 0.1(0.7)
= 0.24 + 0.07
= 0.31
Bayes' theorem:
P(spam | "free") = [P("free"|spam) · P(spam)] / P("free")
= (0.8 · 0.3) / 0.31
= 0.24 / 0.31
≈ 0.774
≈ 77.4%
77.4% chance it's spam
Common Mistakes
Don't confuse P(A|B) with P(B|A)
Example: P(rain|clouds) ≠ P(clouds|rain)
Don't assume independence without checking
Remember to reduce sample space for conditional probability
Practice
P(A|B) means:
If A and B are independent, then P(A|B) = ?
Draw 2 cards without replacement. P(both aces) = ?
Disease affects 2% of population. Test is 90% accurate. If you test positive, what's true?