"A good stock of examples, as large as possible, is indispensable for a thorough understanding of any concept, and when I want to learn something new, I make it my first job to build one." – Paul Halmos

The Catalan numbers, regular languages, and orthogonal polynomials

I’ve been inspired by The Unapologetic Mathematician (and his pages and pages of archives!) to post more often, at least for the remainder of the summer. So here is a circle of ideas I’ve been playing with for some time.

Let be the ordinary generating function for the ordered rooted trees on vertices (essentially we ignore the root as a vertex). This is one of the familiar definitions of the Catalan numbers. From a species perspective, ordered rooted trees are defined by the functional equation

.

The generating function describes the species of sequences. So what this definition means is that, after tossing out the root, an ordered rooted tree is equivalent to a sequence of ordered rooted trees (counting their roots) in the obvious way; the roots of these trees are precisely the neighbors of the original root. Multiplying out gets us a quadratic equation we can use to find the usual closed form of , but we can instead recursively apply the above to obtain the beautiful continued fraction

.

Today’s discussion will center around this identity and some of its consequences.

This identity is not too surprising from the perspective of continued fractions of surds: any root of a quadratic equation can be described as the fixed point of a fractional linear transformation, which gives rise to a continued fraction representation. It only makes sense that the Catalan generating function, which is the “positive” root of

(and note that this gives a different combinatorial interpretation of the Catalan numbers, this time as binary trees), can be represented in this form.

What’s surprising is that this change in perspective has a combinatorial interpretation. Now, motivated by the usual theory of continued fractions we might like to talk about convergents to this continued fraction. To that end, we’ll define

(Both the choice of letter and the choice of indexing will be explained later.) This gives us an interesting sequence of rational functions that “approximate” the Catalan numbers in some sense. In fact, there’s a pretty clear combinatorial interpretation: is the generating function of a certain regular language that can be described as counting ordered rooted trees with depth at most . As a regular language, multiplication by corresponds to appending a new extra character to the beginning of every word in a language, and substitution into the sequence species corresponds to what computer scientists call the Kleene star operator. I don’t know of a particularly good notation for writing down all of these regular languages at once, but, for example, the language corresponding to consists of repeating blocks of the form ; in other words, consists of the set of words on two letters that are either empty or start with , which has generating function

.

The bijection to ordered rooted trees of depth at most three should be clear: the vertices adjacent to the root can be labeled with a’s and the vertices adjacent to those vertices can be labeled with b’s, and one reads a tree using a depth-first search, reading each non-root vertex once. Note that by construction agrees with to terms. More interesting is the next convergent,

,

which you might recognize as the even Fibonacci numbers. The corresponding regular language is a certain language on three letters, and the bijection to the usual definition on the Fibonacci numbers is an interesting combinatorial exercise.

Let’s try to generalize and figure out where these numerators and denominators are coming from. Let’s guess that we have

for some sequence of polynomials beginning , which therefore satisfies

giving us the identity . Funnily enough, when we obtain the Fibonacci numbers, and the Catalan generating function evaluates to the golden ratio. There appears to be something deeper here involving what I’ll refer to as “generalized cardinality”; see, for example, The Everything Seminar regarding the case.

But we’ll try something else instead. The coefficients of are controlled by the reciprocal of the roots of the denominator, so it’ll be more useful to consider a slightly different set of polynomials. To figure out exactly what we’ll need to do, however, note that is a polynomial of degree , and we’d really prefer to work with polynomials of degree . Moreover, the even Fibonacci numbers remind us that the Catalan numbers, as Dyck words, can also count objects of “size” , rather than . So we should really be looking at and modifying our other computations accordingly. We’ll also instead try to look at polynomials of degree instead, which requires adding a few extra factors. To make a long story short, what we want are the polynomials

given by and satisfying the new, but closely related, recurrence relation

.

Now, just like we would do for the Fibonacci numbers, let’s construct the new generating function

where the closed form is a consequence of the recurrence relation and the first few terms. Those of you familiar with special functions might recognize this as the generating function for the Chebyshev polynomials of the second kind (up to a factor of two)! As we’ve constructed them, these polynomials satisfy

and it follows that their roots are the numbers . This is great; for , for example, this gives the identity

familiar from the algebraic proof of the constructibility of the regular pentagon. It also implies that the growth rate of is controlled by the largest root of ; more precisely, we have

.

This is in some sense an approximation of the growth rate of the Catalan numbers. We can say something more precise, but first, there’s another way to think about the Chebyshev polynomials. I claim that the determinant identity

holds. This is a corollary of a more general result about continued fractions that I have never seen actually written down anywhere, but for our purposes a different interpretation will be more useful: what this says is that is the characteristic polynomial of the adjacency matrix of the path graph on vertices. And now we come full circle.

Proposition: The number of closed paths from one end to itself of length on the path graph on vertices is .

This implies a bijection between such paths and rooted ordered trees that will get us right back where we started, but I’d like to give the algebraic proof first. Let denote the adjacency matrix of the path graph on vertices (which you can read off from the determinant I wrote down earlier). Then the generating function

(which is matrix-valued) gives us the number of paths between any two vertices of any length. We want to compute the top-left entry of this matrix, but by the construction of the adjugate matrix this is equal to

where is the minor formed by deleting the first row and column. But this is just . Moreover, these determinants are essentially the polynomials , but with the reciprocal roots as expected, so the result follows.

