Of the numbers in
let
be the set of multiples of 2,
be the set of multiples of 3, and
be the set of multiples of 5. We have
and
(These numbers can be found by division; for example, since a third of the numbers are multiples of three, we can compute
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
all the multiples of 6. There are
such numbers. Similarly, there are
multiples of both 2 and 5 (multiples of 10), and
multiples of both 3 and 5 (multiples of 15). There is
multiples of all three (just the number 30).
Letβs use this example to understand the theorem better. Consider the number
In which sets is it counted? It is in
but not
or
so it is counting among the 16 multiples of
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
or
The number
is in sets
and
and so also in
It is counted in the 25 multiples of
the 16 multiples of
and the 8 multiples of
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
It belongs to all the sets. It is therefore added to our total three times, when we add the multiples of
and
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.