In mathematics, the term generating function is used to describe an infinite sequence of numbers (an) by treating them as the coefficients of a series expansion. The sum of this infinite series is the generating function. Unlike an ordinary series, this formal series is allowed to diverge, meaning that the generating function is not always a true function and the "variable" is actually an indeterminate. Generating functions were first introduced by Abraham de Moivre in 1730, in order to solve the general linear recurrence problem.[1] One can generalize to formal series in more than one indeterminate, to encode information about arrays of numbers indexed by several natural numbers.

There are various types of generating functions, including ordinary generating functions, exponential generating functions, Lambert series, Bell series, and Dirichlet series; definitions and examples are given below. Every sequence in principle has a generating function of each type (except that Lambert and Dirichlet series require indices to start at 1 rather than 0), but the ease with which they can be handled may differ considerably. The particular generating function, if any, that is most useful in a given context will depend upon the nature of the sequence and the details of the problem being addressed.

Generating functions are often expressed in closed form (rather than as a series), by some expression involving operations defined for formal series. These expressions in terms of the indeterminate x may involve arithmetic operations, differentiation with respect to x and composition with (i.e., substitution into) other generating functions; since these operations are also defined for functions, the result looks like a function of x. Indeed, the closed form expression can often be interpreted as a function that can be evaluated at (sufficiently small) concrete values of x, and which has the formal series as its series expansion; this explains the designation "generating functions". However such interpretation is not required to be possible, because formal series are not required to give a convergent series when a nonzero numeric value is substituted for x. Also, not all expressions that are meaningful as functions of x are meaningful as expressions designating formal series; for example, negative and fractional powers of x are examples of functions that do not have a corresponding formal power series.

Generating functions are not functions in the formal sense of a mapping from a domain to a codomain. Generating functions are sometimes called generating series,[2] in that a series of terms can be said to be the generator of its sequence of term coefficients.

A generating function is a device somewhat similar to a bag. Instead of carrying many little objects detachedly, which could be embarrassing, we put them all in a bag, and then we have only one object to carry, the bag.

The ordinary generating function can be generalized to arrays with multiple indices. For example, the ordinary generating function of a two-dimensional array am, n (where n and m are natural numbers) is

The Lambert series coefficients in the power series expansions bn:=[xn]LG⁡(an;x){\displaystyle b_{n}:=[x^{n}]\operatorname {LG} (a_{n};x)} for integers n≥1{\displaystyle n\geq 1} are related by the divisor sumbn=∑d|nad{\displaystyle b_{n}=\sum _{d|n}a_{d}}. The main article provides several more classical, or at least well-known examples related to special arithmetic functions in number theory. Note that in a Lambert series the index n starts at 1, not at 0, as the first term would otherwise be undefined.

If an is a Dirichlet character then its Dirichlet series generating function is called a Dirichlet L-series. We also have a relation between the pair of coefficients in the Lambert series expansions above and their DGFs. Namely, we can prove that [xn]LG⁡(an;x)=bn{\displaystyle [x^{n}]\operatorname {LG} (a_{n};x)=b_{n}} if and only if DG⁡(an;s)ζ(s)=DG⁡(bn;s){\displaystyle \operatorname {DG} (a_{n};s)\zeta (s)=\operatorname {DG} (b_{n};s)} where ζ(s){\displaystyle \zeta (s)} is the Riemann zeta function.[7]

Polynomials are a special case of ordinary generating functions, corresponding to finite sequences, or equivalently sequences that vanish after a certain point. These are important in that many finite sequences can usefully be interpreted as generating functions, such as the Poincaré polynomial and others.

The left-hand side is the Maclaurin series expansion of the right-hand side. Alternatively, the right-hand side expression can be justified by multiplying the power series on the left by 1 − x, and checking that the result is the constant power series 1, in other words that all coefficients except the one of x0 vanish. Moreover, there can be no other power series with this property. The left-hand side therefore designates the multiplicative inverse of 1 − x in the ring of power series.

Expressions for the ordinary generating function of other sequences are easily derived from this one. For instance, the substitution x → ax gives the generating function for the geometric sequence 1, a, a2, a3, ... for any constant a:

By squaring the initial generating function, or by finding the derivative of both sides with respect to x and making a change of running variable n → n-1, one sees that the coefficients form the sequence 1, 2, 3, 4, 5, ..., so one has

