Kalpana Kalpana (Editor)

Generating function

Updated on
Edit
Like
Comment
Share on FacebookTweet on TwitterShare on LinkedInShare on Reddit

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. One can generalize to formal series in more than one indeterminate, to encode information about arrays of numbers indexed by several natural numbers.

Contents

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, in that a series of terms can be said to be the generator of its sequence of term coefficients.

Definitions

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. —George Polya, Mathematics and plausible reasoning (1954) 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 ) = n = 0 a n x 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 ) = m , n = 0 a m , n x m y n .

Exponential generating function

The exponential generating function of a sequence an is

EG ( a n ; x ) = n = 0 a n x n n ! .

Exponential generating functions are generally more convenient than ordinary generating functions for combinatorial enumeration problems that involve labelled objects.

Poisson generating function

The Poisson generating function of a sequence an is

PG ( a n ; x ) = n = 0 a n e x x n n ! = e x EG ( a n ; x ) .

Lambert series

The Lambert series of a sequence an is

LG ( a n ; x ) = n = 1 a n x n 1 x n .

Note that in a Lambert series the index n starts at 1, not at 0, as the first term would otherwise be undefined.

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

BG p ( a n ; x ) = n = 0 a p n x n .

Dirichlet series generating functions

Formal 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

DG ( a n ; s ) = n = 1 a n n s .

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

DG ( a n ; s ) = p 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 x f ( t ) = n = 0 p n ( x ) 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 that of the constant sequence 1, 1, 1, 1, 1, 1, 1, 1, 1, ..., whose ordinary generating function is

n = 0 x n = 1 1 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 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:

n = 0 ( a x ) n = 1 1 a x .

(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,

n = 0 ( 1 ) n x n = 1 1 + 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

n = 0 x 2 n = 1 1 x 2 .

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

n = 0 ( n + 1 ) x n = 1 ( 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 ( n + 2 2 ) , so that

n = 0 ( n + 2 2 ) x n = 1 ( 1 x ) 3 .

More generally, for any non-negative integer k and non-zero real value a, it is true that

n = 0 a n ( n + k k ) x n = 1 ( 1 a x ) k + 1 .

Note that, since

2 ( n + 2 2 ) 3 ( n + 1 1 ) + ( n 0 ) = 2 ( n + 1 ) ( n + 2 ) 2 3 ( n + 1 ) + 1 = n 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 ) = n = 0 n 2 x n = 2 ( 1 x ) 3 3 ( 1 x ) 2 + 1 1 x = 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 with constant coefficients; this generalizes the examples above. Going in the reverse direction, 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).

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 , )

of a sequence with ordinary generating function G(anx) has the generating function

G ( a n ; x ) 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 ( a n ; e i ω ) = n = 0 a n e i ω n

is the discrete-time Fourier transform of the sequence a0a1, ....

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 ) = A ( x ) + B ( x ) ( 1 x r ) β x α

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

a n B ( r ) r α ( ( β n ) ) ( 1 / r ) n = B ( r ) r α ( n + β 1 n ) ( 1 / r ) n B ( r ) r α Γ ( β ) n β 1 ( 1 / r ) n ,

using a multiset coefficient, a binomial coefficient, or the Gamma function.

Often this approach can be iterated to generate several terms in an asymptotic series for an. In particular,

G ( a n B ( r ) r α ( n + β 1 n ) ( 1 / r ) n , x ) = G ( a n ; x ) B ( r ) r α ( 1 x r ) β .

The asymptotic growth of the coefficients of this generating function can then be sought via the finding of A, B, α, β, and r to describe the generating function, as above.

Similar asymptotic analysis is possible for exponential generating functions. With an exponential generating function, it is an/n! that grows according to these asymptotic formulae.

Asymptotic growth of the sequence of squares

As derived above, the ordinary generating function for the sequence of squares is

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 B ( r ) r α Γ ( β ) n β 1 ( 1 r ) n = 1 ( 1 + 1 ) 1 0 Γ ( 3 ) n 3 1 ( 1 / 1 ) n = n 2 .