This strongly suggests that there should be a combinatorial proof, and we should’ve suspected this all along. One way to define the Catalan numbers is as the number of closed walks from one end of the “infinite path graph” to itself, so we should expect that restricting walks corresponds in some way to restricting trees. In fact, there’s an even more general reason we should expect this: it’s well-known that regular languages correspond to languages recognized by finite automata. So let’s think like a finite automaton: how do you verify that a given ordered rooted tree has depth at most ?

Just as before, the answer is to perform a depth-first search. At each step, the state of our automaton will be the current level of the search, and the transitions between each state are precisely the edges of the path graph. The ordered rooted trees of depth are precisely those recognized by the finite automaton built from a path graph with vertices, and we get a bijection between such trees and the closed paths from the starting state to itself. (Note that there are two transitions for each non-root vertex: one the first time we encounter it going down, and one the second time we encounter it going up.) Of course, it is also possible to describe this algorithm in terms of recognizing the corresponding regular language.

Finite automata and regular languages are two of the most general ways to understand rational generating functions. While the regular language interpretation makes it particularly easy to write down a generating function that takes the form of a continued fraction, the finite automaton interpretation lets us use the tools of linear algebra, as we have seen. Let’s use another such tool: eigenvectors. Since is symmetric, its eigenvectors form an orthonormal basis. In fact, they are given (up to scaling) by

.

I don’t know of a particularly nice proof of this; the computation makes use of the product-to-sum formula. There’s a curious analogy to the harmonics of a closed tube and the Fourier sine basis that I don’t understand very well. I have a slightly slicker proof of the appropriate scale factor: the length of any of these eigenvectors is

The corresponding sum for the cosine is easy to read off using eigenvalues: the number of closed walks of length two on any undirected graph is twice the number of edges, giving the identity

which implies that the sum for the sine we want evaluates to . Now we’ve got an orthonormal basis of eigenvectors, and from here (I’ll spare you the details) we can compute that the number of closed walks of length from one end of the path graph to itself is

.

If , this number agrees with the corresponding Catalan number. Taking the limit as and interpreting the LHS as a Riemann sum, we obtain the integral identity

Now, we want to think of as a sort of Borel measure on . The orthogonality of the Fourier sine basis on this space can be rephrased in terms of the identity

.

You can probably see where I’m going with this. Letting , this is equivalent to the identity

.

The Chebyshev polynomials have reappeared! Apparently the connection between continued fractions of power series and orthogonal polynomials is well-known and quite deep, but I have to admit it’s got me mystified. Part of the connection involves defining the linear functional

.

The Chebyshev polynomials are orthogonal with respect to the inner product , and we call the sequence the sequence of moments associated to . Now, we’ve just shown that this sequence of moments alternates between zero and the Catalan numbers; as the Secret Blogging Seminar mentions, this sequence also occurs when one computes the expected values of powers of the trace of a random element of distributed according to Haar measure, so the structure of presumably reflects this connection (although I’m clueless on this matter).

There’s a very interesting circle of ideas going on here, but I’m afraid I’ll have to end without closing it fully: according to a marvelous paper by Krattenthaler, I believe that the continued fraction identity

but the result that Krattenthaler quotes implies that the entries of the matrix should be , and I haven’t quite figured out what’s going on because it seems as if this is the wrong indexing; without the factor of two, there’s a beautiful proof of this identity using the Gessel-Viennot lemma which I may discuss in a later post.

Questions

How does the above circle of ideas fit together? How does it generalize? (For example, there is an analogue of some of the above for the central binomial coefficients where we replace path graphs with cycle graphs; I believe we get the Chebyshev polynomials of the first kind this way, and a relationship to traces in .)

Is there an algorithm that, given a rational function built from a regular language, gives its “decomposition” into products, disjoint unions, and Kleene stars, or recognizes when such a decomposition does not exist? I haven’t given it much thought, but I don’t think there’s a straightforward analogue of the standard algorithm for computing the continued fraction of a rational number. This is related to my earlier question about automata, which I’ll pose in this alternate form: does there exist a rational function whose Taylor coefficients are all non-negative integers which is not generated from the functions by addition, multiplication, and composition?

What’s the connection between the Catalan numbers and the golden ratio? I have an idea about this due to an exam problem set by my professor last semester, Gregg Musiker. Define a sequence of posets as follows: its elements are the subsets of such that

are odd positive integers, and the order relation is subset. is graded of rank , and a standard result about Fibonacci numbers shows that the total number of its elements is given by

(where each term describes a rank.) Here’s the connection: the Mobius function of this poset is (another good combinatorial exercise; I don’t know of a way to deduce this from first principles), and the values of the Mobius function of a poset are related to the Euler characteristic (which is related to generalized cardinality) of a certain topological space associated to the poset, although I don’t understand this connection very well. Stanley and Rota are (two of) the authorities in this regard. So it seems as if the “limit” of these posets should correspond to a space with “generalized cardinality” related to .

Differentiate the generating function in Theorem 2.1 here. The argument is quite standard.

You should be aware that there exist software packages that have gotten very good at dealing with hypergeometric identities and I am certain that one or more of them could write down the generating function automatically given a description of its coefficients.

Hi. The number is the sum of the series of the reciprocals Catalan number, but in trying to demonstrate we begin to enter in desperado mood, so we would be very thankful any clue. Greets! above there’s a very good article.