Lukas' Notes

combinatorics

Definition

Inclusion-Exclusion Principle

Let be finite sets indexed by the index set . The inclusion–exclusion principle computes the number of elements in their union by alternately adding and subtracting the sizes of their intersections:

Terms involving one set are added, intersections of two sets are subtracted, intersections of three sets are added, and so on.

Why the Signs Alternate

Fix an element that belongs to exactly of the sets. It appears in intersections of sets, so its total contribution to the right-hand side is

because . Thus every element of the union is counted exactly once.

Examples

3 Intersecting Sets

Include the individual sets

Begin with

This counts an element once for every set containing it. An element in exactly two sets is therefore counted twice, while an element in all three sets is counted three times.

Exclude the pairwise intersections

Subtract each pairwise overlap:

An element in exactly two sets belongs to one pairwise intersection, so its count becomes . An element in all three sets belongs to all three pairwise intersections, so its count becomes .

Include the triple intersection again

The central region must be restored once. Hence

The correction leaves every element counted exactly once.