The Problem with Unions
When computing P(E∪F), we cannot simply add P(E)+P(F) because outcomes in E∩F get counted twice.
Two-Event Inclusion-Exclusion
P(E∪F)=P(E)+P(F)−P(E∩F)
Intuition: Add probabilities of each event, then subtract the intersection to correct for double-counting.
Example: Cards
Draw a card. Let E = “heart” and F = “ace”.
P(E∪F)=5213+524−521=5216=134
Verify directly: 13 hearts + 3 other aces = 16 cards out of 52.
Three-Event Inclusion-Exclusion
P(E∪F∪G)=P(E)+P(F)+P(G)−P(E∩F)−P(E∩G)−P(F∩G)+P(E∩F∩G)
Pattern: Add singletons, subtract pairs, add triples. The signs alternate.

Why Add the Triple?
Each element in E∩F∩G:
- Counted 3 times in singletons (+3)
- Counted 3 times in pairs (−3)
- Not yet counted in triples (+0)
We need +1 total, so add P(E∩F∩G).
For n events E1,E2,…,En:
P(⋃i=1nEi)=∑k=1n(−1)k+1∑1≤i1<i2<⋯<ik≤nP(Ei1∩Ei2∩⋯∩Eik)
In words: sum probabilities of k-fold intersections with sign (−1)k+1.
Example: Hat Check Problem
n people throw their hats into a pile. Each picks a hat randomly. What is the probability at least one person gets their own hat?
Let Ei = person i gets their own hat.
P(⋃i=1nEi)=∑k=1n(−1)k+1(kn)n!(n−k)!
- P(Ei)=n1 for each of (1n) choices
- P(Ei∩Ej)=n!(n−2)! for (2n) pairs
- Generally: P(k specific people get their hats) =n!(n−k)!
This gives:
P(at least one match)=∑k=1n(−1)k+1k!1
As n→∞, this approaches 1−e−1≈0.632.
The Complement View
For complex unions, computing P(none) via complement is often easier.
P(⋃i=1nEi)=1−P(⋂i=1nEic)
When events are independent: P(all fail)=∏P(Eic), giving:
P(at least one)=1−∏i=1n(1−P(Ei))
Example: Reliability
A system has 3 components, each failing independently with probability 0.1. What is the probability the system fails (at least one component fails)?
P(system fails)=1−P(all work)=1−0.93=1−0.729=0.271
Inclusion-Exclusion for Counting
The principle applies to counting, not just probability:
∣⋃i=1nAi∣=∑k=1n(−1)k+1∑1≤i1<⋯<ik≤n∣Ai1∩⋯∩Aik∣
Example: Integer Properties
How many integers from 1 to 1000 are divisible by 2 or 3?
Let A = multiples of 2, B = multiples of 3.
- ∣A∣=⌊1000/2⌋=500
- ∣B∣=⌊1000/3⌋=333
- ∣A∩B∣ = multiples of 6: ⌊1000/6⌋=166
∣A∪B∣=500+333−166=667
Bonferroni Inequalities
The partial sums in inclusion-exclusion alternate between over- and under-estimates:
P(E1∪⋯∪En)≤∑iP(Ei)
P(E1∪⋯∪En)≥∑iP(Ei)−∑i<jP(Ei∩Ej)
These provide upper and lower bounds when exact computation is impractical.
Summary
| Events | Formula |
|---|
| 2 events | P(E)+P(F)−P(E∩F) |
| 3 events | P(E)+P(F)+P(G)−P(E∩F)−P(E∩G)−P(F∩G)+P(E∩F∩G) |
| n events | ∑k=1n(−1)k+1∑i1<⋯<ikP(Ei1∩⋯∩Eik) |
| Complement | 1−P(⋂Eic) |