Method for counting objects that is often employed in everyday life, yet was only formalised by Poincaré at the beginning of the 20th century. Suppose you have (finite) sets A_{1},...,A_{n}, and you wish to determine the number of elements N in their union

N = |A_{1} ∪ ... ∪ A_{n}|.

Here

`|A|` is the number of elements in a set

`A`.

- If all sets are pairwise disjoint, then
`N = B`_{1} = |A_{1}|+...+|A_{n}|. In any case, this is an upper bound on the total number of elements:
|A_{1} ∪ ... ∪ A_{n}| ≤
|A_{1}|+...+|A_{n}|.

- Note that we've counted any element in more than one set more than once, so we should really deduct from the above the sizes of all intersections of pairs:
`B`_{2} = |A_{1}∩A_{2}|+...+|A_{1}∩A_{n}| + ... + |A_{n-1}∩A_{n}|.
If no 3 sets intersect, then N=B_{1}-B_{2}, and in any case
|A_{1} ∪ ... ∪ A_{n}| ≥
(|A_{1}| + ... + |A_{n}|) -
(|A_{1}∩A_{2}| + ... + |A_{n-1}∩A_{n}|.

- But now we've deducted back every element which appears in any
*three* of the sets *three* times, and deducted it three times, so we need to add it back! So `B`_{1}-B_{2} is a lower bound on `N`, and we'd better *add* `B`_{3}, the sum of the sizes of all triple intersections.
- Obviously, this logic continues at each stage. Defining
`B`_{k} as the sum of the sizes of all intersections of `k`-tuples of sets, we see that `N = B`_{1} - B_{2} + ... - (-1)^{n} B_{n}. And all the partial sums bracket the correct value!

So if we know how to calculate (or estimate) the sizes of intersections of sets, we can calculate (or estimate) the size of their union!

For a nontrivial application, you might read about counting permutations with no fixpoints.