where {nk}{\displaystyle \left\{{\begin{matrix}n\\k\end{matrix}}\right\}} denote the Stirling numbers of the second kind and where the generating function ∑n≥0n!/(n−j)!zn=j!⋅zj/(1−z)j+1{\displaystyle \sum _{n\geq 0}n!/(n-j)!z^{n}=j!\cdot z^{j}/(1-z)^{j+1}} so that we can form the analogous generating functions over the integral mth{\displaystyle m^{th}} powers generalizing the result in the square case above. In particular, since we can write zk(1−z)k+1=∑i=0k(ki)(−1)k−i(1−z)i+1{\displaystyle {\frac {z^{k}}{(1-z)^{k+1}}}=\sum _{i=0}^{k}{\binom {k}{i}}{\frac {(-1)^{k-i}}{(1-z)^{i+1}}}}, we can apply a well-known finite sum identity involving the Stirling numbers to obtain that [8]

The ordinary generating function of a sequence can be expressed as a rational function (the ratio of two finite-degree polynomials) if and only if the sequence is a linear recursive sequence with constant coefficients; this generalizes the examples above. Conversely, every sequence generated by a fraction of polynomials satisfies a linear recurrence with constant coefficients; these coefficients are identical to the coefficients of the fraction denominator polynomial (so they can be directly read off). This observation shows it is easy to solve for generating functions of sequences defined by a linear finite difference equation with constant coefficients, and then hence, for explicit closed-form formulas for the coefficients of these generating functions. The prototypical example here is to derive Binet's formula for the Fibonacci numbers via generating function techniques.

We also notice that the class of rational generating functions precisely corresponds to the generating functions that enumerate quasi-polynomial sequences of the form [9]

where the reciprocal roots, ρi∈C{\displaystyle \rho _{i}\in \mathbb {C} }, are fixed scalars and where pi(n){\displaystyle p_{i}(n)} is a polynomial in n{\displaystyle n} for all 1≤i≤ℓ{\displaystyle 1\leq i\leq \ell }.

of a sequence with ordinary generating function G(an; x) has the generating function

G(an;x)⋅11−x{\displaystyle G(a_{n};x)\cdot {\frac {1}{1-x}}}

because 1/(1-x) is the ordinary generating function for the sequence (1, 1, ...). See also the section on convolutions in the applications section of this article below for further examples of problem solving with convolutions of generating functions and interpretations.

For integers m≥1{\displaystyle m\geq 1}, we have the following two analogous identities for the modified generating functions enumerating the shifted sequence variants of ⟨gn−m⟩{\displaystyle \langle g_{n-m}\rangle } and ⟨gn+m⟩{\displaystyle \langle g_{n+m}\rangle }, respectively:

The differentiation–multiplication operation of the second identity can be repeated k{\displaystyle k} times to multiply the sequence by nk{\displaystyle n^{k}}, but that requires alternating between differentiation and multiplication. If instead doing k{\displaystyle k} differentiations in sequence, the effect is to multiply by the k{\displaystyle k}thfalling factorial:

In this section we give formulas for generating functions enumerating the sequence {fan+b}{\displaystyle \{f_{an+b}\}} given an ordinary generating function F(z){\displaystyle F(z)} where a,b∈N{\displaystyle a,b\in \mathbb {N} }, a≥2{\displaystyle a\geq 2}, and 0≤b<a{\displaystyle 0\leq b<a} (see the main article on transformations). For a=2{\displaystyle a=2}, this is simply the familiar decomposition of a function into even and odd parts (i.e., even and odd powers):

More generally, suppose that a≥3{\displaystyle a\geq 3} and that ωa=exp⁡(2πı/a){\displaystyle \omega _{a}=\exp \left(2\pi \imath /a\right)} denotes the a{\displaystyle a}thprimitive root of unity. Then, as an application of the discrete Fourier transform, we have the formula[11]

where the coefficients ci(z){\displaystyle c_{i}(z)} are in the field of rational functions, C(z){\displaystyle \mathbb {C} (z)}. Equivalently, F(z){\displaystyle F(z)} is holonomic if the vector space over C(z){\displaystyle \mathbb {C} (z)} spanned by the set of all of its derivatives is finite dimensional.

