Combinatorics: Pigeonhole Principle, Stars & Bars & Derangements
“Generalized pigeonhole bounds, combinations with repetition, inclusion-exclusion, and derangements formula.”
1.The Generalized Pigeonhole Principle
§ 4.1.Basic Principle (Dirichlet): If k + 1 or more items are placed into k bins, at least one bin must contain at least 2 items.
Generalized Principle:
If N objects are placed into k boxes, then at least one box must contain at least lceil N / k rceil objects.
Inverted Problem (Guaranteeing a Quota):
How many items N must be chosen to guarantee that at least m items fall into the same category across k categories?
By worst-case analysis: place m - 1 items into each of the k categories without achieving the quota. The very next item forces the quota:
N_{min} = k * (m - 1) + 1.
2.Stars and Bars & The Derangements Invariant
§ 4.2.Stars and Bars (Combinations with Repetition):
The number of ways to distribute r identical items into n distinct labeled bins (or non-negative integer solutions to x_1 + x_2 + ... + x_n = r with x_i >= 0):
binom{n + r - 1}{r} = frac{(n + r - 1)!}{r! (n - 1)!}.
Derangements (Permutations with No Fixed Points):
A derangement is a permutation of {1, 2, ..., n} where no element appears in its original position (pi(i) != i for all i).
Using the Principle of Inclusion-Exclusion (PIE):
D_n = n! sum_{k=0}^n frac{(-1)^k}{k!} = n! [ 1 - frac{1}{1!} + frac{1}{2!} - frac{1}{3!} + ... + frac{(-1)^n}{n!} ].
3. Worked Problem: Constrained Integer Solutions & Derangements
Shift variables to >= 0 by subtracting non-zero lower bounds from total sum r.
Problem: Find the number of integer solutions to x1 + x2 + x3 + x4 = 10 subject to constraints x1 >= 1, x2 >= 2, x3 >= 0, x4 >= 0.
Step 1: Define non-negative shifted variables:
Let x1' = x1 - 1 >= 0 => x1 = x1' + 1
Let x2' = x2 - 2 >= 0 => x2 = x2' + 2
x3' = x3 >= 0
x4' = x4 >= 0
Step 2: Substitute into equation:
(x1' + 1) + (x2' + 2) + x3' + x4' = 10
x1' + x2' + x3' + x4' = 10 - 3 = 7.
Step 3: Apply Stars and Bars formula with n = 4, r = 7:
Number of solutions = binom(n + r - 1, r) = binom(4 + 7 - 1, 7) = binom(10, 7)
binom(10, 7) = binom(10, 3) = (10 9 8) / (3 2 1) = 720 / 6 = 120.
Final Answer: Exactly 120 solutions.
Primary Academic References & Exam Sources
Every concept in Notes From a B.Tech Brain is synthesized from authoritative academic texts, seminal peer-reviewed research, verified exam archives, and renowned university lectures.
Curated for clarity, rigorous numerical solving, and semester excellence:
GATE-focused discrete maths with formula-sheet style rapid coverage.
All relation/function counting formulas in exam-pattern format.
University-level rigour with engaging visual proofs.