A polynomial that counts
Worth reading first: One sequence, counting everything · A diagram turned on its side.
A counting problem produces a sequence: one answer for each size. The sequence is the thing wanted, and it is also, usually, the thing that is hard to get hold of, because the answers are related to each other in ways that a list of numbers hides.
The device is to stop treating the answers as a list and start treating them as the coefficients of a polynomial — or of an infinite series, when there are infinitely many. Then the two operations that combinatorics is made of become operations on polynomials, and a problem about counting becomes a problem about algebra, where there are techniques.
Why multiplication is the right operation
Suppose a choice is made from box one and a choice from box two, and the total is recorded. Write each box as a polynomial: a term for each value the box offers, with a coefficient counting how many ways that value can be chosen. Then the number of ways of reaching a total of from the two boxes together is the coefficient of in the product.
The reason is a single line: multiplying out picks one term from each factor and adds the exponents, which is exactly the operation of choosing one value from each box and adding. Nothing has been assumed about what the boxes contain.
The rule that comes out of that picture has a name — the coefficients of a product are the convolution of the coefficients of the factors,
— and the name matters because the same sum turns up wherever independent things are combined. It is how the distribution of a sum of independent draws is built from the distribution of one, and it is why that construction and this one produce identical arithmetic on different objects.
Addition, meanwhile, is the or of the two operations: if a thing is either of the first kind or of the second, and the kinds do not overlap, the counts add and so do the series. Between them, addition and multiplication cover the two ways a combinatorial description usually reads, which is why so many descriptions translate directly into an expression.
A recursion becomes an equation
The tactic pays best where a sequence is defined by a rule referring to itself, because a self-referential rule becomes an equation in one unknown.
Count the tilings of a strip by squares and dominoes. The first tile is a square, leaving a strip of , or a domino, leaving ; so with . Now let and multiply the recursion by and sum. Every term is a shifted copy of , and the whole thing collapses to
The sequence is now a single rational function, and its coefficients can be recovered by expanding it — by long division, by partial fractions, or by reading off the recursion again.
Every figure in this family computes each coefficient twice: once by the series arithmetic the argument is about, and once by enumerating the objects the coefficient claims to count. A generating function is a bookkeeping device, and bookkeeping is exactly the kind of thing that can be internally consistent and wrong; listing the tilings is the check that the books describe the world.
What has been gained is not the numbers, which the recursion already gave. It is the closed form. Partial fractions on gives the golden ratio and its conjugate as the poles, and hence Binet’s formula for the Fibonacci numbers — an exact expression for the $n$th term with no earlier terms in it. The position of the poles is the growth rate, and that is the general lesson: the singularity nearest the origin governs how fast the coefficients grow, so a question about asymptotics becomes a question about where a function blows up.
A quadratic, and the numbers that solve it
Some recursions are not linear, and the method survives.
A balanced path of up-steps and down-steps that never dips below its start decomposes at the moment it first returns to the start: an up-step, a smaller such path, a down-step, and another such path. In series form that description is , where the pays for the pair of steps and the two copies of are the two smaller paths.
That is a quadratic, and it can be solved:
the negative root being rejected because must be . Expanding the square root by the binomial series gives the coefficients in closed form,
which is the Catalan number. The route from a description of the objects to a formula for how many there are went through algebra and never through a bijection — which is worth pausing on, because a bijective proof of the same formula exists and is beautiful and took considerably longer to find.
Two remarks on what “solve” means here. The square root is being expanded as a formal series, and no value of is ever substituted; the manipulation is legitimate because every coefficient of the result is determined by finitely many coefficients of the input. And the quadratic formula is being applied to an equation whose unknown is a series rather than a number, which needs the same justification and gets it the same way.
Products, not just powers
The third standard shape is an infinite product, and the example is the oldest one in the subject.
To count the ways of writing as a sum of whole numbers with order disregarded, decide separately how many 1s to use, how many 2s, how many 3s. Using copies of the part contributes to the total, so the decisions about part are the series , and the whole count is
Each coefficient is a finite computation despite the product being infinite, because factors with contribute nothing to the coefficient of .
The product form is where generating functions stop being bookkeeping and start proving things. Restrict the parts to odd numbers and the product becomes ; restrict them to distinct parts and it becomes . Those two look unrelated. But , and substituting turns the second product into a telescoping cancellation that leaves exactly the first. So the partitions of into odd parts and the partitions of into distinct parts are equinumerous — Euler’s theorem, proved by an algebraic identity with no bijection in sight, though a diagram turned on its side supplies one for a different partition identity.
What the variable is not
The variable is never given a value. That is not an oversight; it is the definition. A generating function is a formal power series: an infinite sequence of coefficients written with as punctuation, with addition and multiplication defined by the rules above and no notion of substituting a number.
This matters for two reasons. First, series that converge nowhere are perfectly good — has radius of convergence zero and manipulates exactly as well as any other. Second, and more subtly, it means the manipulations need justifying on their own terms rather than by analysis. Multiplying two series is legitimate because each coefficient of the product is a finite sum; inverting a series is legitimate when its constant term is invertible, because the coefficients can then be solved for one at a time; substituting one series into another needs the inner one to have zero constant term, or the constant term of the result is an infinite sum and undefined.
When the series does converge, an extra tool becomes available and it is the powerful one: the analytic behaviour of the function controls the growth of the coefficients. The nearest singularity gives the exponential growth rate, and its type gives the polynomial correction. That is how one learns that the Catalan numbers grow like — from the square-root branch point at , not from the binomial coefficient. But nothing about the identities requires convergence, and keeping the two levels separate is what keeps the subject honest.
What the coefficients grow like
One more thing falls out of the closed form, and it is the thing a list of numbers never gives: how fast the sequence grows.
For the tiling sequence, has two poles, at the roots of , which are and where is the golden ratio. Partial fractions splits the function into two pieces, each a geometric series, and the coefficients come out as
The second term is smaller than a half for every , so is the nearest whole number to — an exact formula and a growth rate in one line, from a factorisation of a quadratic.
The general statement behind that computation is worth stating even though nothing here proves it. The coefficients of a series grow like , where is the distance from the origin to the nearest point at which the function stops being well behaved, and the correction to that exponential is decided by what kind of misbehaviour it is: a simple pole gives a constant, a square root gives a factor of , a logarithm gives . The Catalan numbers grow like for exactly that reason, and the is the reciprocal of the at which turns.
Where it came from
The device is Euler’s, in the 1740s, and he used it for exactly the problem above: counting partitions. Before him, de Moivre had used series to solve linear recurrences in work on probability, and Laplace later turned the same construction into the transform that carries his name — the continuous version, where a sum over becomes an integral and becomes .
The nineteenth century added the analytic half, and the twentieth turned the whole thing into a systematic translation. The modern view is that a description of a class of objects — a tree is a root with a set of trees hanging from it, a permutation is a set of cycles — translates directly into an equation between series, without ever writing a recursion. The dictionary has entries for sequence, set, cycle and substitution, and it comes in two flavours: the ordinary one used here, and the exponential one, in which the coefficient of is divided by and which is the right dictionary for labelled objects. Counting labelled trees is a problem for the exponential version.
Where it fails, and what it costs
Not every sequence has a usable generating function. Every sequence has one, trivially; the question is whether it satisfies an equation simpler than the sequence itself. The number of partitions has a product but no rational or algebraic generating function; the primes have neither. When the series is no simpler than the list, nothing has been gained.
The translation can be harder than the counting. Setting up the equation requires a decomposition of the objects that is exhaustive and non-overlapping, and getting that wrong produces a series that counts something else. The check against enumeration in the figures here exists for exactly this failure, and it is the failure a beginner meets first: a decomposition that double-counts by one case.
Extracting coefficients is a second problem. A closed form for the generating function is not a closed form for the numbers. Sometimes the extraction is a binomial expansion; often it needs partial fractions, Lagrange inversion or a contour integral, and sometimes only the asymptotics are available.
What the pictures cannot show
The figures show finitely many coefficients, and a generating function is an infinite object. Agreement of the first nine terms is evidence and not proof, and the proof is always the decomposition argument — which is prose, not a picture. Where the figure is genuinely doing the work is in the second row: those numbers come from listing tilings, paths and partitions, so what is checked is that the algebra describes the objects, at the sizes drawn.
Nor can a picture show the analytic half. The claim that the coefficients of grow like the golden ratio to the is a statement about the poles of a function of a complex variable, and the drawn coefficient rows do not contain it — the growth is visible in them, but the reason sits in a plane the figures here never enter.
The ladder from here
Below: Catalan numbers, whose quadratic is the worked example above, and Pascal’s triangle, whose rows are the coefficients of and whose recursion is the simplest instance of the whole method. Sideways: partitions and their diagrams, where the same identities are proved by folding a picture instead, and the distribution of a sum, which is convolution again with probabilities in place of counts. Above: the analytic theory, where the location of a singularity is read as a growth rate.
What is worth carrying away
The move being made here is one of the most transferable in mathematics: encode a family of objects as a single algebraic thing, so that the operations on the family become operations on the thing.
It works because the encoding is faithful in one direction — the series determines the sequence — and because the operations chosen, addition and multiplication, are exactly the ones the combinatorics already uses. When a description reads this or that and this and that, the translation writes itself, and the resulting equation can be attacked with tools that know nothing about tilings or paths. That is the whole trick, and everything else in the subject is a matter of building a better dictionary.
Named objects
A dashed tag is an object no other essay names yet.
Binomial coefficientCatalan numbersConvolutionCounting two waysFormal power seriesGenerating functionPartitionRecurrence relation