Since we can clear denominators if need be in the previous equation, we may assume that the functions, ci(z){\displaystyle c_{i}(z)} are polynomials in z{\displaystyle z}. Thus we can see an equivalent condition that a generating function is holonomic if its coefficients satisfy a P-recurrence of the form

for all large enough n≥n0{\displaystyle n\geq n_{0}} and where the c^i(n){\displaystyle {\widehat {c}}_{i}(n)} are fixed finite-degree polynomials in n{\displaystyle n}. In other words, the properties that a sequence be P-recursive and have a holonomic generating function are equivalent. Holonomic functions are closed under the Hadamard product operation ⊙{\displaystyle \odot } on generating functions.

The functions ez{\displaystyle e^{z}}, log⁡(z){\displaystyle \log(z)}, cos⁡(z){\displaystyle \cos(z)}, arcsin⁡(z){\displaystyle \arcsin(z)}, 1+z{\displaystyle {\sqrt {1+z}}}, the dilogarithm function Li2⁡(z){\displaystyle \operatorname {Li} _{2}(z)}, and the functions defined by the power series ∑n≥0zn/(n!)2{\displaystyle \sum _{n\geq 0}z^{n}/(n!)^{2}} and the non-convergent ∑n≥0n!⋅zn{\displaystyle \sum _{n\geq 0}n!\cdot z^{n}} are all holonomic. Examples of P-recursive sequences with holonomic generating functions include fn:=1n+1(2nn){\displaystyle f_{n}:={\frac {1}{n+1}}{\binom {2n}{n}}} and fn:=2n/(n2+1){\displaystyle f_{n}:=2^{n}/(n^{2}+1)}, where sequences such as n{\displaystyle {\sqrt {n}}} and log⁡(n){\displaystyle \log(n)} are not P-recursive due to the nature of singularities in their corresponding generating functions. Similarly, functions with infinitely-many singularities such as tan⁡(z){\displaystyle \tan(z)}, sec⁡(z){\displaystyle \sec(z)}, and Γ(z){\displaystyle \Gamma (z)} are not holonomic functions.

Software for working with P-recursive sequences and holonomic generating functions[edit]

Tools for processing and working with P-recursive sequences in Mathematica include the software packages provided for non-commercial use on the RISC Combinatorics Group algorithmic combinatorics software site. Despite being mostly closed-source, particularly powerful tools in this software suite are provided by the Guess package for guessing P-recurrences for arbitrary input sequences (useful for experimental mathematics and exploration) and the Sigma package which is able to find P-recurrences for many sums and solve for closed-form solutions to P-recurrences involving generalized harmonic numbers.[14] Other packages listed on this particular RISC site are targeted at working with holonomic generating functions specifically. (Depending on how in depth this article gets on the topic, there are many, many other examples of useful software tools that can be listed here or on this page in another section.)

In calculus, often the growth rate of the coefficients of a power series can be used to deduce a radius of convergence for the power series. The reverse can also hold; often the radius of convergence for a generating function can be used to deduce the asymptotic growth of the underlying sequence.

For instance, if an ordinary generating function G(an; x) that has a finite radius of convergence of r can be written as

One can define generating functions in several variables for arrays with several indices. These are called multivariate generating functions or, sometimes, super generating functions. For two variables, these are often called bivariate generating functions.

For instance, since (1+x)n{\displaystyle (1+x)^{n}} is the ordinary generating function for binomial coefficients for a fixed n, one may ask for a bivariate generating function that generates the binomial coefficients (nk){\displaystyle {\binom {n}{k}}} for all k and n. To do this, consider (1+x)n{\displaystyle (1+x)^{n}} as itself a series, in n, and find the generating function in y that has these as coefficients. Since the generating function for an{\displaystyle a^{n}} is

Expansions of (formal) Jacobi-type and Stieltjes-typecontinued fractions (J-fractions and S-fractions, respectively) whose hth{\displaystyle h^{th}} rational convergents represent 2h{\displaystyle 2h}-order accurate power series are another way to express the typically divergent ordinary generating functions for many special one and two-variate sequences. The particular form of the Jacobi-type continued fractions (J-fractions) are expanded as in the following equation and have the next corresponding power series expansions with respect to z{\displaystyle z} for some specific, application-dependent component sequences, {abi}{\displaystyle \{{\text{ab}}_{i}\}} and {ci}{\displaystyle \{c_{i}\}}, where z≠0{\displaystyle z\neq 0} denotes the formal variable in the second power series expansion given below:[15]

