Inclusion-Exclusion Principle
The inclusion-exclusion principle is a fundamental counting technique that allows us to calculate the cardinality of the union of sets by systematically adding and subtracting intersections. This principle corrects for overcounting when elements belong to multiple sets.
Let be finite sets. The cardinality of their union is:
More compactly, this can be written as: where .
The principle works by first counting all elements (possibly multiple times), then removing those counted twice, adding back those removed too many times, and so forth. The alternating signs ensure that each element is counted exactly once in the final sum.
A derangement is a permutation where no element appears in its original position. The number of derangements of elements can be computed using inclusion-exclusion.
Let be the set of permutations where element is in position . Then:
We have , , and generally .
Therefore:
This approaches for large , meaning approximately of all permutations are derangements.
The number of surjective functions from an -element set to a -element set can be computed using inclusion-exclusion. Let be a function. We want to count surjections (onto functions).
Let be the set of functions that do not have in their range. Then: \text{# surjections} = k^n - \left|\bigcup_{i=1}^k A_i\right|
By inclusion-exclusion:
The inclusion-exclusion principle has a natural generalization to probability theory. For events in a probability space:
This probabilistic version is known as the Bonferroni inequalities when truncated at various stages.
The Euler totient function counts integers in that are coprime to . If , let be the set of integers in divisible by .
By inclusion-exclusion:
For example, , corresponding to .
The principle extends to more abstract settings through Möbius inversion on posets, providing a systematic framework for "inverting" summation formulas in combinatorics and number theory.