The exponential generating function (EGF) of a sequence is the formal power series:
Basic operations
Addition and subtraction of exponential generating functions are the same as for ordinary generating functions: add the coefficients of corresponding terms.
Consider multiplication of exponential generating functions. For two sequences , let their exponential generating functions be , respectively. Then
Therefore, is the exponential generating function of the sequence
It is therefore the exponential generating function of this sequence.
Closed forms
We likewise consider closed forms for exponential generating functions.
The exponential generating function of the sequence is
This is because the Taylor expansion of at gives exactly its power-series form.
Similarly, the exponential generating function of the geometric sequence is
Exponential and ordinary generating functions
How should we understand exponential generating functions? Define the exponential generating function of a sequence as
But is also the ordinary generating function of the sequence .
There is no contradiction between these two interpretations. In other words, different generating functions merely reflect different ways of viewing a problem.
The combinatorial meaning of polynomial exp in EGF
If you have not learned polynomial exp, skip this section for now. It develops the meaning of exp and can deepen your understanding of EGF.
In an EGF, the function contains , which is itself an EGF. First consider the product of two arbitrary EGFs:
For the product of two EGFs, the coefficient is a convolution. If we consider the product of several EGFs, is the sum of the coefficients of all cases in which one term is selected from each EGF and . From the set-theoretic perspective, this counts the ways to partition labeled elements into labeled sets.
If , the coefficient is clearly the product of the constant terms of the original EGFs. However, some requirements in polynomial force the constant term of 's to be ; the details are explained below.
In the definition of polynomial coefficients (see the combinatorial meaning of polynomial coefficients in the permutations and combinations section), sets are implicitly ordered; however, in , multiplying —that is, copies of —gives the same EGF regardless of order, while a partition of sets is clearly unordered. Therefore, its coefficient should be multiplied by .
Let be the number of ways to partition labeled elements into nonempty unordered sets (nonempty because of ), and let be the number of specific combinatorial structures on a finite set of elements (the original EGF counts structures for an -element set and depends only on the set size). Then is
Let the EGF of be , namely:
Let the EGF of be . Then
For all ,
The derivation above directly writes the expression from the combinatorial viewpoint. We can also prove the relationship between and recursively.
Again let be the number of ways to partition labeled elements into nonempty unordered sets, let be the number of structures on a set of elements (with the same meaning as above), and let be the EGF of and the EGF of .
Among the elements, choosing of them as one separate set gives choices; the remaining elements form sets in ways. But each set in a partition is enumerated as the separate set once, so every partition is counted times and we must divide by .
The upper bound comes from partitioning into nonempty sets, which gives because each of the first sets contains at least one element. If we define to be beyond this bound, there is no effect.
After obtaining the recurrence, expand it recursively; when , the boundary is .
Similarly,
Clearly, defining the structures as partitions into nonempty sets () matches the intended meaning. If the empty set is included (), then contains contributions from (by choosing a constant term from at least one ), causing overcounting and failing to give the desired quantity.
From the recursive viewpoint, a product of several EGFs can also be viewed as a knapsack-like combination: the process of combining two groups of counted objects.
In summary, the meaning of polynomial is: the generating family of sets formed by labeled elements, or the total number of ways to partition them into any number of nonempty subsets.
Permutations and circular permutations
The exponential generating function for permutations of length is
A circular permutation is a way to arrange in a ring. Rotations of the same arrangement are equivalent, but reversals are not.
The number of circular permutations of numbers is clearly . Therefore, the exponential generating function of circular permutations of numbers is
That is, . This is only a mathematical derivation, however. How can we intuitively understand why the of the EGF of circular permutations is the EGF of permutations?
A permutation is composed of several permutation cycles. For example, has two permutation cycles:

(In other words, we draw a directed edge from to .)
Different permutation cycles produce different permutations. For example, if we change the second permutation cycle to

the corresponding permutation becomes .
Thus, the number of permutations of length is the number of ways to:
- Divide into several sets.
- Turn each set into a permutation cycle.
The number of ways for the elements of one set to form a permutation cycle is exactly the number of circular permutations of that set. Therefore, the number of permutations of length is obtained by partitioning into several sets and multiplying the circular-permutation counts for the sets.
This is the intuitive meaning of polynomial .
More generally:
-
If the EGF of labeled spanning trees on vertices is , then the EGF of labeled spanning forests on vertices is —intuitively, partition the vertices into several sets and multiply the number of ways for each set to form a spanning tree.
-
If the EGF of labeled undirected connected graphs on vertices is , then the EGF of labeled undirected graphs on vertices is , which is easy to compute:
Therefore, computing the former requires only one polynomial .
Next we look at some applications of exponential generating functions.
Applications
Derangements
Derangements
A derangement of length is a permutation satisfying .
Find the exponential generating function of the derangements.
From the perspective of permutation cycles, a derangement is a permutation with no self-loop in its cycles. In other words, it has no cycle of length . The EGF of the latter is
Therefore, the EGF of derangements is .
Fixed points
Fixed points
Problem: Count the mappings satisfying
.
Draw an edge from to . The condition says that starting from any , after steps and after steps we reach the same point. Thus every cycle in the functional graph is a self-loop and its depth is at most (the root has depth ). Treating this functional graph as a rooted tree gives the same result. The problem therefore becomes counting forests of rooted trees on labeled vertices with depth at most .
Consider a rooted tree on labeled vertices with depth at most , and suppose its generating function is
To derive recursively, observe that a rooted tree of depth at most consists of several rooted trees of depth at most whose roots are all connected to one new vertex. Hence
The answer's exponential generating function is therefore ; compute its -th term.
Lust
Lust
You are given a sequence of numbers and a variable initially equal to named . Repeat the following operations times:
- Choose an element from uniformly at random and call it .
- Increase by .
- Decrease by one.
After operations, find the expected value of .
.
Suppose that after operations, has decreased by . Then in fact
Thus the problem is equivalent to, after operations, finding the expected value of .
Consider the sum of over every sequence of choices, and divide by at the end.
In a sequence of operations, the number of sequences in which appears times is
which resembles the coefficient in multiplication of exponential generating functions.
Let the exponential generating function associated with be
Then the answer is
To compute the answer quickly, convert to closed form:
Therefore,
Here is an -degree polynomial, which can be computed by brute force. Suppose its expansion is . Then
It is enough to compute the coefficient of in this polynomial.