The coefficients of zn{\displaystyle z^{n}}, denoted in shorthand by jn:=[zn]J[∞](z){\displaystyle j_{n}:=[z^{n}]J^{[\infty ]}(z)}, in the previous equations correspond to matrix solutions of the equations

where j0≡k0,0=1{\displaystyle j_{0}\equiv k_{0,0}=1}, jn=k0,n{\displaystyle j_{n}=k_{0,n}} for n≥1{\displaystyle n\geq 1}, kr,s=0{\displaystyle k_{r,s}=0} if r>s{\displaystyle r>s}, and where for all integers p,q≥0{\displaystyle p,q\geq 0}, we have an addition formula relation given by

For h≥0{\displaystyle h\geq 0} (though in practice when h≥2{\displaystyle h\geq 2}), we can define the rational hth{\displaystyle h^{th}} convergents to the infinite J-fraction, J[∞](z){\displaystyle J^{[\infty ]}(z)}, expanded by

Moreover, the rationality of the convergent function, Convh(z){\displaystyle {\text{Conv}}_{h}(z)} for all h≥2{\displaystyle h\geq 2} implies additional finite difference equations and congruence properties satisfied by the sequence of jn{\displaystyle j_{n}}, and for Mh:=ab2⋯abh+1{\displaystyle M_{h}:={\text{ab}}_{2}\cdots {\text{ab}}_{h+1}} if h|Mh{\displaystyle h|M_{h}} then we have the congruence

for non-symbolic, determinate choices of the parameter sequences, {abi}{\displaystyle \{{\text{ab}}_{i}\}} and {ci}{\displaystyle \{c_{i}\}}, when h≥2{\displaystyle h\geq 2}, i.e., when these sequences do not implicitly depend on an auxiliary parameter such as q{\displaystyle q}, x{\displaystyle x}, or R{\displaystyle R} as in the examples contained in the table below.

Mathematica code to find parameters for the J-fractions generating a sequence[edit]

For any prescribed, desired sequence of the jn:=[zn]J[∞](z){\displaystyle j_{n}:=[z^{n}]J^{[\infty ]}(z)}, we can solve for the first several special cases of the corresponding J-fraction component sequences, {abi}{\displaystyle \{{\text{ab}}_{i}\}} and {ci}{\displaystyle \{c_{i}\}}, using the next Mathematica code (Caution: Potentially high running times for the long initial list of trial functions).

The next table provides examples of closed-form formulas for the component sequences found computationally (and subsequently proved correct in the cited references [16]) in several special cases of the prescribed sequences, jn{\displaystyle j_{n}}, generated by the general expansions of the J-fractions defined in the first subsection. Here we define 0<|a|,|b|,|q|<1{\displaystyle 0<|a|,|b|,|q|<1} and the parameters R{\displaystyle R}, α∈Z+{\displaystyle \alpha \in \mathbb {Z} ^{+}} and x{\displaystyle x} to be indeterminates with respect to these expansions, where the prescribed sequences enumerated by the expansions of these J-fractions are defined in terms of the q-Pochhammer symbol, Pochhammer symbol, and the binomial coefficients.

Note that the radii of convergence of these series corresponding to the definition of the Jacobi-type J-fractions given above are in general different from that of the corresponding power series expansions defining the ordinary generating functions of these sequences.

Multivariate generating functions arise in practice when calculating the number of contingency tables of non-negative integers with specified row and column totals. Suppose the table has r rows and c columns; the row sums are t1,…tr{\displaystyle t_{1},\ldots t_{r}} and the column sums are s1,…sc{\displaystyle s_{1},\ldots s_{c}}. Then, according to I. J. Good,[18] the number of such tables is the coefficient of

In the bivariate case, non-polynomial double sum examples of so-termed "double" or "super" generating functions of the form G(w,z):=∑m,n≥0gm,nwmzn{\displaystyle G(w,z):=\sum _{m,n\geq 0}g_{m,n}w^{m}z^{n}} include the following two-variable generating functions for the binomial coefficients, the Stirling numbers, and the Eulerian numbers:[19]

