Folioby Interconnected
Log InSign Up

Generating Functions II (Exponential): Counting Labeled Structures

We introduce exponential generating functions (EGFs) and show that their product corresponds to labeled merging. We then derive the EGFs for Stirling numbers and Bell numbers, and prove Cayley's formula for labeled trees.

FO
Folio Official
March 1, 2026

1 Definition of Exponential Generating Functions

Definition 1 (Exponential generating function).
Given a sequence (an​)n≥0​, the formal power series
A^(x)=n=0∑∞​an​n!xn​
is called the exponential generating function (EGF) of (an​).
Remark 2.
While OGFs are naturally suited to counting unlabeled structures, EGFs are tailored to counting labeled structures. The crucial difference manifests in the interpretation of the product.
Example 3.
The EGF of an​=1 (n≥0) is ∑n≥0​xn/n!=ex. The EGF of an​=n! (the number of permutations) is ∑n≥0​xn=1/(1−x).

2 Products and Labeled Merging

Theorem 4 (Product interpretation for EGFs).
Let A^(x) and B^(x) be the EGFs of sequences (an​) and (bn​), respectively. The coefficient cn​ of the product C^(x)=A^(x)B^(x) is given by
cn​=k=0∑n​(kn​)ak​bn−k​.
Proof.
A^(x)B^(x)=n=0∑∞​(k=0∑n​k!ak​​⋅(n−k)!bn−k​​)xn=n=0∑∞​n!1​(k=0∑n​(kn​)ak​bn−k​)1xn​
Collecting terms in xn/n! gives cn​=∑k=0n​(kn​)ak​bn−k​. □
Remark 5.
The appearance of the binomial coefficient (kn​) reflects the operation of splitting n labels into two groups — one of size k bearing ak​ structures and one of size n−k bearing bn−k​ structures. This is the combinatorial meaning of "labeled merging."

3 Stirling Numbers of the First Kind

Definition 6 (Stirling number of the first kind).
The number of ways to decompose a permutation of n elements into exactly k disjoint cycles is called the unsigned Stirling number of the first kind, denoted c(n,k) or [kn​]. The signed Stirling number of the first kind is s(n,k)=(−1)n−kc(n,k).
Theorem 7.
k=0∑n​c(n,k)xk=x(x+1)(x+2)⋯(x+n−1)=x(n)
where x(n) denotes the rising factorial.
Proof.
We proceed by induction on n. When n=0, both sides equal 1 (the empty product). From the identity x(n)=x(n−1)(x+n−1), we obtain the recurrence c(n,k)=c(n−1,k−1)+(n−1)c(n−1,k). Combinatorially, this corresponds to the following dichotomy for the element n: either n forms a new cycle by itself (contributing c(n−1,k−1)) or n is inserted into one of the n−1 possible positions within an existing cycle (contributing (n−1)c(n−1,k)). □

4 EGF for Stirling Numbers of the Second Kind

Theorem 8.
The EGF for the Stirling numbers of the second kind is
n=k∑∞​S(n,k)n!xn​=k!(ex−1)k​.
Proof.
The series ex−1=∑n=1∞​xn/n! is the EGF for nonempty labeled sets. Consequently, (ex−1)k/k! is the EGF for partitions of a labeled set into k nonempty blocks (dividing by k! because the blocks are unordered). This is precisely the definition of the Stirling number of the second kind. □

5 Bell Numbers

Definition 9 (Bell number).
The total number of partitions of an n-element set is called the n-th Bell number, Bn​. That is, Bn​=∑k=0n​S(n,k).
Theorem 10.
n=0∑∞​Bn​n!xn​=eex−1
Proof.
Since Bn​=∑k​S(n,k),
n=0∑∞​Bn​n!xn​=k=0∑∞​k!(ex−1)k​=eex−1.
□

6 Cayley's Formula via Prüfer Sequences

Theorem 11 (Cayley's formula (proof via EGFs)).
The number of labeled trees on n vertices is nn−2.
Proof.
Let T(x) denote the EGF for labeled rooted trees. A rooted tree consists of a root vertex together with an unordered collection of rooted subtrees attached to it, so T(x) satisfies the functional equation T(x)=xeT(x). Applying the Lagrange inversion formula:
[xn]T(x)=n1​[yn−1]eny=n1​⋅(n−1)!nn−1​=n!nn−1​.
Hence the number of labeled rooted trees on n vertices is nn−1. Since any of the n vertices can serve as the root, the number of labeled (unrooted) trees is nn−1/n=nn−2.

An alternative, more direct proof constructs an explicit bijection between labeled trees and Prü □

The EGF technique is remarkably powerful for counting labeled structures. When combined with the Lagrange inversion formula and the compositional formula, it provides a systematic approach to deriving a wide range of combinatorial identities.

CombinatoricsDiscrete MathematicsTextbookGenerating FunctionsEGF
FO
Folio Official

Mathematics "between the lines" — exploring the intuition textbooks leave out, written in LaTeX on Folio.

1 followers·107 articles
Combinatorics TextbookPart 6 of 13
Previous
Generating Functions I (Ordinary): Encoding Sequences as Power Series
Next
Recurrence Relations and Counting: Solving Linear Recurrences

Share your expertise with the world

Write articles with LaTeX support, build your audience, and earn from your knowledge.

Start Writing — It's Free

More from Folio Official

Folio Official·March 1, 2026

Recurrence Relations and Counting: Solving Linear Recurrences

We present the method of characteristic equations for solving linear recurrences with constant coefficients, treat the case of repeated roots, discuss nonhomogeneous recurrences, establish the equivalence with generating functions, and introduce matrix exponentiation and the Kitamasa method.

CombinatoricsDiscrete MathematicsTextbook
Folio Official·March 1, 2026

The Inclusion--Exclusion Principle: Counting by Alternating Sums

We prove the inclusion--exclusion principle and apply it to derive the formula for the number of derangements D_n, Euler's totient function, the relationship between surjections and Stirling numbers of the second kind, and the M\"{o}bius inversion formula.

CombinatoricsDiscrete MathematicsTextbook
Folio Official·March 1, 2026

Combinatorial Designs and Latin Squares: Balanced Arrangements

We define Latin squares and prove their existence, introduce mutually orthogonal Latin squares (MOLS), develop the theory of balanced incomplete block designs (BIBDs), prove Fisher's inequality, and discuss the connection with finite projective planes.

CombinatoricsDiscrete MathematicsTextbook
Folio Official·March 1, 2026

Burnside's Lemma and P\'olya Enumeration: Counting Under Symmetry

Starting from the definitions of group actions, orbits, and stabilizers, we prove Burnside's lemma (the Cauchy--Frobenius theorem), introduce the cycle index of a permutation group, and derive P\'olya's enumeration theorem. Applications to necklace and bracelet counting are given.

CombinatoricsDiscrete MathematicsTextbook