Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

How to Find the Size of a Union of Sets

Adding ∣A∣|A| and ∣B∣|B| counts every shared element twice, so subtract the size of the overlap once: ∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|. For three sets, subtract the three pairwise overlaps and add back the triple overlap.

Recognize the task

The question asks for ∣A∪B∣|A \cup B|, ∣A∪B∪C∣|A \cup B \cup C| or "how many elements are in at least one set", or it gives the union and asks for an overlap. You know, or can find, the sizes of the sets and of their intersections. Test: if the sets share no element, the size of the union is the plain sum.
Inclusion-exclusion for finite sets is stated in the finite sets lesson.

Ways to do it

Two setsusual
∣A∪B∣=∣A∣+∣B∣−∣A∩B∣|A \cup B| = |A| + |B| - |A \cap B|
Three setsthree sets
∣A∪B∪C∣=∣A∣+∣B∣+∣C∣−∣A∩B∣−∣A∩C∣−∣B∩C∣+∣A∩B∩C∣|A \cup B \cup C| = |A| + |B| + |C| - |A \cap B| - |A \cap C| - |B \cap C| + |A \cap B \cap C|
The three-set formula: singles plus, pairs minus, triple plus.
Disjoint setsno overlap
∣A∪B∣=∣A∣+∣B∣|A \cup B| = |A| + |B|
When A∩B=∅A \cap B = \emptyset, the disjoint union rule adds the sizes.

Steps

StepOn A={1,2,3,4,5,6}A = \{1, 2, 3, 4, 5, 6\}, B={4,5,6,7,8}B = \{4, 5, 6, 7, 8\}
1Find the size of each set. Count the elements of each set once.∣A∣=6|A| = 6, ∣B∣=5|B| = 5
2Find the overlap. List the shared elements. If there are none, the sets are disjoint and you just add.Intersection ↗A∩B={4,5,6}A \cap B = \{4, 5, 6\}, ∣A∩B∣=3|A \cap B| = 3
3Add the sizes and subtract the overlap once. Each shared element was counted once with AA and once with BB.6+5−3=86 + 5 - 3 = 8
4Check against the union when it is small. List the union directly; the two counts must match.Union ↗A∪B={1,…,8}A \cup B = \{1, \ldots, 8\}, ∣A∪B∣=8|A \cup B| = 8

Worked examples

Example 1 · disjoint sets

no overlap
∣A∣=7|A| = 7, ∣B∣=5|B| = 5, A∩B=∅A \cap B = \emptyset
nothing is shared
∣A∪B∣=7+5=12|A \cup B| = 7 + 5 = 12
a disjoint union adds

Example 2 · find the overlap

reverse
∣A∪B∣=20|A \cup B| = 20, ∣A∣=14|A| = 14, ∣B∣=11|B| = 11
overlap unknown
20=14+11−∣A∩B∣20 = 14 + 11 - |A \cap B|
two-set formula
∣A∩B∣=5|A \cap B| = 5
solve

Example 3 · three listed sets

three sets
A={1,…,5}A = \{1, \ldots, 5\}, B={4,5,6,7}B = \{4, 5, 6, 7\}, C={1,5,7,8}C = \{1, 5, 7, 8\}
sizes 55, 44, 44
A∩B={4,5}A \cap B = \{4, 5\}, A∩C={1,5}A \cap C = \{1, 5\}, B∩C={5,7}B \cap C = \{5, 7\}
three pairs, size 22 each
A∩B∩C={5}A \cap B \cap C = \{5\}
triple overlap
13−6+1=813 - 6 + 1 = 8
union is {1,…,8}\{1, \ldots, 8\}
For counting problems told as stories, the combinatorics hub has its own pages: inclusion-exclusion for two sets and inclusion-exclusion for three sets. Watch the terms add and cancel in the inclusion-exclusion tool.

See it happen

Think of each region of the Venn diagram as a pile of elements. ∣A∣+∣B∣|A| + |B| picks up the lens pile twice, once with each circle, so one copy of ∣A∩B∣|A \cap B| is taken off. With three circles, adding the circles counts each pair-only pile twice and the center pile three times; subtracting the three pairs leaves the center counted zero times, so the triple overlap is added back once.

Common mistakes

Adding overlapping sets

✗ ∣A∪B∣=6+5=11|A \cup B| = 6 + 5 = 11
✓ 44, 55 and 66 were counted twice: 11−3=811 - 3 = 8

Forgetting the triple overlap

✗ ∣A∪B∪C∣=13−6=7|A \cup B \cup C| = 13 - 6 = 7
✓ the element 55 was added three times and subtracted three times: 13−6+1=813 - 6 + 1 = 8

Leaving out one of the sets

✗ ∣A∪B∣=∣A∣−∣A∩B∣|A \cup B| = |A| - |A \cap B|
✓ that is ∣A∖B∣|A \setminus B|; the union also needs ∣B∣|B|: ∣A∣+∣B∣−∣A∩B∣|A| + |B| - |A \cap B|