Various techniques: Evaluating sums and tackling other problems with generating functions[edit]

Generating functions give us several methods to manipulate sums and to establish identities between sums.

The simplest case occurs when sn=∑k=0nak{\displaystyle s_{n}=\sum _{k=0}^{n}{a_{k}}}. We then know that S(z)=A(z)1−z{\displaystyle S(z)={\frac {A(z)}{1-z}}} for the corresponding ordinary generating functions.

For example, we can manipulate sn=∑k=1nHk{\displaystyle s_{n}=\sum _{k=1}^{n}H_{k}}, where Hk=1+12+⋯+1k{\displaystyle H_{k}=1+{\frac {1}{2}}+\cdots +{\frac {1}{k}}} are the harmonic numbers. Let H(z)=∑n≥1Hnzn{\displaystyle H(z)=\sum _{n\geq 1}{H_{n}z^{n}}} be the ordinary generating function of the harmonic numbers. Then

Since the generating function for the sequence ⟨(n+1)(n+2)(n+3)fn⟩{\displaystyle \langle (n+1)(n+2)(n+3)f_{n}\rangle } is given by 6F(z)+18zF′(z)+9z2F′′(z)+z3F(3)(z){\displaystyle 6F(z)+18zF^{\prime }(z)+9z^{2}F^{\prime \prime }(z)+z^{3}F^{(3)}(z)}, we may write the generating function for the second sum defined above in the form

In this example, we re-formulate a generating function example given in Section 7.3 of Concrete Mathematics (see also Section 7.1 of the same reference for pretty pictures of generating function series). In particular, suppose that we seek the total number of ways (denoted Un{\displaystyle U_{n}}) to tile a 3×n{\displaystyle 3\times n} rectangle with unmarked 2×1{\displaystyle 2\times 1} domino pieces. Let the auxiliary sequence, Vn{\displaystyle V_{n}}, be defined as the number of ways to cover a 3×n{\displaystyle 3\times n} rectangle-minus-corner section of the full rectangle. We seek to use these definitions to give a closed form formula for Un{\displaystyle U_{n}} without breaking down this definition further to handle the cases of vertical versus horizontal dominoes. Notice that the ordinary generating functions for our two sequences correspond to the series

If we consider the possible configurations that can be given starting from the left edge of the 3×n{\displaystyle 3\times n} rectangle, we are able to express the following mutually dependent, or mutually recursive, recurrence relations for our two sequences when n≥2{\displaystyle n\geq 2} defined as above where U0=1{\displaystyle U_{0}=1}, U1=0{\displaystyle U_{1}=0}, V0=0{\displaystyle V_{0}=0}, and V1=1{\displaystyle V_{1}=1}:

Since we have that for all integers m≥0{\displaystyle m\geq 0}, the index-shifted generating functions satisfy zmG(z)=∑n≥mgn−mzn{\displaystyle z^{m}G(z)=\sum _{n\geq m}g_{n-m}z^{n}} (incidentally, we also have a corresponding formula when m<0{\displaystyle m<0} given by ∑n≥0gn+mzn=G(z)−g0−g1z−⋯−gm−1zm−1zm{\displaystyle \sum _{n\geq 0}g_{n+m}z^{n}={\frac {G(z)-g_{0}-g_{1}z-\cdots -g_{m-1}z^{m-1}}{z^{m}}}}), we can use the initial conditions specified above and the previous two recurrence relations to see that we have the next two equations relating the generating functions for these sequences given by

Thus by performing algebraic simplifications to the sequence resulting from the second partial fractions expansions of the generating function in the previous equation, we find that U2n+1≡0{\displaystyle U_{2n+1}\equiv 0} and that

for all integers n≥0{\displaystyle n\geq 0}. We also note that the same shifted generating function technique applied to the second-order recurrence for the Fibonacci numbers is the prototypical example of using generating functions to solve recurrence relations in one variable already covered, or at least hinted at, in the subsection on rational functions given above.

A discrete convolution of the terms in two formal power series turns a product of generating functions into a generating function enumerating a convolved sum of the original sequence terms (see Cauchy product).

Multiplication of generating functions, or convolution of their underlying sequences, can correspond to a notion of independent events in certain counting and probability scenarios. For example, if we adopt the notational convention that the probability generating function, or pgf, of a random variable Z{\displaystyle Z} is denoted by GZ(z){\displaystyle G_{Z}(z)}, then we can show that for any two random variables [20]

