Catalan Numbers
Statement
The -th Catalan number is:
They satisfy the recursion:
Visualization
Values through :
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | |
|---|---|---|---|---|---|---|---|---|---|
| 1 | 1 | 2 | 5 | 14 | 42 | 132 | 429 | 1430 |
Balanced parentheses for (all arrangements):
((())) (()()) (())() ()(()) ()()()
Dyck paths for — lattice paths from to that never go below the -axis:
Path 1: ((())) U U U D D D
/\
/ \
/ \___
Path 2: (()()) U U D U D D
/\
/ \/\
Path 3: (())() U U D D U D
/\
/ \ /\
Path 4: ()(()) U D U U D D
/\ /\
/ \
Path 5: ()()() U D U D U D
/\ /\ /\
Each up-step corresponds to ( and each down-step to ). The path must stay at or above height 0.
Recursion unrolled for :
Proof Sketch
Ballot problem / reflection argument: Count lattice paths from to with and steps that stay non-negative. Total paths: . Bad paths (those that go negative) biject with unrestricted paths from to via the reflection principle, numbering . So:
Mathlib's Catalan number satisfies catalan_succ: .
Connections
- Pigeonhole PrinciplePigeonhole PrincipleIf n+1 objects are placed into n boxes, some box contains at least two objectsRead more → — the ballot problem uses a pigeonhole argument to count bad paths
- Inclusion-Exclusion PrincipleInclusion-Exclusion PrincipleThe size of a union is the alternating sum of intersection sizesRead more → — bad paths counted via complementary counting
- Stirling NumbersStirling NumbersCounting partitions of n elements into k non-empty subsetsRead more → — both sequences count partition-like structures; (approximately)
- Bell NumbersBell NumbersThe total number of partitions of a set of n elementsRead more → — Bell numbers grow faster; vs
- Binomial TheoremBinomial TheoremExpanding powers of a sum via binomial coefficientsRead more → — the closed form directly uses binomial coefficients
- Lucas's TheoremLucas's TheoremBinomial coefficients mod a prime p reduce digit-by-digit in base pRead more → — Lucas's theorem gives for prime
Lean4 Proof
import Mathlib.Combinatorics.Enumerative.Catalan
/-- The Catalan recursion: C(n+1) = ∑ᵢ C(i) * C(n-i).
This is `catalan_succ` in Mathlib. -/
theorem catalan_recursion (n : ℕ) :
catalan (n + 1) = ∑ i : Fin n.succ, catalan i * catalan (n - i) :=
catalan_succ n
/-- Verify small values by computation. -/
theorem catalan_vals :
catalan 0 = 1 ∧ catalan 1 = 1 ∧ catalan 2 = 2 ∧
catalan 3 = 5 ∧ catalan 4 = 14 := by decide
/-- The number of Dyck words of semilength n equals C(n).
This is `DyckWord.card_dyckWord_semilength_eq_catalan` in Mathlib. -/
theorem dyck_count_eq_catalan (n : ℕ) :
Fintype.card { p : DyckWord // p.semilength = n } = catalan n :=
DyckWord.card_dyckWord_semilength_eq_catalan nReferenced by
- Cayley's Formula ($n^{n-2}$ trees)Graph Theory
- Inclusion-Exclusion PrincipleCombinatorics
- Polya EnumerationCombinatorics
- Stirling NumbersCombinatorics
- Pigeonhole PrincipleCombinatorics
- Stirling's ApproximationCombinatorics
- Bell NumbersCombinatorics