The inclusion-exclusion principle is a fundamental combinatorial technique used to calculate the size of the union of multiple sets by accounting for overlaps. It corrects for over-counting by alternately adding and subtracting the sizes of intersections.
General Formula:
For (n) sets (A_1, A_2, \dots, A_n):
[
\left| \bigcup_{i=1}^{n} A_i \right| = \sum_{i} |A_i| - \sum_{i < j} |A_i \cap A_j| + \sum_{i < j < k} |A_i \cap A_j \cap A_k| - \cdots + (-1)^{n+1} \left| \bigcap_{i=1}^{n} A_i \right|
]
Step-by-Step Explanation:
- Sum individual sets: Count elements in each set.
→ Overcounts elements in multiple sets.
- Subtract pairwise intersections: Remove elements counted in two sets.
→ Undercounts elements in three or more sets.
- Add triple intersections: Re-add elements in three sets.
→ Overcounts elements in four or more sets.
- Continue alternating signs: Add/subtract higher-order intersections until the (n)-way intersection is included.
Examples:
Example 1: Two Sets
- (A = {1, 2, 3}), (B = {2, 3, 4})
- (A \cup B = {1, 2, 3, 4}) → Size (4).
- Formula:
[
|A \cup B| = |A| + |B| - |A \cap B| = 3 + 3 - |{2, 3}| = 6 - 2 = 4.
]
Example 2: Three Sets
- (A = {1, 2, 3}), (B = {2, 3, 4}), (C = {3, 4, 5})
- (A \cup B \cup C = {1, 2, 3, 4, 5}) → Size (5).
- Formula:
[
\begin{align*}
|A \cup B \cup C| &= |A| + |B| + |C| \
&- |A \cap B| - |A \cap C| - |B \cap C| \
&+ |A \cap B \cap C| \
&= 3 + 3 + 3 - |{2, 3}| - |{3}| - |{3, 4}| + |{3}| \
&= 9 - 2 - 1 - 1 + 1 = 5.
\end{align*}
]
Example 3: Divisibility Problem
Find integers from 1 to 100 divisible by 2, 3, or 5.
- Define sets:
- (A): divisible by 2 → (|A| = \lfloor 100/2 \rfloor = 50)
- (B): divisible by 3 → (|B| = \lfloor 100/3 \rfloor = 33)
- (C): divisible by 5 → (|C| = \lfloor 100/5 \rfloor = 20)
- Intersections:
- (A \cap B): divisible by (\text{lcm}(2,3)=6) → (|A \cap B| = \lfloor 100/6 \rfloor = 16)
- (A \cap C): divisible by (\text{lcm}(2,5)=10) → (|A \cap C| = \lfloor 100/10 \rfloor = 10)
- (B \cap C): divisible by (\text{lcm}(3,5)=15) → (|B \cap C| = \lfloor 100/15 \rfloor = 6)
- (A \cap B \cap C): divisible by (\text{lcm}(2,3,5)=30) → (|A \cap B \cap C| = \lfloor 100/30 \rfloor = 3)
- Formula:
[
\begin{align*}
|A \cup B \cup C| &= 50 + 33 + 20 \
&- 16 - 10 - 6 \
&+ 3 \
&= 103 - 32 + 3 = 74.
\end{align*}
]
Answer: 74 integers.
Why Use Inclusion-Exclusion?
- Avoids overcounting by systematically adjusting for overlaps.
- Applies broadly: combinatorics, probability, number theory (e.g., counting coprime numbers).
- Efficient for complex unions compared to manual counting.
Key Insight: Alternating signs ensure elements in (k) sets are counted exactly once (( \sum_{i=0}^{k} (-1)^i \binom{k}{i} = 0 ) for (k \geq 1), adjusted by the initial count).