✓ Official Syllabus VerifiedStandards & Rigor ↗
🏆 Subsection I · Core International Olympiad Pillars (Chapters 1–8)
4

Combinatorics I: Bijective Counting, Stars & Bars, Inclusion–Exclusion & Pigeonhole

🎲 Core Pillar 4 — Olympiad Combinatorics I IMO · NSMO · KAUST KMC  ·  Bijective mappings & double counting  ·  Stars and Bars with lower/upper constraints  ·  Hockey-Stick & Vandermonde identities  ·  Principle of Inclusion–Exclusion (PIE) & Derangements  ·  Generalized Pigeonhole Principle & graph degrees

Olympiad combinatorics replaces messy casework with structural bijections: instead of counting a complicated set A directly, construct a 1-to-1 correspondence f: A approaches B onto a clean set \( B \) of binary strings, lattice paths, or subset choices. Paired with Stars and Bars, the Principle of Inclusion–Exclusion (PIE), and Dirichlet’s Pigeonhole Principle, these tools form the backbone of NSMO, KAUST KMC, AMC/AIME, and IMO combinatorics.

● Definition 4.1 — Stars & Bars, Hockey-Stick & Vandermonde Convolution

1. Stars and Bars: The number of solutions to \( x_1 + x_2 + \cdots + x_k = n \) is:

\[ \binom{n - 1}{k - 1} \text{ in positive integers } (x_i \ge 1), \qquad \binom{n + k - 1}{k - 1} \text{ in non-negative integers } (x_i \ge 0). \]

2. Hockey-Stick & Vandermonde Identities:

\[ \sum_{i=r}^{n} \binom{i}{r} = \binom{n + 1}{r + 1}, \qquad \sum_{j=0}^{k} \binom{m}{j}\binom{n}{k - j} = \binom{m + n}{k}, \qquad \sum_{j=0}^{n} \binom{n}{j}^2 = \binom{2n}{n}. \]
● Theorem 4.2 — Principle of Inclusion–Exclusion (PIE), Derangements & Pigeonhole

1. Principle of Inclusion–Exclusion (PIE): For finite subsets \( A_1, \dots, A_m \subseteq U \), the number of elements in NONE of the \( A_i \) is:

