Recursive integer sequence
The Catalan numbers are a sequence of natural numbers that occur in various counting problems, often involving recursively defined objects. They are named after Eugène Catalan, though they were previously discovered in the 1730s by Minggatu.
The n-th Catalan number can be expressed directly in terms of the central binomial coefficients by
formula_1
The first Catalan numbers for "n" = 0, 1, 2, 3, ... are
1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, ... (sequence in the OEIS).
Properties.
An alternative expression for "C""n" is
formula_2 for formula_3
which is equivalent to the expression given above because formula_4. This expression shows that "C""n" is an integer, which is not immediately obvious from the first formula given. This expression forms the basis for a proof of the correctness of the formula.
Another alternative expression is
formula_5
which can be directly interpreted in terms of the cycle lemma; see below.
The Catalan numbers satisfy the recurrence relations
formula_6
and
formula_7
Asymptotically, the Catalan numbers grow as
formula_8
in the sense that the quotient of the n-th Catalan number and the expression on the right tends towards 1 as n approaches infinity.
This can be proved by using the asymptotic growth of the central binomial coefficients, by Stirling's approximation for formula_9, or via generating functions.
The only Catalan numbers "C""n" that are odd are those for which "n" = 2"k" − 1; all others are even. The only prime Catalan numbers are "C"2 = 2 and "C"3 = 5. More generally, the multiplicity with which a prime p divides "C""n" can be determined by first expressing "n" + 1 in base p. For "p" = 2, the multiplicity is the number of 1 bits, minus 1. For p an odd prime, count all digits greater than ("p" + 1) / 2; also count digits equal to ("p" + 1) / 2 unless final; and count digits equal to ("p" − 1) / 2 if not final and the next digit is counted. The only known odd Catalan numbers that do not have last digit 5 are "C"0 = 1, "C"1 = 1, "C"7 = 429, "C"31, "C"127 and "C"255. The odd Catalan numbers, "C""n" for "n" = 2"k" − 1, do not have last digit 5 if "n" + 1 has a base 5 representation containing 0, 1 and 2 only, except in the least significant place, which could also be a 3.
The Catalan numbers have the integral representations
formula_10
which immediately yields formula_11.
This has a simple probabilistic interpretation. Consider a random walk on the integer line, starting at 0. Let -1 be a "trap" state, such that if the walker arrives at -1, it will remain there. The walker can arrive at the trap state at times 1, 3, 5, 7..., and the number of ways the walker can arrive at the trap state at time formula_12 is formula_13. Since the 1D random walk is recurrent, the probability that the walker eventually arrives at -1 is formula_14.
Applications in combinatorics.
There are many counting problems in combinatorics whose solution is given by the Catalan numbers. The book "Enumerative Combinatorics: Volume 2" by combinatorialist Richard P. Stanley contains a set of exercises which describe 66 different interpretations of the Catalan numbers. Following are some examples, with illustrations of the cases "C"3 = 5 and "C"4 = 14.
 XY
 XXYY     XYXY
 XXXYYY     XYXXYY     XYXYXY     XXYYXY     XXYXYY
The following diagrams show the case "n" = 4:
This can be represented by listing the Catalan elements by column height:
 [0,0,0,0] [0,0,0,1] [0,0,0,2] [0,0,1,1]
 [0,1,1,1] [0,0,1,2] [0,0,0,3] [0,1,1,2] [0,0,2,2] [0,0,1,3]
 [0,0,2,3] [0,1,1,3] [0,1,2,2] [0,1,2,3]
