# Generating function

Generating function

In mathematics, a generating function is a formal power series in one indeterminate, whose coefficients encode information about a sequence of numbers an that is indexed by the natural numbers. 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 power 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 power 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 power series as its Taylor series; this explains the designation "generating functions". However such interpretation is not required to be possible, because formal power 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 power series; negative and fractional powers of x are examples of this.

Generating functions are not functions in the formal sense of a mapping from a domain to a codomain; the name is merely traditional, and they are sometimes more correctly called generating series.[2]

## Definitions

A generating function is a clothesline on which we hang up a sequence of numbers for display.
Herbert Wilf, Generatingfunctionology (1994)

### Ordinary generating function

The ordinary generating function of a sequence an is

$G(a_n;x)=\sum_{n=0}^\infty a_nx^n.$

When the term generating function is used without qualification, it is usually taken to mean an ordinary generating function.

If an is the probability mass function of a discrete random variable, then its ordinary generating function is called a probability-generating function.

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

$G(a_{m,n};x,y)=\sum_{m,n=0}^\infty a_{m,n}x^my^n.$

### Exponential generating function

The exponential generating function of a sequence an is

$\operatorname{EG}(a_n;x)=\sum _{n=0}^{\infty} a_n \frac{x^n}{n!}.$

### Poisson generating function

The Poisson generating function of a sequence an is

$\operatorname{PG}(a_n;x)=\sum _{n=0}^{\infty} a_n e^{-x} \frac{x^n}{n!} = e^{-x}\, \operatorname{EG}(a_n;x)\,.$

### Lambert series

The Lambert series of a sequence an is

$\operatorname{LG}(a_n;x)=\sum _{n=1}^{\infty} a_n \frac{x^n}{1-x^n}.$

Note that in a Lambert series the index n starts at 1, not at 0.

### Bell series

The Bell series of a sequence an is an expression in terms of both an indeterminate x and a prime p and is given by

$\operatorname{BG}_p(a_n;x)=\sum_{n=0}^\infty a_{p^n}x^n.$

### Dirichlet series generating functions

Dirichlet series are often classified as generating functions, although they are not strictly formal power series. The Dirichlet series generating function of a sequence an is

$\operatorname{DG}(a_n;s)=\sum _{n=1}^{\infty} \frac{a_n}{n^s}.$

The Dirichlet series generating function is especially useful when an is a multiplicative function, when it has an Euler product expression in terms of the function's Bell series

$\operatorname{DG}(a_n;s)=\prod_{p} \operatorname{BG}_p(a_n;p^{-s})\,.$

If an is a Dirichlet character then its Dirichlet series generating function is called a Dirichlet L-series.

### Polynomial sequence generating functions

The idea of generating functions can be extended to sequences of other objects. Thus, for example, polynomial sequences of binomial type are generated by

$e^{xf(t)}=\sum_{n=0}^\infty {p_n(x) \over n!}t^n$

where pn(x) is a sequence of polynomials and f(t) is a function of a certain form. Sheffer sequences are generated in a similar way. See the main article generalized Appell polynomials for more information.

## Ordinary generating functions

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.

A key generating function is the constant sequence 1, 1, 1, 1, 1, 1, 1, 1, 1, ..., whose ordinary generating function is

$\sum_{n=0}^{\infty}x^n={1\over1-x}.$

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 vanish, except the one of x0. 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:

$\sum_{n=0}^{\infty}(ax)^n={1\over1-ax}\,.$

(The equality also follows directly from the fact that the left-hand side is the Maclaurin series expansion of the right-hand side.) In particular,

$\sum_{n=0}^{\infty}(-1)^nx^n={1\over1+x}\,.$

One can also introduce regular "gaps" in the sequence by replacing x by some power of x, so for instance for the sequence 1, 0, 1, 0, 1, 0, 1, 0, .... one gets the generating function

$\sum_{n=0}^{\infty}x^{2n}={1\over1-x^2}.$

By squaring the initial generating function, or by finding the derivative of both sides with respect to x, one sees that the coefficients form the sequence 1, 2, 3, 4, 5, ..., so one has

$\sum_{n=0}^{\infty}(n+1)x^n={1\over(1-x)^2},$

and the third power has as coefficients the triangular numbers 1, 3, 6, 10, 15, 21, ... whose term n is the binomial coefficient $\tbinom{n+2}2$, so that

$\sum_{n=0}^{\infty}\tbinom{n+2}2 x^n={1\over(1-x)^3}.$

More generally, for any positive integer k, it is true that

$\sum_{n=0}^{\infty}\tbinom{n+k}k x^n={1\over(1-x)^{k+1}}.$

Note that, since

$\binom{n+2}2=\frac12{(n+1)(n+2)} =\frac12(n^2+3n+2)\,,$