\[ \left|U \setminus \bigcup_{i=1}^m A_i\right| = |U| - \sum_{i} |A_i| + \sum_{iIn particular, the number of derangements \( D_n \) (permutations of \( \{1,\dots,n\} \) with \( \pi(i) \ne i \) for all \( i \)) is \( D_n = n! \sum_{k=0}^n \frac{(-1)^k}{k!} \) (\( D_1=0, D_2=1, D_3=2, D_4=9, D_5=44 \)).

2. Generalized Pigeonhole Principle: Placing \( N \) objects into \( k \) boxes forces at least one box to contain at least \( \lceil N / k \rceil \) objects.

◆ Proof — Combinatorial Proof of the Hockey-Stick Identity by Last Element

How many \( (r + 1) \)-element subsets can be chosen from \( S = \{1, 2, \dots, n + 1\} \)? On the right-hand side, by definition, there are \( \binom{n+1}{r+1} \) such subsets. On the left-hand side, partition those subsets according to their largest element \( m = i + 1 \), which must satisfy \( r + 1 \le i + 1 \le n + 1 \) (so \( r \le i \le n \)). Once the largest element \( i + 1 \) is fixed, the remaining \( r \) elements can be chosen freely from \( \{1, 2, \dots, i\} \) in \( \binom{i}{r} \) ways. Summing over disjoint cases \( i = r, r+1, \dots, n \) yields \( \sum_{i=r}^n \binom{i}{r} = \binom{n+1}{r+1} \). \( \blacksquare \)

Classic Olympiad Bijections & Double-Counting Blueprints
Contest Problem TypeBijective TransformationExact Formula
Choose \(k\) non-adjacent items from \(\{1,\dots,n\}\)Insert \(k\) chosen balls into the \(n-k+1\) gaps around \(n-k\) unchosen balls\(\binom{n - k + 1}{k}\)
Non-decreasing sequences \(1 \le a_1 \le a_2 \le \dots \le a_k \le m\)Shift \(b_i = a_i + (i - 1)\) to get strictly increasing \(1 \le b_1 < \dots < b_k \le m+k-1\)\(\binom{m + k - 1}{k}\)
Surjective functions \(f: \{1,\dots,n\} \to \{1,\dots,k\}\)PIE on \(A_i = \{\text{functions missing output } i\}\)\(\sum_{j=0}^k (-1)^j \binom{k}{j} (k - j)^n\)
Diagonal intersections inside convex \(n\)-gon (no 3 concurrent)Every 4 vertices determine a unique interior diagonal intersection!\(\binom{n}{4}\)
Handshaking Lemma
\(\sum_{v \in V} \deg(v) = 2|E|\); the number of odd-degree vertices is ALWAYS even!
Derangement Recurrence
\(D_n = (n-1)(D_{n-1} + D_{n-2})\) and \(D_n = n D_{n-1} + (-1)^n\)
Upper-Bound Stars & Bars
Combine Stars & Bars with PIE on variables exceeding \(x_i \ge U + 1\)
Subset-of-Subsets Count
Pairs \((A, B)\) with \(A \subseteq B \subseteq \{1,\dots,n\}\) equal \(3^n\) (3 states per element)
Principle of Inclusion–Exclusion on \(\{1,\dots,100\}\): \(|A \cup B| = 50 + 20 - 10 = 60\), leaving \(100 - 60 = 40 = \varphi(100)\) integers coprime to \(10\).
⊙ Explorer · Pascal Binomial Distribution, Stars & Bars & Hockey-Stick Lab
interactive
Binomial \(\binom{n}{k}\)C(8, 3) = 56
Stars & Bars \(\binom{n+k-1}{k-1}\)C(10, 2) = 45
Non-Adjacent \(\binom{n-k+1}{k}\)C(6, 3) = 20

Vary \(n\) and \(k\) to compare standard subset choices \(\binom{n}{k}\), weak compositions \(\binom{n+k-1}{k-1}\), and non-adjacent selections \(\binom{n-k+1}{k}\).

Ramsey number \(R(3,3) = 6\) via Pigeonhole: vertex \(v_1\) has \(5\) incident edges in \(2\) colors, so by Pigeonhole \(\lceil 5/2 \rceil = 3\) edges share a color (say to \(v_2, v_3, v_4\)); either one edge among \(\{v_2,v_3,v_4\}\) matches that color (triangle with \(v_1\)) or all \(3\) have the opposite color (triangle \(v_2 v_3 v_4\))!
Worked Example 4.A — Stars and Bars with Parity & Lower Bounds (AMC 10/12 & NSMO)
Problem. How many ordered quadruples \( (w, x, y, z) \) of positive ODD integers satisfy \( w + x + y + z = 24 \)?
▸ Show step-by-step solution

Parameterize every positive odd integer cleanly as \( 2a + 1 \) with non-negative integer \( a \ge 0 \):
Set \( w = 2a + 1,\; x = 2b + 1,\; y = 2c + 1,\; z = 2d + 1 \) where \( a, b, c, d \in \mathbb{Z}_{\ge 0} \). Substituting into the sum:
\[ (2a + 1) + (2b + 1) + (2c + 1) + (2d + 1) = 24 \iff 2(a + b + c + d) = 20 \iff a + b + c + d = 10. \]
Now apply non-negative Stars and Bars with \( n = 10 \) stars and \( k = 4 \) variables:
\[ \binom{10 + 4 - 1}{4 - 1} = \binom{13}{3} = \frac{13 \times 12 \times 11}{6} = 286. \]

Worked Example 4.B — Stars and Bars + PIE for Upper Bounds (AIME / KAUST KMC)
Problem. How many integers between \( 0 \) and \( 9999 \) inclusive have a sum of decimal digits equal to \( 14 \)?
▸ Show step-by-step solution

Write a 4-digit padded string \( d_1 d_2 d_3 d_4 \) with \( 0 \le d_i \le 9 \) and \( d_1 + d_2 + d_3 + d_4 = 14 \).
1. Unrestricted non-negative solutions (\( d_i \ge 0 \)): \( \binom{14 + 4 - 1}{3} = \binom{17}{3} = 680 \).
2. Let \( A_i \) be the bad set where \( d_i \ge 10 \). Since \( 10 + 10 = 20 > 14 \), at most ONE digit can be \( \ge 10 \) (all pairwise intersections \( A_i \cap A_j = \emptyset \)!).
3. For \( A_1 \), set \( d_1' = d_1 - 10 \ge 0 \), giving \( d_1' + d_2 + d_3 + d_4 = 4 \), which has \( \binom{4 + 4 - 1}{3} = \binom{7}{3} = 35 \) solutions.
4. By PIE across the \( 4 \) digits:
\[ 680 - \binom{4}{1} \cdot 35 = 680 - 140 = 540. \]

Worked Example 4.C — Geometric Pigeonhole on Lattice Midpoints & Unit Squares (NSMO)
Problem. (a) What is the minimum number of lattice points \( (x_i, y_i) \in \mathbb{Z}^3 \) in 3D space that MUST be chosen to guarantee at least two chosen points have a midpoint that is ALSO an integer lattice point? (b) If \( 10 \) points are placed inside a \( 3 \times 3 \) square, prove two lie at distance \( \le \sqrt{2} \).
▸ Show step-by-step solution


(a) The midpoint \( \left(\frac{x_1+x_2}{2}, \frac{y_1+y_2}{2}, \frac{z_1+z_2}{2}\right) \) is in \( \mathbb{Z}^3 \) iff \( x_1 \equiv x_2 \), \( y_1 \equiv y_2 \), and \( z_1 \equiv z_2 \pmod 2 \). Each coordinate has \( 2 \) parities (Even/Odd), creating \( 2^3 = 8 \) parity classes (pigeonholes). Choosing \( 8 \) points can place one in each parity class, whereas choosing \( 8 + 1 = 9 \) points guarantees by Pigeonhole that two share identical parity in all three coordinates!
(b) Partition the \( 3 \times 3 \) square into \( 9 \) unit \( 1 \times 1 \) subsquares. With \( 10 \) points in \( 9 \) boxes, one \( 1 \times 1 \) box contains at least \( 2 \) points, and the maximum distance inside a \( 1 \times 1 \) square is its diagonal \( \sqrt{1^2 + 1^2} = \sqrt{2} \)!

Worked Example 4.D — Partial Derangements (KAUST Finals / Olympiad Classic)
Problem. Six research fellows at KAUST submit 6 distinct lab notebooks for blind peer review. How many ways can the 6 notebooks be redistributed so that exactly 2 fellows receive their own notebook and the remaining 4 fellows each receive someone else's notebook?
▸ Show step-by-step solution

Decompose into two independent decisions:
1. Choose WHICH \( 2 \) of the \( 6 \) fellows are fixed points: \( \binom{6}{2} = 15 \) ways.
2. Derange the remaining \( 4 \) notebooks so NONE of those \( 4 \) fellows receives their own notebook: the number of derangements of \( 4 \) items is:
\[ D_4 = 4!\left(1 - 1 + \frac{1}{2!} - \frac{1}{3!} + \frac{1}{4!}\right) = 24 - 24 + 12 - 4 + 1 = 9. \]
By the multiplication rule, total valid redistributions \( = 15 \times 9 = 135 \).

⚠ Olympiad Trap — Overcounting Indistinguishable Groups & Fake Sequential Multiplication

Never count "at least one from each category" by picking 1 from each first and multiplying by the rest! For example, choosing \( 5 \) balls from \( 3 \) distinct colors so every color appears is NOT \( \binom{n_1}{1}\binom{n_2}{1}\binom{n_3}{1}\binom{N-3}{2} \) — that counts a configuration with \( 3 \) red balls three separate times! Always use PIE (total minus missing \( \ge 1 \) color plus missing \( \ge 2 \) colors).

▲ Contest Strategy — Small-n Sanity Verification on Combinatorial Formulas

Before committing to a combinatorial expression like \( \binom{n-k+1}{k} \) vs \( \binom{n-k}{k} \), plug in \( n = 4, k = 2 \) by hand in 5 seconds! For non-adjacent pairs from \( \{1,2,3,4\} \), the valid pairs are \( \{1,3\}, \{1,4\}, \{2,4\} \) (\( 3 \) ways), immediately confirming \( \binom{4-2+1}{2} = \binom{3}{2} = 3 \) rather than \( \binom{2}{2} = 1 \)!

[Practice 4.1 · NSMO Stage 1 / Easy] In how many ways can 4 books be chosen from a shelf of 11 distinct books arranged in a row so that NO two chosen books were adjacent on the shelf?
💡 Hint 1 of 3
There are \( 11 - 4 = 7 \) unchosen books remaining on the shelf.
💡 Hint 2 of 3
Those 7 unchosen books create \( 7 + 1 = 8 \) gaps (including the two ends).
💡 Hint 3 of 3
Choose \( 4 \) of those \( 8 \) gaps to place the chosen books: \( \binom{8}{4} \).
Using the gap bijection \( \binom{n - k + 1}{k} \) with \( n = 11, k = 4 \), we obtain \( \binom{11 - 4 + 1}{4} = \binom{8}{4} = \frac{8 \times 7 \times 6 \times 5}{24} = 70 \) ways.
[Practice 4.2 · KAUST KMC / Easy] Evaluate the Hockey-Stick sum \( \binom{3}{3} + \binom{4}{3} + \binom{5}{3} + \cdots + \binom{10}{3} \).
💡 Hint 1 of 3
Recall the Hockey-Stick Identity \( \sum_{i=r}^{n} \binom{i}{r} = \binom{n + 1}{r + 1} \).
💡 Hint 2 of 3
Substitute \( r = 3 \) and \( n = 10 \) to obtain \( \binom{11}{4} \).
💡 Hint 3 of 3
Compute \( \frac{11 \times 10 \times 9 \times 8}{24} \).
By the Hockey-Stick Identity, \( \sum_{i=3}^{10} \binom{i}{3} = \binom{11}{4} = \frac{11 \times 10 \times 9 \times 8}{24} = 330 \).
[Practice 4.3 · NSMO Stage 2 / Medium] How many integers in \( \{1, 2, \dots, 1000\} \) are divisible by NONE of \( 2, 3, \) or \( 5 \)?
💡 Hint 1 of 3
Apply 3-set PIE on \( A_2, A_3, A_5 \subseteq \{1,\dots,1000\} \), or group into blocks of \( \operatorname{lcm}(2,3,5) = 30 \)!
💡 Hint 2 of 3
Using blocks of 30: \( 990 = 33 \times 30 \) gives \( 33 \times \varphi(30) = 33 \times 8 = 264 \) integers in \( \{1,\dots,990\} \).
💡 Hint 3 of 3
Check the remaining \( 10 \) integers \( \{991, 992, \dots, 1000\} \) (which mirror \( \{1,\dots,10\} \): only \( 991 \) and \( 997 \) are coprime to \( 30 \)).
By 3-set PIE: \( 1000 - (500 + 333 + 200) + (166 + 100 + 66) - 33 = 1000 - 1033 + 332 - 33 = 266 \).
[Practice 4.4 · AIME / KAUST KMC / Hard] How many ordered pairs of subsets \( (A, B) \) of \( S = \{1, 2, 3, 4, 5\} \) satisfy \( A \cap B = \emptyset \) and \( A \cup B \ne S \)?
💡 Hint 1 of 3
For \( A \cap B = \emptyset \), each element \( x \in S \) has independently \( 3 \) valid states: \( x \in A \) only, \( x \in B \) only, or \( x \notin A \cup B \).
💡 Hint 2 of 3
Thus there are \( 3^5 = 243 \) disjoint pairs \( (A, B) \) in total.
💡 Hint 3 of 3
Subtract the pairs where \( A \cup B = S \) (each element has only \( 2 \) states: \( x \in A \) or \( x \in B \), giving \( 2^5 = 32 \)).
Each element of \( S \) has \( 3 \) disjoint-subset states, giving \( 3^5 = 243 \) pairs with \( A \cap B = \emptyset \). Subtracting the \( 2^5 = 32 \) partitions where \( A \cup B = S \) leaves \( 243 - 32 = 211 \).
[Practice 4.5 · NSMO National Finals / Pigeonhole] What is the minimum number of distinct integers that must be selected from \( \{1, 2, \dots, 50\} \) to guarantee that at least two selected integers sum to \( 51 \)?
💡 Hint 1 of 3
Pair up the elements of \( \{1, \dots, 50\} \) into disjoint boxes that sum to \( 51 \): \( \{1,50\}, \{2,49\}, \dots, \{25,26\} \).
💡 Hint 2 of 3
How many such two-element pigeonholes are formed?
💡 Hint 3 of 3
With \( 25 \) boxes, \( 25 \) numbers could take \( \{1, 2, \dots, 25\} \) with no sum \( 51 \); adding \( 1 \) more triggers Pigeonhole!
Partition \( \{1, \dots, 50\} \) into \( 25 \) pairs \( \{k, 51 - k\} \) for \( k = 1, \dots, 25 \). Choosing \( 25 \) integers (e.g., \( 1, 2, \dots, 25 \)) avoids any pair, whereas by the Pigeonhole Principle, selecting \( 25 + 1 = 26 \) integers forces two to fall into the same pair \( \{k, 51-k\} \) and sum to \( 51 \).

Combinatorics I: Bijective Counting, Stars & Bars, Inclusion–Exclusion & Pigeonhole — Competition Proof Benchmark

6 pts No Calculator
For positive integer \(n\) and quadratic \(P(x) = x^2 + 5x + 26\) in Combinatorics I: Bijective Counting, Stars & Bars, Inclusion–Exclusion & Pigeonhole, examine algebraic invariants below.
  1. (a)2 pts
    Express \(4P(x)\) as a square plus a positive constant.
    Scoring Guideline & Justification
    • [M1] Completes square on 4x^2 + 20x (1 pt)
    • [A1] Obtains (2x + 5)^2 + 79 (1 pt)
  2. (b)2 pts
    Deduce why \(P(n)\) has no real roots for any \(n\in\mathbb{R}\).
    Scoring Guideline & Justification
    • [M1] Bounds squared term >= 0 (1 pt)
    • [A1] Proves strict positivity for all real x (1 pt)
  3. (c)2 pts
    Find the remainder when \(P(10) - P(0)\) is divided by \(10\).
    Scoring Guideline & Justification
    • [M1] Computes 100 + 10k = 10(10 + k) (1 pt)
    • [A1] States remainder is 0 (1 pt)
Complete Worked Solution
(a) \(4P(x) = (2x+5)^2 + 79\). (b) Strictly positive discriminant check: \(4P(x) > 0\). (c) \(P(10)-P(0) = 10(10+5) \equiv 0 \pmod{10}\).
📝 Chapter Quiz