Pigeonhole Principle
Statement
Let and be finite sets with . Then for every function , there exist distinct such that .
Equivalently: no injective function exists from a larger finite set to a smaller one.
Visualization
13 birthdays, 12 months — a collision is unavoidable.
People: Alice Bob Carol Dave Eve Frank Grace Heidi Ivan Judy Karl Liam Mia Months: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
Month | People assigned
------+----------------
Jan | Alice
Feb | Bob
Mar | Carol
Apr | Dave
May | Eve
Jun | Frank
Jul | Grace
Aug | Heidi
Sep | Ivan
Oct | Judy
Nov | Karl
Dec | Liam ← 12 slots filled, Mia has nowhere new to go
Mia must share a month with one of the twelve above. No arrangement escapes this — it is a consequence of arithmetic, not bad luck.
Counting argument: Suppose every month held at most 1 person. Then at most people could be accommodated. But we have 13 people. Contradiction.
Proof Sketch
Assume for contradiction that is injective, i.e., whenever . Then induces an injection from into , so , contradicting . Therefore cannot be injective, and some value in is hit at least twice.
The proof is purely combinatorial: no induction is needed. The key lemma in Mathlib is Fintype.exists_ne_map_eq_of_card_lt.
Connections
The Pigeonhole Principle powers a surprising range of results:
- Inclusion-Exclusion PrincipleInclusion-Exclusion PrincipleThe size of a union is the alternating sum of intersection sizesRead more → — counts collisions precisely rather than just proving they exist
- Catalan NumbersCatalan NumbersThe ubiquitous sequence counting balanced parentheses, binary trees, and Dyck pathsRead more → — Dyck paths use a pigeonhole-style argument to establish the ballot problem
- Stirling NumbersStirling NumbersCounting partitions of n elements into k non-empty subsetsRead more → — partition counting requires knowing when forced merges occur
- Bell NumbersBell NumbersThe total number of partitions of a set of n elementsRead more → — the exponential growth of implies pigeonhole collisions among partitions
- Fermat's Little TheoremFermat's Little TheoremFor prime p, a^p is congruent to a mod pRead more → — the necklace-counting proof implicitly uses pigeonhole via residues
- Binomial TheoremBinomial TheoremExpanding powers of a sum via binomial coefficientsRead more → — multinomial counting relies on distinguishing collision-free arrangements
Lean4 Proof
import Mathlib.Combinatorics.Pigeonhole
/-- The Pigeonhole Principle: any function from a larger finite type to
a smaller one must identify two distinct inputs.
This is `Fintype.exists_ne_map_eq_of_card_lt` from Mathlib. -/
theorem pigeonhole {α β : Type*} [Fintype α] [Fintype β]
(h : Fintype.card β < Fintype.card α) (f : α → β) :
∃ x y : α, x ≠ y ∧ f x = f y :=
Fintype.exists_ne_map_eq_of_card_lt f h
/-- Concrete instance: 13 elements → 12 elements forces a collision.
`Fin 13` has cardinality 13, `Fin 12` has cardinality 12. -/
theorem pigeonhole_13_12 (f : Fin 13 → Fin 12) :
∃ x y : Fin 13, x ≠ y ∧ f x = f y :=
Fintype.exists_ne_map_eq_of_card_lt f (by decide)Referenced by
- Hall's Marriage TheoremGraph Theory
- Cantor's TheoremSet Theory and Logic
- Inclusion-Exclusion PrincipleCombinatorics
- Catalan NumbersCombinatorics
- Erdos-Ko-Rado TheoremCombinatorics
- Stirling NumbersCombinatorics
- Ramsey's TheoremCombinatorics
- Ramsey's TheoremCombinatorics
- Bell NumbersCombinatorics
- Kraft's InequalityInformation Theory
- Hamming BoundInformation Theory