Unit 3: Combinatorial Analysis, Pigeonhole Principle & Inclusion-Exclusion
Exhaustive treatment of combinatorial enumerative theory: addition and multiplication principles, permutations, combinations with and without repetition, binomial theorem and Vandermonde convolutions, Dirichlet's pigeonhole principle and generalized pigeonhole with applications to Erdős-Szekeres and Ramsey theory, the Principle of Inclusion-Exclusion (PIE), derangements, Euler's totient function, and stars-and-bars integer partitions.
§3.1 Fundamental Counting Principles: Sum, Product, Permutations & Combinations
1. The Fundamental Rules of Enumeration
Enumerative combinatorics is the rigorous mathematical discipline of counting finite discrete configurations.
1. The Rule of Sum (Addition Principle):
If a task can be done in either one of $n_1$ ways or one of $n_2$ ways, where the two sets of ways are mutually disjoint ($A \cap B = \emptyset$), then the task can be performed in:
More generally, for pairwise disjoint sets $A_1, A_2, \dots, A_k$:
2. The Rule of Product (Multiplication Principle):
If a procedure can be broken down into a sequence of two independent steps, where step 1 can be carried out in $n_1$ ways and subsequent step 2 can be carried out in $n_2$ ways regardless of the choice in step 1, then the total number of ways to execute the sequence is:
2. Permutations (Order Matters)
An $r$-permutation of a set of $n$ distinct elements is an ordered arrangement of $r$ elements selected from the set.
Theorem 3.1 (Permutations without Repetition): The number of $r$-permutations of a set of $n$ distinct elements is:
Proof: By the product rule, the first position can be filled in $n$ ways, the second in $n-1$ ways, down to the $r$-th position in $n - (r - 1) = n - r + 1$ ways. $\blacksquare$
- Permutations with Repetition: If elements can be selected with unlimited replacement, there are $n^r$ distinct ordered sequences of length $r$.
- Permutations with Indistinguishable Elements: The number of permutations of $n$ objects of which $n_1$ are of type 1, $n_2$ are of type 2, $\dots$, $n_k$ are of type $k$ (with $\sum n_i = n$) is given by the multinomial coefficient:
3. Combinations (Order Does Not Matter)
An $r$-combination of a set of $n$ distinct elements is an unordered selection of $r$ elements from the set.
Theorem 3.2 (Combinations without Repetition): The number of $r$-combinations from $n$ distinct elements is:
Proof: Each unordered subset of size $r$ can be ordered in $r!$ distinct ways to form permutations. By the division principle, $\binom{n}{r} \cdot r! = P(n, r) \implies \binom{n}{r} = \frac{n!}{r!(n-r)!}$. $\blacksquare$
§3.2 Binomial Theorem, Multinomial Coefficients & Combinatorial Identities
1. The Binomial Theorem
Theorem 3.3 (Binomial Theorem): Let $x$ and $y$ be real variables and $n \in \mathbb{N}$. Then:
Combinatorial Proof: The product $(x + y)^n = (x + y)(x + y)\cdots(x + y)$ contains $n$ factors. When expanding, we choose either $x$ or $y$ from each factor. The term $x^{n-k} y^k$ arises whenever we choose $y$ from exactly $k$ factors and $x$ from the remaining $n-k$ factors. The number of ways to pick $k$ factors out of $n$ to supply $y$ is precisely $\binom{n}{k}$. Summing over all $k \in \{0, 1, \dots, n\}$ yields the theorem. $\blacksquare$
2. Fundamental Combinatorial Identities
1. Symmetry Identity:
2. Pascal's Identity:
Combinatorial Proof: Let $S$ have $n$ elements and distinguish element $x_0 \in S$. Subsets of size $k$ either contain $x_0$ (leaving $k-1$ elements to choose from $n-1$) or do not contain $x_0$ (leaving $k$ elements to choose from $n-1$). Summing these disjoint cases proves the identity.
3. Sum of Binomial Coefficients:
4. Vandermonde's Convolution Identity:
Theorem 3.4 (Vandermonde's Identity): For positive integers $m, n, r$:
Proof: Consider a group of $m$ men and $n$ women. Choosing a committee of $r$ people from the total $m + n$ pool can be partitioned by the number of men $k \in \{0, 1, \dots, r\}$ on the committee, with the remaining $r - k$ chosen from women. $\blacksquare$
§3.3 The Pigeonhole Principle & Generalized Ramsey Bounds
1. Dirichlet's Pigeonhole Principle
Theorem 3.5 (Pigeonhole Principle): If $k + 1$ or more pigeons are placed into $k$ pigeonholes, then there is at least one pigeonhole containing two or more pigeons.
Proof by Contradiction: Assume that no pigeonhole contains two or more pigeons. Then each of the $k$ pigeonholes contains at most 1 pigeon. The total number of pigeons would be at most $k \cdot 1 = k$. But we were given at least $k + 1$ pigeons, a contradiction ($k + 1 \le k$). $\blacksquare$
2. The Generalized Pigeonhole Principle
Theorem 3.6 (Generalized Pigeonhole Principle): If $N$ objects are placed into $k$ boxes, then there is at least one box containing at least:
where $\lceil x \rceil$ is the ceiling function (least integer $\ge x$).
Proof: Assume every box contains at most $\lceil N / k \rceil - 1$ objects. Then the total number of objects is at most:
contradicting the presence of $N$ objects. $\blacksquare$
3. Erdős-Szekeres Monotonic Subsequence Theorem
Theorem 3.7 (Erdős-Szekeres Theorem): Every sequence of $n^2 + 1$ distinct real numbers contains a strictly increasing subsequence of length $n + 1$ or a strictly decreasing subsequence of length $n + 1$.
Proof using Pigeonhole Principle:
- Let the sequence be $a_1, a_2, \dots, a_{n^2 + 1}$.
- For each index $k \in \{1, \dots, n^2 + 1\}$, associate the ordered pair $(i_k, d_k)$:
- $i_k$: length of the longest increasing subsequence beginning with $a_k$.
- $d_k$: length of the longest decreasing subsequence beginning with $a_k$.
- Assume for contradiction that no increasing or decreasing subsequence of length $n + 1$ exists.
- Then for all $k$, $1 \le i_k \le n$ and $1 \le d_k \le n$.
- The number of possible distinct pairs $(i, d)$ is $n \times n = n^2$.
- There are $n^2 + 1$ indices $k$, which act as pigeons placed into $n^2$ box pairs.
- By the Pigeonhole Principle, there must exist two distinct indices $j < k$ such that $(i_j, d_j) = (i_k, d_k)$.
- Since all numbers are distinct, either $a_j < a_k$ or $a_j > a_k$:
- If $a_j < a_k$: We can prepend $a_j$ to the longest increasing subsequence starting at $a_k$, yielding an increasing subsequence starting at $a_j$ of length $i_k + 1$. Thus $i_j \ge i_k + 1 > i_k$, contradicting $i_j = i_k$!
- If $a_j > a_k$: We can prepend $a_j$ to the longest decreasing subsequence starting at $a_k$, yielding $d_j \ge d_k + 1 > d_k$, contradicting $d_j = d_k$!
- In both cases a contradiction arises. Therefore, at least one subsequence of length $n + 1$ must exist. $\blacksquare$
§3.4 Principle of Inclusion-Exclusion (PIE), Surjections & Derangements
1. The General Principle of Inclusion-Exclusion (PIE)
For two finite sets: $|A \cup B| = |A| + |B| - |A \cap B|$. For three sets:
Theorem 3.8 (General PIE Theorem): Let $A_1, A_2, \dots, A_n$ be finite sets. Then:
Proof: Let an arbitrary element $x$ belong to exactly $m$ of the sets $A_1, \dots, A_n$ (where $1 \le m \le n$). In the RHS summation:
- It is counted $\binom{m}{1}$ times in the single-set terms.
- It is subtracted $\binom{m}{2}$ times in the pairwise intersections.
- In general, it is counted $(-1)^{k-1} \binom{m}{k}$ times in the $k$-wise intersections.
Total times $x$ is counted on the RHS:
Every element in the union is counted exactly once, and any element outside the union is counted 0 times. $\blacksquare$
2. The Number of Surjective (Onto) Functions
Let $|A| = m$ and $|B| = n$ with $m \ge n$. The number of surjective functions $f: A \twoheadrightarrow B$ is:
where $S_2(m, n)$ is the Stirling number of the second kind (partitions of an $m$-set into $n$ non-empty subsets).
3. Derangements ($D_n$ or $!n$)
A derangement is a permutation of $\{1, 2, \dots, n\}$ such that no element appears in its original position ($\forall i, \pi(i) \ne i$).
Theorem 3.9 (Derangement Formula): The number of derangements of $n$ elements is:
As $n \to \infty$, the probability that a random permutation is a derangement rapidly converges to:
§3.5 Stars and Bars, Integer Partitions & Interactive PIE Simulator
1. Stars and Bars Method (Bose-Einstein Statistics)
The problem of distributing $n$ indistinguishable items into $k$ distinguishable bins is isomorphic to counting non-negative integer solutions to:
Theorem 3.10 (Stars and Bars):
- The number of non-negative integer solutions ($x_i \ge 0$) to $x_1 + \dots + x_k = n$ is:
- The number of strictly positive integer solutions ($x_i \ge 1$) to $x_1 + \dots + x_k = n$ (with $n \ge k$) is:
Proof (Geometric Stars and Bars):
- Represent the $n$ indistinguishable items as $n$ stars ($*$).
- Bins are demarcated by $k - 1$ divider bars ($|$).
- Any arrangement of $n$ stars and $k-1$ bars represents a unique solution.
- The total number of symbols is $n + (k - 1) = n + k - 1$.
- The number of distinct arrangements is the number of ways to choose the $k-1$ positions for the bars from the total $n + k - 1$ positions: $\binom{n + k - 1}{k - 1}$. $\blacksquare$
2. Interactive Pigeonhole & PIE Venn Diagram Simulator
The interactive simulation below allows visual exploration of:
- Pigeonhole Allocation: Dynamic distribution of pigeons into boxes with real-time detection of overloaded boxes satisfying $\lceil N/k \rceil$.
- 3-Set Inclusion-Exclusion Venn Diagram: Interactive area computation illustrating how overlapping double and triple intersections are compensated.
Rigorous Tiered Solved Examination Problems
Step-by-step unskipped derivations, complete proofs, and verification across Foundational, Advanced, and Honors tiers.
Find the number of integer solutions to the equation:
subject to the following individual constraints:
1. Variable Transformation for Lower Bounds
Let:
- $y_1 = x_1 - 2 \ge 0 \implies x_1 = y_1 + 2$
- $y_2 = x_2 \ge 0$
- $y_3 = x_3 - 5 \ge 0 \implies x_3 = y_3 + 5$
- $y_4 = x_4 \ge 0$
Substitute into the original equation:
with the upper bound condition $y_4 \le 6$ (since $y_4 = x_4$).
2. Total Non-Negative Solutions without Upper Bound Constraint
The total number of non-negative integer solutions to $y_1 + y_2 + y_3 + y_4 = 18$ with $y_i \ge 0$ is:
Computing the binomial coefficient:
3. Complementary Solutions Violating the Upper Bound
A solution violates the condition if $y_4 \ge 7$. Let $z_4 = y_4 - 7 \ge 0 \implies y_4 = z_4 + 7$. Substitute into the equation:
The number of non-negative solutions with $y_4 \ge 7$ is:
Computing the binomial coefficient:
4. Final Solution via Subtraction
Applying the complement rule:
There are exactly 966 valid integer solutions. $\blacksquare$
Let $S_n$ be the symmetric group of permutations of $n$ elements. A permutation $\pi \in S_n$ is a derangement if $\pi(i) \ne i$ for all $i \in \{1, 2, \dots, n\}$.
- Using the Principle of Inclusion-Exclusion, prove that the number of derangements $D_n$ satisfies:
- Prove the two-term linear recurrence relation:
- Prove that for all $n \ge 1$, $D_n$ is the nearest integer to $\frac{n!}{e}$, i.e.:
1. Derivation via Inclusion-Exclusion
Let the universe $\mathcal{U}$ be all $n!$ permutations of $\{1, 2, \dots, n\}$. For each $i \in \{1, 2, \dots, n\}$, define the set of permutations fixing $i$:
A derangement is a permutation that belongs to none of the sets $A_i$:
For any selection of $k$ distinct indices $\{i_1, i_2, \dots, i_k\}$:
because the $k$ chosen elements are fixed in place, while the remaining $n - k$ elements can be permuted arbitrarily. There are $\binom{n}{k}$ such intersections. By the Principle of Inclusion-Exclusion:
Since $\binom{n}{k}(n - k)! = \frac{n!}{k!(n-k)!}(n-k)! = \frac{n!}{k!}$, we obtain:
2. Proof of the Recurrence Relation $D_n = (n-1)(D_{n-1} + D_{n-2})$
Consider the element 1 in a derangement $\pi$. Since $\pi(1) \ne 1$, $\pi(1)$ can be any of the remaining $n - 1$ elements. Suppose $\pi(1) = j$ where $j \in \{2, 3, \dots, n\}$. There are $n - 1$ choices for $j$. We partition based on what $\pi(j)$ equals:
- Case A: $\pi(j) = 1$.
Elements 1 and $j$ swap with each other. The remaining $n - 2$ elements must form a derangement among themselves. There are $D_{n-2}$ such permutations.
- Case B: $\pi(j) \ne 1$.
Element $j$ is forbidden from mapping to 1. Think of renaming 1 as $j$'s forbidden target. Then the $n - 1$ elements $\{2, 3, \dots, n\}$ must be permuted such that no element maps to its forbidden target. This is isomorphic to a derangement of $n - 1$ elements, contributing $D_{n-1}$ ways.
Summing these disjoint cases and multiplying by the $n - 1$ choices for $j$:
3. Nearest Integer Proof: $D_n = \lfloor n!/e + 1/2 \rfloor$
Recall the Taylor series for $e^{-1}$:
Multiplying by $n!$:
where the remainder is:
Since this is an alternating series with strictly decreasing terms in magnitude for $n \ge 1$:
For any $n \ge 1$:
In fact, for $n \ge 2$, $|R_n| \le \frac{1}{3} < \frac{1}{2}$. Therefore, the real number $\frac{n!}{e}$ is within distance less than $\frac{1}{2}$ of the integer $D_n$. Consequently, rounding $\frac{n!}{e}$ to the nearest integer yields precisely $D_n$:
The Ramsey number $R(s, t)$ denotes the minimum number of vertices $N$ such that every 2-coloring (Red/Blue) of the edges of the complete graph $K_N$ contains either a monochromatic Red clique $K_s$ or a monochromatic Blue clique $K_t$.
- Prove using the Generalized Pigeonhole Principle that $R(3, 3) \le 6$ (i.e., among any 6 people, there are either 3 mutual acquaintances or 3 mutual strangers).
- Construct an explicit edge coloring of $K_5$ containing neither a Red $K_3$ nor a Blue $K_3$, proving $R(3, 3) > 5$ and hence $R(3, 3) = 6$.
- Generalize the bound to prove that for all $s, t \ge 2$:
1. Proof that $R(3, 3) \le 6$
Consider a complete graph $K_6$ whose edges are colored with two colors: Red and Blue.
- Select an arbitrary vertex $v \in V(K_6)$.
- The vertex $v$ has $\deg(v) = 6 - 1 = 5$ incident edges connected to the other 5 vertices.
- Each of these 5 edges is colored either Red or Blue (2 colors / pigeonholes).
- By the Generalized Pigeonhole Principle, at least:
must share the same color.
- Without loss of generality, assume at least 3 incident edges from $v$ are colored Red.
Let the three endpoints of these red edges be $u_1, u_2, u_3$.
- Now consider the three edges connecting pairs of $\{u_1, u_2, u_3\}$:
- Case A: If any edge $(u_i, u_j)$ is colored Red, then together with the red edges $(v, u_i)$ and $(v, u_j)$, the triangle $\{v, u_i, u_j\}$ forms a monochromatic Red $K_3$.
- Case B: If none of the edges between $\{u_1, u_2, u_3\}$ are Red, then all three edges $(u_1, u_2), (u_2, u_3), (u_3, u_1)$ must be colored Blue. This forms a monochromatic Blue $K_3$.
- In both cases, a monochromatic $K_3$ (either Red or Blue) is guaranteed to exist.
Therefore, $R(3, 3) \le 6$.
2. Proof that $R(3, 3) > 5$ (Counterexample on $K_5$)
Consider the complete graph $K_5$ with vertices labeled $\{0, 1, 2, 3, 4\}$. Define the 2-coloring rule:
- Color an edge $(i, j)$ Red if $|i - j| \equiv 1 \pmod 5$ or $|i - j| \equiv 4 \pmod 5$ (the perimeter cycle $C_5$).
- Color an edge $(i, j)$ Blue if $|i - j| \equiv 2 \pmod 5$ or $|i - j| \equiv 3 \pmod 5$ (the interior star pentagram).
Analysis of cliques:
- The Red subgraph is a single 5-cycle $C_5 = (0-1-2-3-4-0)$. A 5-cycle contains no triangles ($K_3$). Thus, there is no Red $K_3$.
- The Blue subgraph is also an isomorphic 5-cycle $C_5 = (0-2-4-1-3-0)$. It likewise contains no triangles ($K_3$). Thus, there is no Blue $K_3$.
Since there exists a 2-coloring of $K_5$ with neither a Red $K_3$ nor a Blue $K_3$, we must have:
Combining with $R(3, 3) \le 6$, we conclude rigorously:
3. General Recurrence: $R(s, t) \le R(s - 1, t) + R(s, t - 1)$
Let $N = R(s - 1, t) + R(s, t - 1)$. We prove that any 2-colored $K_N$ contains a Red $K_s$ or a Blue $K_t$.
- Pick any vertex $v \in V(K_N)$.
- The degree of $v$ is $N - 1 = R(s - 1, t) + R(s, t - 1) - 1$.
- Let $N_R$ be the neighbors of $v$ via Red edges, and $N_B$ be the neighbors of $v$ via Blue edges:
- We claim that either $|N_R| \ge R(s - 1, t)$ or $|N_B| \ge R(s, t - 1)$.
If not, then $|N_R| \le R(s - 1, t) - 1$ and $|N_B| \le R(s, t - 1) - 1$, so:
which contradicts the sum being $N - 1$.
5. Case 1: $|N_R| \ge R(s - 1, t)$.
By definition of the Ramsey number, the subgraph induced by $N_R$ contains either:
- A Blue $K_t$ (in which case we are done), or
- A Red $K_{s-1}$. Adding vertex $v$ (which is connected to all of $N_R$ by Red edges) forms a Red $K_s$!
6. Case 2: $|N_B| \ge R(s, t - 1)$.
By symmetry, the subgraph induced by $N_B$ contains either:
- A Red $K_s$ (done), or
- A Blue $K_{t-1}$, which together with $v$ forms a Blue $K_t$.
In every scenario, we find a Red $K_s$ or Blue $K_t$. Hence $R(s, t) \le R(s - 1, t) + R(s, t - 1)$. $\blacksquare$