The double-counting problem
Suppose you want the chance that a card drawn from a standard deck is a heart or a king. There are 13 hearts and 4 kings. Adding gives 17, but the king of hearts has been counted twice, once as a heart and once as a king. The true number of cards that are a heart or a king is 13 + 4 − 1 = 16, so the probability is 16/52, which simplifies to 4/13.
That correction is the heart of the inclusion-exclusion principle: add the sizes of the groups, then subtract what was counted twice.
The two-event rule
For any two events A and B:
P(A or B) = P(A) + P(B) − P(A and B)
“Or” here is inclusive, meaning A, B or both. The subtracted term is the overlap.
When the events cannot happen together, the overlap is zero and the rule collapses to simple addition. That special case is the one covered under mutually exclusive events and the addition rule. Inclusion-exclusion is the general version.
Another two-event example
Roll two fair dice. What is the chance that at least one shows a six?
- Chance the first die is a six: 6/36 (counting outcomes among the 36 pairs)
- Chance the second die is a six: 6/36
- Chance both are sixes: 1/36
So the answer is 6/36 + 6/36 − 1/36 = 11/36, about 30.6%.
You can check this by listing: the pair (6,6) plus five pairs with a six first and another number second, plus five with a six second, which is 1 + 5 + 5 = 11. The complement approach agrees: 1 − 25/36 = 11/36.
Three events
With three events, the pattern extends: add the singles, subtract the pairs, add back the triple.
|A ∪ B ∪ C| = |A| + |B| + |C| − |A ∩ B| − |A ∩ C| − |B ∩ C| + |A ∩ B ∩ C|
Why add the triple back? In the first step, an element in all three groups is counted 3 times. Subtracting the three pairs removes it 3 times, leaving 0. So it has to be added back once to be counted exactly once.
A worked example with numbers
Pick a whole number from 1 to 30 at random, all equally likely. What is the chance it is divisible by 2, 3 or 5?
- Divisible by 2: 15 numbers
- Divisible by 3: 10 numbers
- Divisible by 5: 6 numbers
- Divisible by both 2 and 3 (that is, by 6): 5 numbers
- Divisible by both 2 and 5 (by 10): 3 numbers
- Divisible by both 3 and 5 (by 15): 2 numbers
- Divisible by 2, 3 and 5 (by 30): 1 number
Total: 15 + 10 + 6 − 5 − 3 − 2 + 1 = 31 − 10 + 1 = 22 numbers.
So the probability is 22/30 = 11/15, about 73.3%. As a cross-check, the numbers not divisible by any of the three are 1, 7, 11, 13, 17, 19, 23 and 29. That is 8 numbers, and 30 − 8 = 22.
Checking with the complement
The check above used the complement counting shortcut, and the two methods often work well together. If you are unsure of an inclusion-exclusion answer, count the “none of them” case and see whether the two add up to the whole.
When events are independent
If A and B are independent, the overlap is just P(A) × P(B). For example, if one coin comes up heads with chance 1/2 and a die lands on six with chance 1/6, the chance of heads or a six is 1/2 + 1/6 − (1/2 × 1/6) = 1/2 + 1/6 − 1/12. Using twelfths: 6/12 + 2/12 − 1/12 = 7/12.
If instead the events are dependent, the overlap has to be found from the actual setup, often with a probability that is conditioned on the first event, as in conditional probability.
Common slips
- Forgetting the overlap. Adding 6/36 and 6/36 and stopping at 12/36 overstates the answer.
- Subtracting too much. With three events, remember to add the triple overlap back.
- Assuming exclusivity. Do not treat events as non-overlapping unless they truly cannot occur together.
- Mixing counts and probabilities. Use either counts throughout or probabilities throughout.
Why it matters in games
Many game questions are of the form “what is the chance that at least one of these things happens?” Examples include hitting any one of several useful cards, or at least one of several dice showing a target number. Whenever the ways of succeeding can overlap, a simple sum overstates the chance, and the correction keeps the answer between 0 and 1. For more than a few events the bookkeeping grows, and it is often easier to switch to a complement or a computer-based simulation.
As elsewhere in this cluster, the examples are illustrations of counting, not advice for gambling. Games with a house edge lose money over time, and past results do not change future chances.