Of the numbers in \(\{1, 2, \ldots, 50\}\text{,}\) let \(A\) be the set of multiples of 2, \(B\) be the set of multiples of 3, and \(C\) be the set of multiples of 5. We have \(\card{A} = 25\text{,}\) \(\card{B} = 16\text{,}\) and \(\card{C} = 10\text{.}\) (These numbers can be found by division; for example, since a third of the numbers are multiples of three, we can compute \(50/3 = 16.66\text{,}\) so there are 16 multiples of 3 in the set.) Some of the numbers in the set are multiples of both 2 and 3, such as \(6, 12, 18,\ldots\) all the multiples of 6. There are \(\card{A \cap B} = 8\) such numbers. Similarly, there are \(\card{A \cap C} = 5\) multiples of both 2 and 5 (multiples of 10), and \(\card{B \cap C} = 3\) multiples of both 3 and 5 (multiples of 15). There is \(\card{A \cap B \cap C} = 1\) multiples of all three (just the number 30).
\begin{equation*}
\card{A \cup B \cup C} = 25 + 16 + 10 - 8 - 5 - 3 + 1 = 36\text{.}
\end{equation*}
Let’s use this example to understand the theorem better. Consider the number \(21\text{.}\) In which sets is it counted? It is in \(B\text{,}\) but not \(A\) or \(C\text{,}\) so it is counting among the 16 multiples of \(3\) and not counted in any of the other sets, so it is included exactly once in our complete count. Similarly for all other numbers that are multiples of just one of \(2\text{,}\) \(3\text{,}\) or \(5\text{.}\)
The number \(18\) is in sets \(A\) and \(B\text{,}\) and so also in \(A \cap B\text{.}\) It is counted in the 25 multiples of \(2\text{,}\) the 16 multiples of \(3\text{,}\) and the 8 multiples of \(6\text{.}\) So it is added twice in our total and subtracted once, meaning it is counted exactly one time. The same will be true of all numbers that belong to exactly two of the individual sets.
What about \(30\text{?}\) It belongs to all the sets. It is therefore added to our total three times, when we add the multiples of \(2\text{,}\) \(3\text{,}\) and \(5\text{.}\) But it is also subtracted three times, once for each of the three pairs of sets. So it is not counted at all in our total... until we add it back in in the last step, after which it is counted exactly once.