GX+Y(z)=GX(z)GY(z),{\displaystyle G_{X+Y}(z)=G_{X}(z)G_{Y}(z),}

if X{\displaystyle X} and Y{\displaystyle Y} are independent. Similarly, the number of ways to pay n≥0{\displaystyle n\geq 0} cents in coin denominations of values in the set {1,5,10,25,50}{\displaystyle \{1,5,10,25,50\}} (i.e., in pennies, nickels, dimes, quarters, and half dollars, respectively) is generated by the product

and moreover, if we allow the n{\displaystyle n} cents to be paid in coins of any positive integer denomination, we arrive at the generating for the number of such combinations of change being generated by the partition function generating function expanded by the infinite q-Pochhammer symbol product of ∏n≥1(1−zn)−1{\displaystyle \prod _{n\geq 1}(1-z^{n})^{-1}}.

An example where convolutions of generating functions are useful allows us to solve for a specific closed-form function representing the ordinary generating function for the Catalan numbers, Cn{\displaystyle C_{n}}. In particular, this sequence has the combinatorial interpretation as being the number of ways to insert parentheses into the product x0⋅x1⋯xn{\displaystyle x_{0}\cdot x_{1}\cdots x_{n}} so that the order of multiplication is completely specified. For example, C2=2{\displaystyle C_{2}=2} which corresponds to the two expressions x0⋅(x1⋅x2){\displaystyle x_{0}\cdot (x_{1}\cdot x_{2})} and (x0⋅x1)⋅x2{\displaystyle (x_{0}\cdot x_{1})\cdot x_{2}}. It follows that the sequence satisfies a recurrence relation given by

Note that the first equation implicitly defining C(z){\displaystyle C(z)} above implies that

C(z)=11−z⋅C(z),{\displaystyle C(z)={\frac {1}{1-z\cdot C(z)}},}

which then leads to another "simple" (as in of form) continued fraction expansion of this generating function.

Example: Spanning trees of fans and convolutions of convolutions[edit]

A fan of order n{\displaystyle n} is defined to be a graph on the vertices {0,1,⋯,n}{\displaystyle \{0,1,\cdots ,n\}} with 2n−1{\displaystyle 2n-1} edges connected according to the following rules: Vertex 0{\displaystyle 0} is connected by a single edge to each of the other n{\displaystyle n} vertices, and vertex k{\displaystyle k} is connected by a single edge to the next vertex k+1{\displaystyle k+1} for all 1≤k<n{\displaystyle 1\leq k<n}.[21] There is one fan of order one, three fans of order two, eight fans of order three, and so on. A spanning tree is a subgraph of a graph which contains all of the original vertices and which contains enough edges to make this subgraph connected, but not so many edges that there is a cycle in the subgraph. We ask how many spanning trees fn{\displaystyle f_{n}} of a fan of order n{\displaystyle n} are possible for each n≥1{\displaystyle n\geq 1}.

As an observation, we may approach the question by counting the number of ways to join adjacent sets of vertices. For example, when n=4{\displaystyle n=4}, we have that f4=4+3⋅1+2⋅2+1⋅3+2⋅1⋅1+1⋅2⋅1+1⋅1⋅2+1⋅1⋅1⋅1⋅1=21{\displaystyle f_{4}=4+3\cdot 1+2\cdot 2+1\cdot 3+2\cdot 1\cdot 1+1\cdot 2\cdot 1+1\cdot 1\cdot 2+1\cdot 1\cdot 1\cdot 1\cdot 1=21}, which is a sum over the m{\displaystyle m}-fold convolutions of the sequence gn=n=[zn]z/(1−z)2{\displaystyle g_{n}=n=[z^{n}]z/(1-z)^{2}} for m:=1,2,3,4{\displaystyle m:=1,2,3,4}. More generally, we may write a formula for this sequence as

Sometimes the sum sn{\displaystyle s_{n}} is complicated, and it is not always easy to evaluate. The "Free Parameter" method is another method (called "snake oil" by H. Wilf) to evaluate these sums.

