|A| = 30, |B| = 25, |A∩B| = 10
30 + 25 − 10
45.
For two finite sets, : add the sizes, then subtract the overlap, which was counted twice.
This page is easier if you are comfortable with:
If 30 students play football, 25 play tennis and 10 play both, then play at least one of the two; in a class of 50, play neither. Among the numbers 1 to 100, 25 are divisible by 4, 16 by 6, and 8 by both (that is, by 12), so are divisible by 4 or 6. The overlap is found with the lowest common multiple.
The same formula in probability is the union of two events, and the sets of a Venn diagram are described by overlapping sets and set identities. The extension to three sets adds back the triple overlap (inclusion–exclusion for three events).
The principle also counts the complement: the number with neither property is the total minus the union, as with the 5 students above. It leads to formulas for derangements and for Euler's totient via Möbius inversion.
To count the union of two sets, add their sizes and remove the overlap once.
The overlap of 10 is counted twice and then removed once.
These examples are worked by hand, step by step, so you can compare your own working.
Find the number who play football or tennis: 30, 25, both 10.
In a class of 50, how many play neither?
How many integers from 1 to 100 are divisible by 4 or 6?
A few situations come up again and again. Knowing them saves time and helps you spot answers that cannot be right.
30 + 25 − 10
45.
neither = 60 − 45
15.
50 + 33 − 16
67.
20 + 10 + 15
45.
|A ∪ B| = |A| + |B| − |A ∩ B|: add the sizes then subtract the overlap, which was counted twice.
Find |A ∪ B| for 30, 25 and overlap 10.
In a universe of 60, how many are in neither set?
Count 1–100 divisible by 2 or 3: 50 + 33 − 16.
Only A = 20, both = 10, only B = 15. Find the union.
30 + 25 ✗
subtract the overlap ✓
Double counted.
− 2·10 ✗
− 10 ✓
Once.
overlap 0 ✗
use the actual overlap ✓
Check.
union as neither ✗
universe − union ✓
Be careful.
Try each one on paper, then open the answer. Use the solver above to see the full working.
63
25
23
20
20
60
Unlimited fresh questions with instant marking. Choose a level, work it out on paper, then type your answer.
Solve: …
|A ∪ B| = |A| + |B| − |A ∩ B|.
It was counted twice.
Universe minus the union.
Use the lcm for the intersection.
inclusion–exclusion for events.
derangements.
More in Discrete maths and number theory and the formula sheets.