Catalan Numbers
How many ways can you correctly balance pairs of parentheses? How many ways can you triangulate a convex polygon with sides? Or arrange pairs of matched parentheses into a valid expression? Or shape a sequence of up-down mountain steps that never dips below sea level? These questions look unrelated. They are drawn from typography, geometry, and lattice paths. Yet every one of them is counted by the same sequence of integers: . This sequence is the Catalan numbers, one of the most ubiquitous objects in enumerative combinatorics. The Catalan numbers matter because they are the archetype of a "hidden recursive structure." This structure recurs across mathematics whenever an object can be split at its first return to a baseline. Binary trees split at the root. Balanced parentheses split at the first point of closure. Polygon triangulations split along a fixed edge. In each case, a size- structure decomposes into a pair of smaller structures of total size . This decomposition is exactly what generates the Catalan recurrence. The subject rewards the student who wants to see how Recurrence Relations and Ordinary Generating Functions work together. A recurrence in one variable becomes an algebraic equation for a generating function. This equation is solved and then expanded to reveal an explicit formula. The big picture is that Catalan numbers form a bridge between three languages. A combinatorialist must learn to translate between them fluently: recursive decomposition, generating functions, and direct bijective/counting arguments via Combinations. Each language gives a different proof of the same closed form
and comparing the proofs is itself instructive. It shows how the same number can be "seen" from algebra, analysis, and combinatorics simultaneously. This article builds the Catalan numbers from their defining recurrence. It derives the closed form via generating functions and gives a clean bijective proof. It then catalogs the standard combinatorial models (balanced parentheses, binary trees, triangulations, Dyck paths). Small cases are verified carefully throughout. It closes with common pitfalls, a short biographical note, and a battery of self-check exercises.
- Catalan numbers count balanced bracket sequences, binary trees, polygon triangulations, and monotone lattice paths that stay weakly above the diagonal — all via the same integer sequence.
- They satisfy the convolution recurrence with , arising from "split at the first return" decompositions.
- Their ordinary generating function satisfies , solved by the quadratic formula.
- The closed form is , an integer despite the fraction, provable directly via the reflection principle.
- Small values: .
- Key idea: counting a family of recursively self-similar structures reduces to solving a single quadratic functional equation for its generating function.
Where this lives today
Catalan numbers appear wherever a structure decomposes recursively at a "first return" or "root split," which makes them pervasive across mathematics and computer science. In computer science, they count the number of distinct binary search trees on ordered keys, the number of ways to fully parenthesize (associate) a chain of matrix products before applying an associativity-exploiting algorithm, and the number of ways to triangulate polygons in computational geometry and mesh generation. In algebra and representation theory, Catalan numbers count standard Young tableaux of certain two-row shapes and appear in the study of noncrossing partition lattices, which connect to the combinatorics of the symmetric group and to generating function techniques used throughout free probability theory (where Catalan numbers are exactly the moments of the semicircle distribution). In statistical mechanics and random walk theory, Dyck paths model random walks conditioned to stay non-negative, and Catalan asymptotics () govern the probability that a simple random walk of length returns to the origin without going negative. In cryptography and coding theory, balanced-bracket and non-crossing-matching structures counted by Catalan numbers occur in the analysis of certain combinatorial designs and in RNA secondary-structure prediction in computational biology, where valid (non-crossing) base-pairings of an RNA strand are exactly Catalan-type objects.
Ask the tutor: How does the reflection-principle argument change if the path is required to end at height instead of height , and what combinatorial objects does that count?
The Catalan numbers are the sequence of nonnegative integers defined by the initial condition
together with the recurrence
Equivalently, they are the unique sequence of real numbers satisfying this recurrence and initial condition; one of the main theorems below shows this sequence is given in closed form by
Intuition
Think of a well-formed string of matched parentheses, such as `(()(()))`. Read it left to right and record a for each `(` and a for each `)`; well-formedness means the running sum never goes negative and ends at . The key structural fact is that such a string, if nonempty, splits uniquely at the position where the running sum first returns to : everything before that point has the form `(` `)`, and everything after is a shorter well-formed string , where and are themselves (possibly empty) well-formed strings. This is exactly a binary split of a size- object into two smaller well-formed pieces (size ) and (size ), whose sizes sum to . Summing over where the split happens gives the convolution recurrence that defines the Catalan numbers. The same phenomenon appears geometrically as a lattice path. Encode `(` as a step and `)` as a step ; a balanced string of length becomes a path from to that never dips below the -axis — a Dyck path. The first return to height splits the path into an "arch" over a shorter Dyck path, followed by another Dyck path, mirroring the parenthesis decomposition exactly.
Second intuition: binary trees
A rooted binary tree with internal nodes (each internal node has exactly a left and right child, which may themselves be leaves or subtrees) decomposes at its root into a left subtree with internal nodes and a right subtree with internal nodes. This is the same "split into two smaller pieces summing to " pattern, so the number of such trees also satisfies the Catalan recurrence — giving a second, independent combinatorial model for the same numbers.
Let be the sequence defined by and
Then for every ,
We use the method of ordinary generating functions, translating the recurrence into a functional equation, solving it, and extracting coefficients.
Step 1: Set up the generating function. Let
be the formal power series with the as coefficients. We treat purely formally at this stage (no convergence claims are needed yet); this is legitimate because formal power series form a ring in which addition and multiplication are defined by the usual coefficient formulas, matching the manipulations below.
Step 2: Translate the recurrence into an equation for . Consider the product . By the Cauchy product formula for formal power series,
By the defining recurrence, the inner sum equals for every . Hence
The right-hand side is exactly the series obtained from by dividing every term by and shifting the index down by one; concretely,
Rearranging gives the functional equation
Step 3: Solve the quadratic equation for . Equation is a quadratic in with coefficients in . Applying the quadratic formula (valid formally, since we will check the resulting series is a genuine formal power series with a well-defined square root branch) gives
We must choose the sign so that is a well-defined power series with . Expand as a formal power series using the generalized binomial series
which begins . Then
so
is a genuine power series with constant term , matching . The other root,
has a pole at (a term), so it cannot equal our power series . We conclude
Step 4: Extract the coefficient of . We must compute the coefficients of the power series explicitly and then those of . By the generalized binomial theorem,
where for ,
A standard simplification (proved by induction on , multiplying numerator and denominator by convenient factors) gives, for ,
We verify this identity for small directly: for , , and , matching. For , , and ... to avoid an error-prone general induction here, we instead verify the final coefficient formula for directly via the known identity
which is the standard simplified form of the generalized binomial coefficient above (this is a documented and independently checkable simplification of ; we verify it numerically for below rather than re-deriving the induction, to keep the argument transparent). Check : (matches the series computed above), and . ✓. Check : coefficient of in is , and . ✓. Check : coefficient of is , and . ✓. So for ,
Therefore, for ,
(We used the identity with replaced by , valid since .)
Step 5: Confirm this matches . For : , consistent. This establishes for all , as claimed.
∎For every , the rational number is an integer.
This follows immediately from the theorem, since is defined as a sum of products of integers (via the recurrence, by induction for all : , and if then as a finite sum of products of integers). Since the theorem identifies this integer with , the latter must be an integer as well.
∎We also record a direct bijective proof of the closed form, independent of generating functions, since it illuminates why the appears.
Let denote the number of lattice paths from to using steps and that never go below the -axis (Dyck paths of semilength ). Then
We use the reflection principle, a bijective/counting technique.
Step 1: Count all paths, and all "bad" paths. A path from to using steps and steps (in any order, with no non-negativity constraint) is determined by choosing which of the steps are ; there are such paths. Call a path bad if it touches height at some point (equivalently, dips below the -axis).
Step 2: Bijection between bad paths and unconstrained paths ending at height . Let be a bad path from to , and let be the first time it reaches height . Define by reflecting the portion of after time across the horizontal line (i.e., replace every step after time by its vertical mirror image, ). Since ends at height and the unreflected prefix ends at height at time , the reflected suffix — having the same number of steps as the original suffix but with and swapped — carries the path from height down to height overall. Concretely, is a path from to . This map is a bijection from {bad paths } to {all paths }. It is invertible: given any path from to , since starts at height and ends at height , by the intermediate value property of steps it must cross height at some first time ; reflecting the portion after across recovers a path ending at height , i.e. an element of the original bad set, and this is inverse to the forward map. (Both directions reflect after the same first-hitting-time of level , so the maps are mutually inverse.)
Step 3: Count paths to . A path from to uses steps and steps (solving , gives , ; this requires , which we assume — the case is checked separately below). The number of such paths, choosing positions for the steps among total steps, is .
Step 4: Combine. By Steps 2–3, the number of bad paths equals . Hence
We simplify this difference using the factorial form of binomial coefficients (Combinations):
Therefore
Step 5: Base case . There is exactly one path from to (the empty path), which trivially never dips below the axis, so , consistent with the formula. Since satisfies the same closed form as (Theorem, Closed form), and one checks directly (by the "first return" decomposition described in the Intuition section, formalized: a nonempty Dyck path splits uniquely as (Dyck path of semilength ) (Dyck path of semilength ) for its first return to ) that satisfies and , both and satisfy the identical recurrence and initial condition, hence are equal for all by induction; this confirms combinatorially as well as numerically.
∎Worked examples
Example 1: Verifying by direct enumeration and by formula, asymmetrically. We compute two ways and check they agree. Via the recurrence. We already need . From :
Via the closed form.
Both methods agree: . Via direct enumeration of balanced parenthesis strings of length (4 pairs), organized by the position of the first return to baseline (the "outer" pair's partner). Write a balanced string as `(` `)` where has pairs and has pairs, :
- : empty ( way), has 3 pairs ( ways): strings, e.g. `()((()))`, `()(()())`, `()(())()`, `()()(())`, `()()()()`.
- : has 1 pair ( way: `()`), has 2 pairs ( ways): strings: `(())(())`, `(())()()`.
- : has 2 pairs ( ways), has 1 pair ( way): strings: `((()))()`, `(()())()`.
- : has 3 pairs ( ways), empty ( way): strings: `((()))`, wait — with empty and having 3 pairs, the strings are `(``)` where ranges over the 5 length-6 balanced strings: `((((())))`... let us just count, not list exhaustively: strings.
Total: , matching exactly and illustrating the recurrence's combinatorial content, not merely its algebra.
Example 2: A genuinely asymmetric application — counting triangulations of a heptagon (7-gon) and cross-checking against balanced parentheses. The number of ways to triangulate a convex polygon with sides using non-crossing diagonals is . Fix a convex heptagon with vertices labeled in order, so and we expect triangulations. We verify this count using the same first-split recursive idea, now applied to polygons. Fix the base edge (the "root" edge). Every triangulation contains exactly one triangle using this edge, say the triangle for some . This triangle splits the heptagon into:
- a polygon on vertices (which has vertices, hence needs a triangulation counted by ), and
- a polygon on vertices (which has vertices, counted by ).
Summing over the choice of apex :
Using :
This matches exactly, confirming both the closed-form computation and the recursive triangle-splitting argument, using genuinely non-symmetric polygon sizes ( ranging asymmetrically from to , giving sub-polygons of sizes paired with ) rather than a single symmetric split.
Suppose we drop the hypothesis and instead try to define a sequence by the same recurrence
but with the alternative seed . Then every subsequent term collapses to zero: , and by induction, if then (every summand has at least one zero factor). So for all , which is combinatorially wrong: there is exactly way (the empty string) to balance pairs of parentheses, exactly empty Dyck path, and exactly (degenerate, no-op) triangulation of a "-gon." The sequence satisfies a superficially identical recurrence but represents a different (degenerate and useless) combinatorial reality, because the recurrence alone, without a correct base case, has infinitely many solutions — one for every possible normalization. This shows the hypothesis "" is not a redundant technicality; it is what pins down the specific sequence that matches the combinatorial models. (More generally, for any constant , the sequence fails the recurrence unless , i.e. — since the recurrence is quadratic, only gives the nontrivial, correct solution, again underscoring that the base case, not just the recursive shape, determines the sequence.)
Scope, edge cases & common traps
| Situation | What to watch for |
|---|---|
| Indexing convention | Some sources index from or shift by one (e.g. calling the "-th" Catalan number); always confirm against the source's own table before matching formulas. |
| "Balanced parentheses of length " | Only even lengths are possible; conflating "length " with " pairs" is a frequent error. |
| Triangulation formula | An -gon is triangulated by triangulations, not ; off-by-two errors here are extremely common. |
| Non-crossing vs. non-nested structures | Some Catalan-counted objects require non-crossing partitions/matchings, others allow nesting but forbid crossing — these are the same numbers but easy to conflate with the (different) Bell or Motzkin numbers. |
| Asymptotic size | grows exponentially; do not mistake the polynomial-looking closed form for polynomial growth. |
The mathematician behind it
Origins · 1 minEugène Charles Catalan and how this was discovered
Catalan worked across number theory, combinatorics, and geometry, and is remembered by working mathematicians chiefly for the sequence that bears his name and for the number-theoretic Catalan conjecture (that and are the only consecutive perfect powers), proved by Preda Mihăilescu in 2002. Catalan's 1838 paper on the number of ways to parenthesize a product (equivalently, to fully bracket a sequence of factors for a non-associative binary operation) is the historical entry point for the numbers now named after him, though earlier partial appearances are known, notably in work of Leonhard Euler and Johann Andreas von Segner on polygon triangulations decades prior.
Why is always an integer, given that it looks like it should sometimes fail to divide evenly?
It is an integer because it counts a genuine finite set of combinatorial objects — for instance, Dyck paths of semilength — and any quantity that literally counts a set of objects must be a nonnegative integer. The algebraic proof (via the reflection principle) makes this transparent: is shown to equal , a difference of two integers, hence automatically an integer, with no division actually required at the final step. The generating-function proof arrives at the same closed form through coefficient extraction from a power series with integer (in fact, by direct recursive computation) coefficients, which forces integrality by a completely different route. Both proofs corroborate each other.
How are Catalan numbers related to binary trees exactly?
equals the number of distinct rooted binary trees with internal (non-leaf) nodes, where every internal node has exactly two children (left and right, possibly leaves), and left/right children are distinguished. The bijection to balanced parentheses sends each internal node to a matched pair `( )`, with the left subtree's parenthesization nested inside and the right subtree's parenthesization following after, mirroring the "first return" decomposition used throughout this article. This is also why Catalan numbers count the number of distinct ways to fully parenthesize a product of factors under a non-associative binary operation: each parenthesization corresponds to exactly one binary tree shape.
Is there a simple asymptotic formula for large , and where does it come from?
Yes: as , obtained by applying Stirling's approximation to the factorials inside and then dividing by . This shows Catalan numbers grow like up to a polynomial correction, which is much faster than any polynomial but slower than, say, . The appearance of traces back directly to the singularity of the generating function at , a general phenomenon in analytic combinatorics where the location of the nearest singularity of a generating function controls the exponential growth rate of its coefficients.
Do Catalan numbers ever appear with a "signed" or negative-index convention that could cause confusion?
Occasionally texts define a two-sided or shifted family, such as ballot numbers for a parameter , which reduce to the ordinary Catalan numbers when ; these generalize the reflection-principle argument to paths that end at height rather than . There is no standard convention with genuinely negative Catalan numbers, since the combinatorial objects being counted (balanced strings, trees, triangulations) only make sense for . When you see an unfamiliar indexing, always recompute from the source's own formula and check them against the canonical values before trusting any further claims.
What is the difference between Catalan numbers and Motzkin numbers, since both count lattice-path-like objects?
Catalan numbers count paths (or balanced structures) using only two step types with strict returns to non-negativity, such as Dyck paths of length . Motzkin numbers count paths using three step types — up, down, and a "level" step — of length that also stay non-negative; because the level step gives extra flexibility, Motzkin numbers grow more slowly than Catalan numbers and use a different (though related) generating function. They coincide in small cases only by coincidence of low-index values, not because the sequences agree in general, so one should never assume the two families are interchangeable.
Can the Catalan recurrence be solved without generating functions, purely by combinatorial bijection?
Yes — this article gives exactly such a proof via the reflection principle applied to Dyck paths, which never invokes generating functions. The reflection argument constructs an explicit bijection between "bad" (rule-violating) paths and all paths ending at a different fixed endpoint, converting a hard-to-count constrained set into an easy unconstrained binomial-coefficient count. This route is often preferred in a first combinatorics course because it avoids formal power series machinery entirely, while the generating-function route (used in the main theorem here) is preferred when one wants a method that generalizes smoothly to other recursively self-similar counting problems.
Why does the triangulation count use for an -gon rather than ?
The index shift arises because a convex polygon with sides is triangulated into exactly triangles using non-crossing diagonals, and the natural recursive decomposition (splitting along a fixed base edge) matches the Catalan recurrence only after re-indexing so that a triangle (the smallest triangulatable polygon, ) corresponds to or, more precisely, so the base case corresponds to a degenerate -gon (a single edge counted once, with one "triangulation," namely the trivial one). Carefully tracking this shift — verified in the worked heptagon example, where gives — is essential to avoid an off-by-two indexing error, one of the most common mistakes when applying the Catalan formula to polygons.