Both methods discussed so far have n{\displaystyle n} as limit in the summation. When n does not appear explicitly in the summation, we may consider n{\displaystyle n} as a “free” parameter and treat sn{\displaystyle s_{n}} as a coefficient of F(z)=∑snzn{\displaystyle F(z)=\sum {s_{n}z^{n}}}, change the order of the summations on n{\displaystyle n} and k{\displaystyle k}, and try to compute the inner sum.

We say that two generating functions (power series) are congruent modulo m{\displaystyle m}, written A(z)≡B(z)(modm){\displaystyle A(z)\equiv B(z){\pmod {m}}} if their coefficients are congruent modulo m{\displaystyle m} for all n≥0{\displaystyle n\geq 0}, i.e., an≡bn(modm){\displaystyle a_{n}\equiv b_{n}{\pmod {m}}} for all relevant cases of the integers n{\displaystyle n} (note that we need not assume that m{\displaystyle m} is an integer here—it may very well be polynomial-valued in some indeterminate x{\displaystyle x}, for example). If the "simpler" right-hand-side generating function, B(z){\displaystyle B(z)}, is a rational function of z{\displaystyle z}, then the form of this sequences suggests that the sequence is eventually periodic modulo fixed particular cases of integer-valued m≥2{\displaystyle m\geq 2}. For example, we can prove that the Euler numbers, ⟨En⟩=⟨1,1,5,61,1385,…⟩⟼⟨1,1,2,1,2,1,2,…⟩(mod3){\displaystyle \langle E_{n}\rangle =\langle 1,1,5,61,1385,\ldots \rangle \longmapsto \langle 1,1,2,1,2,1,2,\ldots \rangle {\pmod {3}}}, satisfy the following congruence modulo 3{\displaystyle 3}:[22]

One of the most useful, if not downright powerful, methods of obtaining congruences for sequences enumerated by special generating functions modulo any integers (i.e., not only prime powerspk{\displaystyle p^{k}}) is given in the section on continued fraction representations of (even non-convergent) ordinary generating functions by J-fractions above. We cite one particular result related to generating series expanded through a representation by continued fraction from Lando's Lectures on Generating Functions as follows:

Theorem: (Congruences for Series Generated by Expansions of Continued Fractions) Suppose that the generating function A(z){\displaystyle A(z)} is represented by an infinite continued fraction of the form

and that Ap(z){\displaystyle A_{p}(z)} denotes the pth{\displaystyle p^{th}} convergent to this continued fraction expansion defined such that an=[zn]Ap(z){\displaystyle a_{n}=[z^{n}]A_{p}(z)} for all 0≤n<2p{\displaystyle 0\leq n<2p}. Then 1) the function Ap(z){\displaystyle A_{p}(z)} is rational for all p≥2{\displaystyle p\geq 2} where we assume that one of divisibility criteria of p|p1,p1p2,p1p2p3⋯{\displaystyle p|p_{1},p_{1}p_{2},p_{1}p_{2}p_{3}\cdots } is met, i.e., p|p1p2⋯pk{\displaystyle p|p_{1}p_{2}\cdots p_{k}} for some k≥1{\displaystyle k\geq 1}; and 2) If the integer p{\displaystyle p} divides the product p1p2⋯pk{\displaystyle p_{1}p_{2}\cdots p_{k}}, then we have that A(z)≡Ak(z)(modp){\displaystyle A(z)\equiv A_{k}(z){\pmod {p}}}.

provides an overview of the congruences for these numbers derived strictly from properties of their generating function as in Section 4.6 of Wilf's stock reference Generatingfunctionology. We repeat the basic argument and notice that when reduces modulo 2{\displaystyle 2}, these finite product generating functions each satisfy

In this example, we pull in some of the machinery of infinite products whose power series expansions generate the expansions of many special functions and enumerate partition functions. In particular, we recall that thepartition functionp(n){\displaystyle p(n)} is generated by the reciprocal infinite q-Pochhammer symbol product (or z-Pochhammer product as the case may be) given by

This partition function satisfies many known congruence properties, which notably include the following results though there are still many open questions about the forms of related integer congruences for the function:[23]

We show how to use generating functions and manipulations of congruences for formal power series to give a highly elementary proof of the first of these congruences listed above.

