core35 min studyLesson 230 in Mathematics

Lagrange inversion and tree enumeration

Extract coefficients from implicit formal equations and connect the formula to rooted plane and labeled trees.

On this page

What you’ll understand

  • State a coefficient form of formal Lagrange inversion with its hypotheses.
  • Derive an implicit generating equation from a root decomposition.
  • Distinguish plane-tree OGF counts from labeled-tree EGF counts.

Rooting a tree exposes a recursive structure: remove its root and inspect the trees hanging below it. The local rule for those children determines an implicit equation for the whole class. Solving that equation explicitly may be awkward, yet a coefficient can often be extracted directly by Lagrange inversion. The power of the formula comes with a responsibility to specify size, child order, labels, and the coefficient convention. Different choices yield different tree families even when their equations look similar.

A formal implicit equation has a recursive solution

Let Φ(u)\Phi(u) be a formal power series over the rationals with nonzero constant term. There is a unique series T(x)T(x) with zero constant term satisfying T=xΦ(T)T=x\Phi(T). The coefficient at degree n on the right uses coefficients of T only through degree n minus one, so it determines the next coefficient recursively. Zero constant term makes composition meaningful coefficientwise. No assumption that the series converges numerically near zero is needed for this formal existence and uniqueness statement.

Lagrange inversion gives a direct coefficient formula for powers of that solution. We state the version with positive integers n and k satisfying n at least k, and characteristic-zero coefficients so division by n is available. The formula is a theorem of formal power-series algebra, not a claim that repeated numerical substitution converges. Analytic inversion is a related theory with additional domain and regularity hypotheses. Here it is the finite coefficient calculation that extracts exact counts.

T=xΦ(T),T(0)=0⟹[xn]T(x)k=kn[un−k]Φ(u)n(n≥k≥1)T=x\Phi(T),\quad T(0)=0\quad\Longrightarrow\quad [x^n]T(x)^k=\frac{k}{n}[u^{n-k}]\Phi(u)^n\qquad(n\ge k\ge1)
This formal Lagrange-inversion formula is stated over the rationals with Φ(0)≠0. Coefficients on the right are finite algebraic data at the specified degree.↔ Scroll wide equations horizontally.

A root with an ordered list of children

A rooted plane tree has a root and an ordered list of children at every vertex. Size counts all vertices. Removing the root leaves a sequence of smaller rooted plane trees, including the empty sequence when the root is a leaf. The root contributes one factor of the size marker, while the sequence contributes a geometric formal series. This yields the implicit equation with child series one divided by one minus T. The ordering distinguishes two children of different shapes when swapped.

Taking the first-power case of Lagrange inversion gives a binomial coefficient divided by the vertex count. It agrees with the shifted Catalan formula: a tree with n vertices has n minus one edges. The division is justified by the inversion theorem; a combinatorial proof can also use cyclic rotations of degree sequences with an admissible-prefix condition. Simply dividing all degree sequences by n without that argument would be unsafe, since symmetry quotients in general need not have constant fiber sizes.

T=x1−T,[xn]T=1n[un−1](1−u)−n=1n(2n−2n−1)=Cn−1(n≥1)T=\frac{x}{1-T},\qquad [x^n]T=\frac1n[u^{n-1}](1-u)^{-n}=\frac1n\binom{2n-2}{n-1}=C_{n-1}\quad(n\ge1)
The coefficient counts rooted plane trees by all vertices. It is shifted from the Catalan count by internal vertices of full binary trees.↔ Scroll wide equations horizontally.

Changing local rules changes the enumeration

If each vertex has three distinguished child slots, each empty or occupied by a subtree, the local factor is (1+T)3(1+T)^3. This counts a different plane family from an arbitrary ordered list. Lagrange inversion then extracts the coefficient of degree n minus one in (1+u)3n(1+u)^{3n}. Slots remain distinguished even when some are empty, so a sole left child differs from a sole middle child. An ordinary unlabeled rooted tree with unordered children has neither of these simple local descriptions.

