TheoremComplete

Pigeonhole and Inclusion-Exclusion - Main Theorem

The Principle of Inclusion-Exclusion is one of the most fundamental results in combinatorics, providing a systematic method for computing the cardinality of unions of finite sets.

DefinitionPrinciple of Inclusion-Exclusion

Let A1,A2,…,AnA_1, A_2, \ldots, A_n be finite sets. Then: ∣⋃i=1nAi∣=∑k=1n(−1)k+1∑∣S∣=k∣⋂i∈SAi∣\left|\bigcup_{i=1}^{n} A_i\right| = \sum_{k=1}^{n} (-1)^{k+1} \sum_{|S|=k} \left|\bigcap_{i \in S} A_i\right|

where the inner sum is over all subsets S⊆{1,2,…,n}S \subseteq \{1,2,\ldots,n\} with exactly kk elements.

Proof by Induction:

We prove by induction on nn.

Base case: For n=1n = 1, the formula gives ∣A1∣|A_1|, which is trivially true.

For n=2n = 2, we need to show ∣A1∪A2∣=∣A1∣+∣A2∣−∣A1∩A2∣|A_1 \cup A_2| = |A_1| + |A_2| - |A_1 \cap A_2|.

Every element xx is counted as follows:

  • If x∈A1x \in A_1 only: counted once in ∣A1∣|A_1|, total = 1 ✓
  • If x∈A2x \in A_2 only: counted once in ∣A2∣|A_2|, total = 1 ✓
  • If x∈A1∩A2x \in A_1 \cap A_2: counted once in ∣A1∣|A_1|, once in ∣A2∣|A_2|, subtracted once in ∣A1∩A2∣|A_1 \cap A_2|, total = 1+1−1=11 + 1 - 1 = 1 ✓
  • If x∉A1∪A2x \notin A_1 \cup A_2: not counted, total = 0 ✓

Inductive step: Assume the formula holds for n−1n-1 sets. We prove it for nn sets.

Note that A1∪A2∪⋯∪An=(A1∪⋯∪An−1)∪AnA_1 \cup A_2 \cup \cdots \cup A_n = (A_1 \cup \cdots \cup A_{n-1}) \cup A_n.

By the n=2n=2 case: ∣⋃i=1nAi∣=∣⋃i=1n−1Ai∣+∣An∣−∣(⋃i=1n−1Ai)∩An∣\left|\bigcup_{i=1}^{n} A_i\right| = \left|\bigcup_{i=1}^{n-1} A_i\right| + |A_n| - \left|\left(\bigcup_{i=1}^{n-1} A_i\right) \cap A_n\right|

By the inductive hypothesis: ∣⋃i=1n−1Ai∣=∑k=1n−1(−1)k+1∑∣S∣=k,S⊆{1,…,n−1}∣⋂i∈SAi∣\left|\bigcup_{i=1}^{n-1} A_i\right| = \sum_{k=1}^{n-1} (-1)^{k+1} \sum_{|S|=k, S \subseteq \{1,\ldots,n-1\}} \left|\bigcap_{i \in S} A_i\right|

Note that (⋃i=1n−1Ai)∩An=⋃i=1n−1(Ai∩An)\left(\bigcup_{i=1}^{n-1} A_i\right) \cap A_n = \bigcup_{i=1}^{n-1} (A_i \cap A_n).

Applying the inductive hypothesis again: ∣⋃i=1n−1(Ai∩An)∣=∑k=1n−1(−1)k+1∑∣S∣=k,S⊆{1,…,n−1}∣⋂i∈SAi∩An∣\left|\bigcup_{i=1}^{n-1} (A_i \cap A_n)\right| = \sum_{k=1}^{n-1} (-1)^{k+1} \sum_{|S|=k, S \subseteq \{1,\ldots,n-1\}} \left|\bigcap_{i \in S} A_i \cap A_n\right|

Combining these: ∣⋃i=1nAi∣=∑k=1n−1(−1)k+1∑∣S∣=k,S⊆{1,…,n−1}∣⋂i∈SAi∣+∣An∣−∑k=1n−1(−1)k+1∑∣S∣=k,S⊆{1,…,n−1}∣⋂i∈S∪{n}Ai∣\left|\bigcup_{i=1}^{n} A_i\right| = \sum_{k=1}^{n-1} (-1)^{k+1} \sum_{|S|=k, S \subseteq \{1,\ldots,n-1\}} \left|\bigcap_{i \in S} A_i\right| + |A_n| - \sum_{k=1}^{n-1} (-1)^{k+1} \sum_{|S|=k, S \subseteq \{1,\ldots,n-1\}} \left|\bigcap_{i \in S \cup \{n\}} A_i\right|

Rearranging to group terms by the size of intersection sets, we obtain exactly the formula for nn sets. □\square

Alternative Proof (Direct Counting):

Consider any element xx in ⋃i=1nAi\bigcup_{i=1}^n A_i. Suppose xx belongs to exactly mm of the sets A1,…,AnA_1, \ldots, A_n (where m≥1m \geq 1).

On the right-hand side, xx is counted:

  • (m1)\binom{m}{1} times in the first sum (single-set terms)
  • −(m2)-\binom{m}{2} times in the second sum (two-set intersections)
  • +(m3)+\binom{m}{3} times in the third sum (three-set intersections)
  • And so on...

The net count is: ∑k=1m(−1)k+1(mk)=−∑k=0m(−1)k(mk)+1=−(1−1)m+1=1\sum_{k=1}^{m} (-1)^{k+1} \binom{m}{k} = -\sum_{k=0}^{m} (-1)^k \binom{m}{k} + 1 = -(1-1)^m + 1 = 1

Therefore, each element in the union is counted exactly once. □\square

Remark

The inclusion-exclusion principle has a dual formulation for counting elements in the intersection of complements (using De Morgan's laws). It also extends to infinite sets in measure theory and probability, where it provides bounds through Bonferroni inequalities when the series is truncated at various terms.