MathLabs
TheoremProved

General inclusion–exclusion

Statement

For finite sets A1,…,AnA_1,\ldots,A_n: ∣⋃i=1nAi∣=∑k=1n(−1)k+1∑1≤i1<⋯<ik≤n∣Ai1∩⋯∩Aik∣\left|\bigcup_{i=1}^n A_i\right|=\sum_{k=1}^n(-1)^{k+1}\sum_{1\le i_1<\cdots<i_k\le n}\left|A_{i_1}\cap\cdots\cap A_{i_k}\right|

Why is it true?

Each element that lies in several of the sets gets added once for every single set, subtracted once for every pair, added back for every triple, and so on; the alternating pattern is exactly what is needed to bring its total count back down to exactly 11.

Proof sketch

Fix any element xx. If xx belongs to none of A1,…,AnA_1,\ldots,A_n, it contributes 00 to both sides of the formula, so assume xx belongs to exactly m≥1m\ge 1 of the sets.

For each kk, the number of kk-fold intersections Ai1∩⋯∩AikA_{i_1}\cap\cdots\cap A_{i_k} that contain xx equals the number of ways to choose kk of the mm sets containing xx, namely (mk)\binom{m}{k}. So xx's total contribution to the right-hand side is ∑k=1n(−1)k+1(mk)=∑k=1m(−1)k+1(mk)\sum_{k=1}^n(-1)^{k+1}\binom{m}{k}=\sum_{k=1}^m(-1)^{k+1}\binom{m}{k} (terms with k>mk>m vanish since (mk)=0\binom{m}{k}=0).

By the binomial theorem, ∑k=0m(−1)k(mk)=(1−1)m=0\sum_{k=0}^m(-1)^k\binom{m}{k}=(1-1)^m=0, so ∑k=1m(−1)k(mk)=−1\sum_{k=1}^m(-1)^k\binom{m}{k}=-1, and multiplying by −1-1 gives exactly ∑k=1m(−1)k+1(mk)=1\sum_{k=1}^m(-1)^{k+1}\binom{m}{k}=1.

So every element in at least one set contributes exactly 11 to the right-hand side, matching its contribution of 11 to ∣⋃i=1nAi∣\left|\bigcup_{i=1}^n A_i\right|; elements in no set contribute 00 to both sides. Since every element contributes equally to both sides, the two sides are equal.

Topics that use this theorem

Step-by-step proofs

No step-by-step proof yet for this theorem.

References

  1. Wikipedia contributors (2024). Inclusion–exclusion principle
  2. James Maynard (2015). Small gaps between primes · arXiv:1311.4600
  3. Richard A. Brualdi (2017). Introductory Combinatorics (Classic Version), 5th edition