one can find the ordinary generating function for the sequence 0, 1, 4, 9, 16, ... of square numbers by linear combination of binomial-coefficient generating sequences;

$G(n^2;x)=\sum_{n=0}^{\infty}n^2x^n={2\over(1-x)^3}-{3\over(1-x)^2}+{1\over1-x}=\frac{x(x+1)}{(1-x)^3}.$

### Rational functions

The ordinary generating function of a sequence can be expressed as a rational function (the ratio of two polynomials) if and only if the sequence is a linear recursive sequence; this generalizes the examples above.

### Multiplication yields convolution

Multiplication of ordinary generating functions yields a discrete convolution (the Cauchy product) of the sequences. For example, the sequence of cumulative sums $(a_0, a_0 + a_1, a_0 + a_1 + a_2, \ldots)$ of a sequence with ordinary generating function G(anx) has the generating function $G(a_n; x) \frac{1}{1-x}$ because 1/(1-x) is the ordinary generating function for the sequence (1, 1, ...).

### Relation to discrete-time Fourier transform

When the series converges absolutely, $G\left(a_n; e^{-i \omega}\right) = \sum_{n=0}^\infty a_n e^{-i \omega n}$ is the discrete-time Fourier transform of the sequence a0, a1, ....

### Asymptotic growth of a sequence

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(anx) that has a finite radius of convergence of r can be written as

$G(a_n; x) = \frac{A(x) + B(x) (1- x/r)^{-\beta}}{x^{\alpha}} \,$

where A(x) and B(x) are functions that are analytic to a radius of convergence greater than r (or are entire), and where B(r) ≠ 0 then

$a_n \sim \frac{B(r)}{r^{\alpha} \Gamma(\beta)} \, n^{\beta-1}(1/r)^{n}\,,$

using the Gamma function.

#### Asymptotic growth of the sequence of squares

As derived above, the ordinary generating function for the sequence of squares is $\frac{x(x+1)}{(1-x)^3}\,.$ With r = 1, α = 0, β = 3, A(x) = 0, and B(x) = x(x+1), we can verify that the squares grow as expected, like the squares:

$a_n \sim \frac{B(r)}{r^{\alpha} \Gamma(\beta)} \, n^{\beta-1}(1/r)^{n} = \frac{1(1+1)}{1^0\,\Gamma(3)}\,n^{3-1} (1/1)^n = n^2\,.$

#### Asymptotic growth of the Catalan numbers

The ordinary generating function for the Catalan numbers is $\frac{1-\sqrt{1-4x}}{2x}\,.$ With r = 1/4, α = 1, β = −1/2, A(x) = 1/2, and B(x) = −1/2, we can conclude that, for the Catalan numbers,

$a_n \sim \frac{B(r)}{r^{\alpha} \Gamma(\beta)} \, n^{\beta-1}(1/r)^{n} = \frac{-1/2}{(1/4)^1 \Gamma(-1/2)} \, n^{-1/2-1} \left(\frac{1}{1/4}\right)^n = \frac{n^{-3/2} \, 4^n}{\sqrt{\pi}} \,.$