For rooted trees on distinct labels with unordered children, use an EGF instead. The children are a set of nonempty labeled rooted trees, yielding R=xeRR=xe^R. Inversion gives the normalized coefficient nn−1/n!n^{n-1}/n!; multiplying by n factorial recovers the number of rooted labeled trees. This example highlights why identical-looking formal coefficient operations can encode different counts. The equation must come from a justified class construction, and the final coefficient must be interpreted in its original OGF or EGF convention.

R=xeR,n![xn]R=n!n[un−1]enu=nn−1(n≥1)R=xe^R,\qquad n![x^n]R=\frac{n!}{n}[u^{n-1}]e^{nu}=n^{n-1}\quad(n\ge1)
R is an exponential generating function for rooted labeled trees; n! converts its coefficient into the count on a fixed n-element label set.↔ Scroll wide equations horizontally.

Five-vertex rooted plane trees

Count rooted plane trees with five vertices and verify the result using the tree's Catalan connection.

  1. The root-decomposition equation is T=x/(1−T), with T(0)=0, because the children form an ordered sequence of subtrees.

  2. Apply inversion with n=5 and k=1: the coefficient is one fifth of [u⁴](1−u)⁻⁵. The negative-binomial expansion gives binom(8,4)=70 for that coefficient.

  3. Divide by five to obtain fourteen. A rooted plane tree with five vertices has four edges, and its contour walk gives a Dyck path of semilength four; the earlier Catalan count C₄=14 checks the result.

[x5]T(x)=15(84)=14[x^5]T(x)=\frac15\binom84=14
The coefficient extraction uses total vertices, not edges, and does not attach distinct vertex labels.↔ Scroll wide equations horizontally.
The result

There are fourteen rooted plane trees of total vertex size five. No factor of 5! is inserted because this is an ordinary generating function for plane shapes.

Explore the model

Interactive lab

Interactive lab · modular

Candidate roots in a cyclic degree code

Pause and Reset, then set m=5 and a=1. Step through the five possible starting positions of the degree code (2,0,1,1,0). At each start, rotate the code on paper, subtract one from each entry, and predict whether every proper prefix sum is nonnegative and the total is −1.

Candidate roots in a cyclic degree codeAddition modulo m starts at zero: rₙ = na mod m. Playback advances two additions per second. The orbit has period m/gcd(m,a), including period one for a = 0. This is not a cryptographic security test or a primality algorithm. Current readings: Residue r0: 0; Orbit period · m/gcd(m,a): 12; Distinct residues visited: 1 of 12. All parameters are adjustable with the labeled controls below.Repeated addition modulo 12: the current residue is 0, and the orbit period is 12.01234567891011+ 5mod 12An additive orbitn = 0rₙ = 0Period = 12Cycle starts at 0:0 → 5 → 10 → 3 →8 → 1 → 6 → 11 →4 → 9 → 2 → 7 → 0Exact residues · two additions per second
Additive orbitCurrent residue / next edge
Residue r0
0
Orbit period · m/gcd(m,a)
12
Distinct residues visited
1 of 12
t = 0 s

Addition modulo m starts at zero: rₙ = na mod m. Playback advances two additions per second. The orbit has period m/gcd(m,a), including period one for a = 0. This is not a cryptographic security test or a primality algorithm. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forOnly the original start passes for this code: its increments are (1,−1,0,0,−1). The modular diagram indexes rotations; it does not test prefixes or prove the cycle lemma or Lagrange inversion.

Check your understanding

In the equation R=xeᴿ for rooted labeled trees, what does n![xⁿ]R represent?

Try it yourself

Let T=x(1+T)³ describe rooted trees with three distinguished optional child slots per vertex. Count structures with three vertices and check the result directly by their shapes.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Extract [u²](1+u)⁹ and divide by three. Directly separate a chain from a root with two children.

Compare with the solution

Lagrange inversion gives [x³]T=(1/3)binom(9,2)=36/3=12. A three-vertex chain has three choices of the root's occupied slot and three choices of the next vertex's occupied slot, giving nine. A root with two leaf children has binom(3,2)=3 choices of occupied slots. These cases are disjoint and exhaustive, giving nine plus three equals twelve.

Take it with you

  • Lagrange inversion extracts coefficients from a formally justified implicit equation.
  • The root's child structure determines Φ and the meaning of the tree count.
  • EGF coefficients require factorial conversion; OGF coefficients already store their counts.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.