Proof of the formula.
There are several ways of explaining why the formula
formula_23
solves the combinatorial problems listed above. The first proof below uses a generating function. The other proofs are examples of bijective proofs; they involve literally counting a collection of some kind of object to arrive at the correct formula.
First proof.
We first observe that all of the combinatorial problems listed above satisfy Segner's recurrence relation
formula_24
For example, every Dyck word w of length ≥ 2 can be written in a unique way in the form
"w" = X"w"1Y"w"2
with (possibly empty) Dyck words "w"1 and "w"2.
The generating function for the Catalan numbers is defined by
formula_25
The recurrence relation given above can then be summarized in generating function form by the relation
formula_26
in other words, this equation follows from the recurrence relation by expanding both sides into power series. On the one hand, the recurrence relation uniquely determines the Catalan numbers; on the other hand, interpreting "xc"2 − "c" + 1 = 0 as a quadratic equation of c and using the quadratic formula, the generating function relation can be algebraically solved to yield two solution possibilities
formula_27  or  formula_28.
From the two possibilities, the second must be chosen because only the second gives
formula_29.
The square root term can be expanded as a power series using the binomial series
formula_30
Thus,
formula_31
Second proof.
We count the number of paths which start and end on the diagonal of an "n" × "n" grid. All such paths have n right and n up steps. Since we can choose which of the 2"n" steps are up or right, there are in total formula_32 monotonic paths of this type. A "bad" path crosses the main diagonal and touches the next higher diagonal (red in the illustration).
The part of the path after the higher diagonal is then flipped about that diagonal, as illustrated with the red dotted line. This swaps all the right steps to up steps and vice versa. In the section of the path that is not reflected, there is one more up step than right steps, so therefore the remaining section of the bad path has one more right step than up steps. When this portion of the path is reflected, it will have one more up step than right steps.
Since there are still 2"n" steps, there are now "n" + 1 up steps and "n" − 1 right steps. So, instead of reaching ("n", "n"), all bad paths after reflection end at ("n" − 1, "n" + 1). Because every monotonic path in the ("n" − 1) × ("n" + 1) grid meets the higher diagonal, and because the reflection process is reversible, the reflection is therefore a bijection between bad paths in the original grid and monotonic paths in the new grid.
The number of bad paths is therefore:
formula_33
and the number of Catalan paths (i.e. good paths) is obtained by removing the number of bad paths from the total number of monotonic paths of the original grid,
formula_34
In terms of Dyck words, we start with a (non-Dyck) sequence of n X's and n Y's and interchange all X's and Y's after the first Y that violates the Dyck condition. After this Y, note that there is exactly one more Y than there are Xs.
Third proof.
This bijective proof provides a natural explanation for the term "n" + 1 appearing in the denominator of the formula for "C""n". A generalized version of this proof can be found in a paper of Rukavicka Josef (2011).
Given a monotonic path, the exceedance of the path is defined to be the number of vertical edges above the diagonal. For example, in Figure 2, the edges above the diagonal are marked in red, so the exceedance of this path is 5.
Given a monotonic path whose exceedance is not zero, we apply the following algorithm to construct a new path whose exceedance is 1 less than the one we started with.
In Figure 3, the black dot indicates the point where the path first crosses the diagonal. The black edge is X, and we place the last lattice point of the red portion in the top-right corner, and the first lattice point of the green portion in the bottom-left corner, and place X accordingly, to make a new path, shown in the second diagram.
The exceedance has dropped from 3 to 2. In fact, the algorithm causes the exceedance to decrease by 1 for any path that we feed it, because the first vertical step starting on the diagonal (at the point marked with a black dot) is the only vertical edge that changes from being above the diagonal to being below it when we apply the algorithm - all the other vertical edges stay on the same side of the diagonal.
It can be seen that this process is "reversible": given any path P whose exceedance is less than n, there is exactly one path which yields P when the algorithm is applied to it. Indeed, the (black) edge X, which originally was the first horizontal step ending on the diagonal, has become the "last" horizontal step "starting" on the diagonal. Alternatively, reverse the original algorithm to look for the first edge that passes "below" the diagonal.
This implies that the number of paths of exceedance n is equal to the number of paths of exceedance "n" − 1, which is equal to the number of paths of exceedance "n" − 2, and so on, down to zero. In other words, we have split up the set of "all" monotonic paths into "n" + 1 equally sized classes, corresponding to the possible exceedances between 0 and n. Since there are formula_35 monotonic paths, we obtain the desired formula formula_36
Figure 4 illustrates the situation for "n" = 3. Each of the 20 possible monotonic paths appears somewhere in the table. The first column shows all paths of exceedance three, which lie entirely above the diagonal. The columns to the right show the result of successive applications of the algorithm, with the exceedance decreasing one unit at a time. There are five rows, that is "C"3 = 5, and the last column displays all paths no higher than the diagonal.
Using Dyck words, start with a sequence from formula_37. Let formula_38 be the first X that brings an initial subsequence to equality, and configure the sequence as formula_39. The new sequence is formula_40.
Fourth proof.
This proof uses the triangulation definition of Catalan numbers to establish a relation between "C""n" and "C""n"+1.
Given a polygon P with "n" + 2 sides and a triangulation, mark one of its sides as the base, and also orient one of its 2"n" + 1 total edges. There are (4"n" + 2)"C""n" such marked triangulations for a given base.
Given a polygon Q with "n" + 3 sides and a (different) triangulation, again mark one of its sides as the base. Mark one of the sides other than the base side (and not an inner triangle edge). There are ("n" + 2)"C""n" + 1 such marked triangulations for a given base.
There is a simple bijection between these two marked triangulations: We can either collapse the triangle in Q whose side is marked (in two ways, and subtract the two that cannot collapse the base), or, in reverse, expand the oriented edge in P to a triangle and mark its new side.
Thus
formula_41.
Write formula_42
Because
formula_43
we have
formula_44
Applying the recursion with formula_45 gives the result.
Fifth proof.
This proof is based on the Dyck words interpretation of the Catalan numbers, so formula_15 is the number of ways to correctly match n pairs of brackets. We denote a (possibly empty) correct string with c and its inverse with c'. Since any c can be uniquely decomposed into formula_47, summing over the possible lengths of formula_48 immediately gives the recursive definition
formula_49.
Let b be a balanced string of length 2"n", i.e. b contains an equal number of formula_50 and formula_51, so formula_52. A balanced string can also be uniquely decomposed into either formula_53 or formula_54, so
formula_55
Any incorrect (non-Catalan) balanced string starts with formula_56, and the remaining string has one more formula_50 than formula_51, so
formula_59
Also, from the definitions, we have:
formula_60
Therefore, as this is true for all n,
formula_61
formula_62
formula_63
formula_64
Sixth proof.
This proof is based on the Dyck words interpretation of the Catalan numbers and uses the cycle lemma of Dvoretzky and Motzkin.
We call a sequence of X's and Y's "dominating" if, reading from left to right, the number of X's is always strictly greater than the number of Y's. The cycle lemma states that any sequence of formula_65 X's and formula_66 Y's, where formula_67, has precisely formula_68 dominating circular shifts. To see this, arrange the given sequence of formula_69 X's and Y's in a circle. Repeatedly removing XY pairs leaves exactly formula_68 X's. Each of these X's was the start of a dominating circular shift before anything was removed. For example, consider formula_71. This sequence is dominating, but none of its circular shifts formula_72, formula_73, formula_74 and formula_75 are.
A string is a