### Bivariate and multivariate generating functions

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 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 $\binom{n}{k}$ for all k and n. To do this, consider (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 is 1 / (1 − ay), the generating function for the binomial coefficients is:

$\sum_{n,k} \binom n k x^k y^n = \frac{1}{1-(1+x)y}=\frac{1}{1-y-xy}\,.$

## Examples

Generating functions for the sequence of square numbers an = n2 are:

### Ordinary generating function

$G(n^2;x)=\sum_{n=0}^{\infty}n^2x^n=\frac{x(x+1)}{(1-x)^3}$

### Exponential generating function

$\operatorname{EG}(n^2;x)=\sum _{n=0}^{\infty} \frac{n^2x^n}{n!}=x(x+1)e^x$

### Bell series

$\operatorname{BG}_p(a_n;x)=\sum_{n=0}^\infty (p^{n})^2x^n=\frac{1}{1-p^2x}$

### Dirichlet series generating function

$\operatorname{DG}(n^2;s)=\sum_{n=1}^{\infty} \frac{n^2}{n^s}=\zeta(s-2)\,,$

using the Riemann zeta function.

The sequence an generated by a Dirichlet series generating function corresponding to:

$\operatorname{DG}(a_n;s)=\zeta(s)^m$

where ζ(s) is the Riemann zeta function, has the ordinary generating function:

\begin{align} \sum \limits_{n=1}^{\infty} a_nx^n = x &+ {m \choose 1}\sum \limits_{a=2}^{\infty} x^{a} + {m \choose 2}\sum \limits_{a=2}^{\infty} \sum \limits_{b=2}^{\infty} x^{ab} \\ &+ {m \choose 3}\sum \limits_{a=2}^{\infty} \sum \limits_{b=2}^{\infty} \sum \limits_{c=2}^{\infty} x^{abc} + {m \choose 4}\sum \limits_{a=2}^{\infty} \sum \limits_{b=2}^{\infty} \sum \limits_{c=2}^{\infty} \sum \limits_{d=2}^{\infty} x^{abcd} +... \end{align}

### Multivariate generating function

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 $t_1,\ldots t_r$ and the column sums are $s_1,\ldots s_c$. Then, according to I. J. Good,[3] the number of such tables is the coefficient of $x_1^{t_1}\ldots x_r^{t_r}y_1^{s_1}\ldots y_c^{s_c}$ in

$\prod_{i=1}^{r}\prod_{j=1}^c\frac{1}{1-x_iy_j}.$

## Applications

Generating functions are used to

• Find a closed formula for a sequence given in a recurrence relation. For example consider Fibonacci numbers.
• Find recurrence relations for sequences—the form of a generating function may suggest a recurrence formula.
• Find relationships between sequences—if the generating functions of two sequences have a similar form, then the sequences themselves may be related.
• Explore the asymptotic behaviour of sequences.
• Prove identities involving sequences.
• Solve enumeration problems in combinatorics and encoding their solutions. Rook polynomials are an example of an application in combinatorics.
• Evaluate infinite sums.

## Other generating functions

Examples of polynomial sequences generated by more complex generating functions include:

## Similar concepts

Polynomial interpolation is finding a polynomial whose values (not coefficients) agree with a given sequence; the Hilbert polynomial is an abstract case of this in commutative algebra.

## References

1. ^ Donald E. Knuth, The Art of Computer Programming, Volume 1 Fundamental Algorithms (Third Edition) Addison-Wesley. ISBN 0-201-89683-4. Section 1.2.9: Generating Functions, pp. 86
2. ^ This alternative term can already be found in E.N. Gilbert, Enumeration of Labeled graphs, Canadian Journal of Mathematics 3, 1956, p. 405–411, but its use is rare before the year 2000; since then it appears to be increasing
3. ^ Good, I. J. (1986). "On applications of symmetric Dirichlet distributions and their mixtures to contingency tables". The Annals of Statistics 4 (6): 1159–1189. doi:10.1214/aos/1176343649.

Wikimedia Foundation. 2010.

### Look at other dictionaries:

• generating function — generuojančioji funkcija statusas T sritis fizika atitikmenys: angl. generating function vok. erzeugende Funktion, f rus. производящая функция, f pranc. fonction génératrice, f …   Fizikos terminų žodynas

• Generating function (physics) — Generating functions which arise in Hamiltonian mechanics are quite different from generating functions in mathematics. In the case of physics, generating functions act as a bridge between two sets of canonical variables when performing canonical …   Wikipedia

• Moment-generating function — In probability theory and statistics, the moment generating function of any random variable is an alternative definition of its probability distribution. Thus, it provides the basis of an alternative route to analytical results compared with… …   Wikipedia

• Probability-generating function — In probability theory, the probability generating function of a discrete random variable is a power series representation (the generating function) of the probability mass function of the random variable. Probability generating functions are… …   Wikipedia

• Factorial moment generating function — In probability theory and statistics, the factorial moment generating function of the probability distribution of a real valued random variable X is defined as:M X(t)=operatorname{E}igl [t^{X}igr] for all complex numbers t for which this… …   Wikipedia

• Logmoment generating function — In mathematics, the logarithmic momentum generating function (equivalent to cumulant generating function) ( logmoment gen func ) is defined as follows::mu {Y}(s)=ln E(e^{scdot Y})where Y is a random variable.Thus, if Y is a discrete random… …   Wikipedia

• Coupon collector's problem (generating function approach) — The coupon collector s problem can be solved in several different ways. The generating function approach is a combinatorial technique that allows to obtain precise results. We introduce the probability generating function (PGF) G(z) where… …   Wikipedia

• Generating trigonometric tables — In mathematics, tables of trigonometric functions are useful in a number of areas. Before the existence of pocket calculators, trigonometric tables were essential for navigation, science and engineering. The calculation of mathematical tables was …   Wikipedia

• Generating set of a topological algebra — A generating set S of a topological algebra (e.g., a Banach algebra) A is a subset of A such that the smallest closed subalgebra of A containing S is A itself.Since polynomials are dense in the set C [0,1] of continuous functions on the interval… …   Wikipedia

• function generating potentiometer — netiesinis potenciometras statusas T sritis Standartizacija ir metrologija apibrėžtis Potenciometras, kurio parametrai kinta netiesiniu dėsniu, sukant potenciometro rankenėlę. atitikmenys: angl. function generating potentiometer; graded… …   Penkiakalbis aiškinamasis metrologijos terminų žodynas