Asymptotic growth of the Catalan numbers

The ordinary generating function for the Catalan numbers is

1 1 4 x 2 x .

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 B ( r ) r α Γ ( β ) n β 1 ( 1 r ) n = 1 2 ( 1 4 ) 1 Γ ( 1 2 ) n 1 2 1 ( 1 1 4 ) n = 1 π n 3 2 4 n .

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 ( 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 a n is

1 1 a y ,

the generating function for the binomial coefficients is:

n , k ( n k ) x k y n = 1 1 ( 1 + x ) y = 1 1 y x y .

Definitions

Expansions of (formal) Jacobi-type and Stieltjes-type continued fractions (J-fractions and S-fractions, respectively) whose h t h rational convergents represent 2 h -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 for some specific, application-dependent component sequences, { ab i } and { c i } , where z 0 denotes the formal variable in the second power series expansion given below:

J [ ] ( z ) = 1 1 c 1 z ab 2 z 2 1 c 2 z ab 3 z 2 = 1 + c 1 z + ( ab 2 + c 1 2 ) z 2 + ( 2 ab 2 c 1 + c 1 3 + ab 2 c 2 ) z 3 + .

The coefficients of z n , denoted in shorthand by j n := [ z n ] J [ ] ( z ) , in the previous equations correspond to matrix solutions of the equations

[ k 0 , 1 k 1 , 1 0 0 k 0 , 2 k 1 , 2 k 2 , 2 0 k 0 , 3 k 1 , 3 k 2 , 3 k 3 , 3 ] = [ k 0 , 0 0 0 0 k 0 , 1 k 1 , 1 0 0 k 0 , 2 k 1 , 2 k 2 , 2 0 ] [ c 1 1 0 0 ab 2 c 2 1 0 0 ab 3 c 3 1 ] ,

where j 0 k 0 , 0 = 1 , j n = k 0 , n for n 1 , k r , s = 0 if r > s , and where for all integers p , q 0 , we have an addition formula relation given by

j p + q = k 0 , p k 0 , q + i = 1 min ( p , q ) ab 2 ab i + 1 × k i , p k i , q .

Properties of the h t h {displaystyle h^{th}} convergent functions

For h 0 (though in practice when h 2 ), we can define the rational h t h convergents to the infinite J-fraction, J [ ] ( z ) , expanded by

Conv h ( z ) := P h ( z ) Q h ( z ) = j 0 + j 1 z + + j 2 h 1 z 2 h 1 + n 2 h j ~ h , n z n ,

component-wise through the sequences, P h ( z ) and Q h ( z ) , defined recursively by

P h ( z ) = ( 1 c h z ) P h 1 ( z ) ab h z 2 P h 2 ( z ) + δ h , 1 Q h ( z ) = ( 1 c h z ) Q h 1 ( z ) ab h z 2 Q h 2 ( z ) + ( 1 c 1 z ) δ h , 1 + δ 0 , 1 .

Moreover, the rationality of the convergent function, Conv h ( z ) for all h 2 implies additional finite difference equations and congruence properties satisfied by the sequence of j n , and for M h := ab 2 ab h + 1 if h | M h then we have the congruence

j n [ z n ] Conv h ( z ) ( mod h ) ,

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

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

For any prescribed, desired sequence of the j n := [ z n ] J [ ] ( z ) , we can solve for the first several special cases of the corresponding J-fraction component sequences, { ab i } and { c i } , using the next Mathematica code (Caution: Potentially high running times for the long initial list of trial functions).

Examples

The next table provides examples of closed-form formulas for the component sequences found computationally (and subsequently proved correct in the cited references ) in several special cases of the prescribed sequences, j n , generated by the general expansions of the J-fractions defined in the first subsection. Here we define 0 < | a | , | b | , | q | < 1 and the parameters R , α Z + and 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.

Examples

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

Ordinary generating function

G ( n 2 ; x ) = n = 0 n 2 x n = x ( x + 1 ) ( 1 x ) 3

Exponential generating function

EG ( n 2 ; x ) = n = 0 n 2 x n n ! = x ( x + 1 ) e x

Bell series

BG p ( n 2 ; x ) = n = 0 ( p n ) 2 x n = 1 1 p 2 x

Dirichlet series generating function

DG ( n 2 ; s ) = n = 1 n 2 n s = ζ ( s 2 ) ,

using the Riemann zeta function.

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

DG ( a n ; s ) = ζ ( s ) m

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

n = 1 a n x n = x + ( m 1 ) a = 2 x a + ( m 2 ) a = 2 b = 2 x a b + ( m 3 ) a = 2 b = 2 c = 2 x a b c + ( m 4 ) a = 2 b = 2 c = 2 d = 2 x a b c d +

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 , t r and the column sums are s 1 , s c . Then, according to I. J. Good, the number of such tables is the coefficient of

x 1 t 1 x r t r y 1 s 1 y c s c

in

i = 1 r j = 1 c 1 1 x i y j .

Techniques of evaluating sums with generating function

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

The simplest case occurs when s n = k = 0 n a k . We then know that S ( z ) = A ( z ) 1 z for the corresponding ordinary generating functions.

For example, we can manipulate s n = k = 1 n H k , where H k = 1 + 1 2 + + 1 k are the harmonic numbers. Let H ( z ) = n 1 H n z n be the ordinary generating function of the harmonic numbers. Then

H ( z ) = n 1 1 n z n 1 z ,

and thus

S ( z ) = n 1 s n z n = n 1 1 n z n ( 1 z ) 2 .

Using 1 ( 1 z ) 2 = n 0 ( n + 1 ) z n , convolution with the numerator yields

s n = k = 1 n 1 k ( n + 1 k ) = ( n + 1 ) H n n ,

which can also be written as

k = 1 n H k = ( n + 1 ) ( H n + 1 1 ) .

Convolution

1.Consider A(z) and B(z) are ordinary generating functions. 2.Consider A(z) and B(z) are exponential generating functions.

Free parameter

Sometimes the sum 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 as limit in the summation. When n does not appear explicitly in the summation, we may consider n as a “free” parameter and treat s n as a coefficient of F ( z ) = s n z n , change the order of the summations on n and k , and try to compute the inner sum.

For example, if we want to compute

s n = k 0 ( n + k m + 2 k ) ( 2 k k ) ( 1 ) k k + 1 ( m , n N 0 )

we can treat n as a "free" parameter, and set

F ( z ) = n 0 [ k 0 ( n + k m + 2 k ) ( 2 k k ) ( 1 ) k k + 1 ] z n

Interchanging summation (“snake oil”) gives

F ( z ) = k 0 ( 2 k k ) ( 1 ) k k + 1 z k n 0 ( n + k m + 2 k ) z n + k

Now the inner sum is z m + 2 k ( 1 z ) m + 2 k + 1 . Thus

F ( z ) = z m ( 1 z ) m + 1 k 0 1 k + 1 ( 2 k k ) ( z ( 1 z ) 2 ) k = z m ( 1 z ) m + 1 k 0 C k ( z ( 1 z ) 2 ) k ( w h e r e , C k = k t h C a t a l a n n u m b e r ) = z m ( 1 z ) m + 1 1 1 + 4 z ( 1 z ) 2 2 z ( 1 z ) 2 = z m 1 2 ( 1 z ) m 1 ( 1 1 + z 1 z ) = z m ( 1 z ) m = z z m 1 ( 1 z ) m .

Then we obtain

s n = ( n 1 m 1 ) f o r m 1 , s n = [ n = 0 ] f o r m = 0.

Other 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:

  • Appell polynomials
  • Chebyshev polynomials
  • Difference polynomials
  • Generalized Appell polynomials
  • Q-difference polynomials
  • Other sequences generated by more complex generating functions:

  • Double exponential generating functions. For example: Aitken's Array: Triangle of Numbers
  • History

    George Polya writes in Mathematics and plausible reasoning:

    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.

    References

    Generating function Wikipedia