Independence of Events
Master independence of events, distinguish pairwise from mutual independence, and test independence in practice.
Introduction
Independence is one of the most important concepts in probability. When events are independent, knowing one occurred tells us nothing about the other. This simplifies calculations and underlies many probability models.
Learning Objectives:
- Master the definition of independence
- Distinguish pairwise from mutual independence
- Identify and test independence in practice
- Understand conditional independence
Independence Definition
Events and are independent if:
Equivalent formulations (when ):
- (knowing doesn't change probability of )
- (knowing doesn't change probability of )
Intuition: Learning that occurred provides no information about .
Example 1: Coin Flips
Two fair coin flips are independent:
Knowing the first flip is heads doesn't change the probability of the second being heads.
import random
def test_independence_coin_flips(n_trials=10000):
"""Test independence of two coin flips"""
count_both_heads = 0
count_first_heads = 0
count_second_heads = 0
for _ in range(n_trials):
flip1 = random.choice(['H', 'T'])
flip2 = random.choice(['H', 'T'])
if flip1 == 'H':
count_first_heads += 1
if flip2 == 'H':
count_second_heads += 1
if flip1 == 'H' and flip2 == 'H':
count_both_heads += 1
p_first = count_first_heads / n_trials
p_second = count_second_heads / n_trials
p_both = count_both_heads / n_trials
p_product = p_first * p_second
print(f"P(Hβ) = {p_first:.4f}")
print(f"P(Hβ) = {p_second:.4f}")
print(f"P(Hβ β© Hβ) simulated = {p_both:.4f}")
print(f"P(Hβ) Γ P(Hβ) = {p_product:.4f}")
print(f"\nIndependent: {abs(p_both - p_product) < 0.01}")
test_independence_coin_flips()Testing Independence
Example 2: Dependent Events
Drawing cards without replacement creates dependence:
First draw: P(Ace) = 4/52 Second draw given first was Ace: P(Ace) = 3/51 β 4/52
The events are dependent because the first draw changes the composition of the deck.
def test_cards_dependence(n_trials=10000):
"""Show cards without replacement are dependent"""
import random
count_both_aces = 0
count_first_ace = 0
for _ in range(n_trials):
deck = ['A']*4 + ['X']*48 # 4 aces, 48 others
random.shuffle(deck)
first = deck[0]
second = deck[1]
if first == 'A':
count_first_ace += 1
if second == 'A':
count_both_aces += 1
p_first_ace = count_first_ace / n_trials
p_both_aces = count_both_aces / n_trials
p_second_given_first = p_both_aces / p_first_ace if p_first_ace > 0 else 0
print(f"P(first is ace) = {p_first_ace:.4f} (theoretical: {4/52:.4f})")
print(f"P(second is ace | first is ace) = {p_second_given_first:.4f}")
print(f"Theoretical P(2nd ace | 1st ace) = {3/51:.4f}")
print(f"\nIf independent, would be {4/52:.4f}")
print(f"But it's {p_second_given_first:.4f}, so DEPENDENT!")
test_cards_dependence()Pairwise vs Mutual Independence
Pairwise Independence
Events are pairwise independent if:
Mutual Independence
Events are mutually independent if for every subset :
Key: Mutual independence is stronger than pairwise independence!
Common Mistake: Pairwise independent does NOT imply mutually independent!
Counterexample: Two fair coin flips, let:
- = "first is H"
- = "second is H"
- = "exactly one H"
These are pairwise independent but NOT mutually independent:
Independence and Complements
Theorem: If and are independent, then:
- and are independent
- and are independent
- and are independent
Proof (for and ):
Key Takeaways
- Independence: or equivalently
- Test: Check if knowing one event changes probability of the other
- Pairwise β Mutual: Pairwise independence is weaker
- Complements: Independence extends to complements
- Dependence: Most real-world events are dependent!
Next Lesson: Advanced conditional probability problems including Monty Hall!
Concept | Definition | Example |
|---|---|---|
| Independence | $P(A \cap B) = P(A)P(B)$ | Coin flips |
| Dependence | $P(A \cap B) \neq P(A)P(B)$ | Cards without replacement |
| Pairwise | Each pair independent | $P(A_i \cap A_j) = P(A_i)P(A_j)$ |
| Mutual | All subsets independent | Stronger than pairwise |