First, we observe that the binomial coefficient generating function, 1/(1−z)5{\displaystyle 1/(1-z)^{5}}, satisfies that each of its coefficients are divisible by 5{\displaystyle 5} with the exception of those which correspond to the powers of 1,z5,z10,…{\displaystyle 1,z^{5},z^{10},\ldots }, all of which otherwise have a remainder of 1{\displaystyle 1} modulo 5{\displaystyle 5}. Thus we may write

There are a number of transformations of generating functions that provide other applications (see the main article). A transformation of a sequence's ordinary generating function (OGF) provides a method of converting the generating function for one sequence into a generating function enumerating another. These transformations typically involve integral formulas involving a sequence OGF (see integral transformations) or weighted sums over the higher-order derivatives of these functions (see derivative transformations).

Generating function transformations can come into play when we seek to express a generating function for the sums

in the form of S(z)=g(z)A(f(z)){\displaystyle S(z)=g(z)A(f(z))} involving the original sequence generating function. For example, if the sums sn:=∑k≥0(n+km+2k)ak{\displaystyle s_{n}:=\sum _{k\geq 0}{\binom {n+k}{m+2k}}a_{k}}, then the generating function for the modified sum expressions is given by S(z)=zm(1−z)m+1A(z(1−z)2){\displaystyle S(z)={\frac {z^{m}}{(1-z)^{m+1}}}A\left({\frac {z}{(1-z)^{2}}}\right)}[24] (see also the binomial transform and the Stirling transform).

There are also integral formulas for converting between a sequence's OGF, F(z){\displaystyle F(z)}, and its exponential generating function, or EGF, F^(z){\displaystyle {\widehat {F}}(z)}, and vice versa given by

for some analytic function F{\displaystyle F} with a power series expansion such that F(0)=1{\displaystyle F(0)=1}. We say that a family of polynomials, f0,f1,f2,…{\displaystyle f_{0},f_{1},f_{2},\ldots }, forms a convolution family if deg⁡{fn}≤n{\displaystyle \deg\{f_{n}\}\leq n} and if the following convolution condition holds for all x,y{\displaystyle x,y} and for all n≥0{\displaystyle n\geq 0}:

where Ft(z){\displaystyle {\mathcal {F}}_{t}(z)} is implicitly defined by a functional equation of the form Ft(z)=F(xFt(z)t){\displaystyle {\mathcal {F}}_{t}(z)=F\left(x{\mathcal {F}}_{t}(z)^{t}\right)}. Moreover, we can use matrix methods (as in the reference) to prove that given two convolution polynomial sequences, ⟨fn(x)⟩{\displaystyle \langle f_{n}(x)\rangle } and ⟨gn(x)⟩{\displaystyle \langle g_{n}(x)\rangle }, with respective corresponding generating functions, F(z)x{\displaystyle F(z)^{x}} and G(z)x{\displaystyle G(z)^{x}}, then for arbitrary t{\displaystyle t} we have the identity

An initial listing of special mathematical series is found here. A number of useful and special sequence generating functions are found in Section 5.4 and 7.4 of Concrete Mathematics and in Section 2.5 of Wilf's Generatingfunctionology. Other special generating functions of note include the entries in the next table, which is by no means complete.[26]

This section needs expansion with: Lists of special and special sequence generating functions. The next table is a start. You can help by adding to it.(April 2017)

{nm}{\displaystyle \left\{{\begin{matrix}n\\m\end{matrix}}\right\}} is a Stirling number of the second kind and where the individual terms in the expansion satisfy zi(1−z)i+1=∑k=0i(ik)(−1)k−i(1−z)k+1{\displaystyle {\frac {z^{i}}{(1-z)^{i+1}}}=\sum _{k=0}^{i}{\binom {i}{k}}{\frac {(-1)^{k-i}}{(1-z)^{k+1}}}}

The name "generating function" is due to Laplace. Yet, without giving it a name, Euler used the device of generating functions long before Laplace [..]. He applied this mathematical tool to several problems in Combinatory Analysis and the Theory of Numbers.

^This alternative term can already be found in E.N. Gilbert (1956), "Enumeration of Labeled graphs", Canadian Journal of Mathematics 3, p. 405–411, but its use is rare before the year 2000; since then it appears to be increasing.

^See Example 6 in Section 7.3 of Concrete Mathematics for another method and the complete setup of this problem using generating functions. This more "convoluted" approach is given in Section 7.5 of the same reference.