Inmathematics, agenerating function is a representation of aninfinite sequence of numbers as thecoefficients of aformal power series. Generating functions are often expressed inclosed form (rather than as a series), by some expression involving operations on the formal series.
There are various types of generating functions, includingordinary generating functions,exponential generating functions,Lambert series,Bell series, andDirichlet series. 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 sometimes calledgenerating series,[1] in that a series of terms can be said to be the generator of its sequence of term coefficients.
Generating functions were first introduced byAbraham de Moivre in 1730, in order to solve the general linear recurrence problem.[2]
George Pólya writes inMathematics and plausible reasoning:
The name "generating function" is due toLaplace. 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 theTheory of Numbers.
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.
A generating function is a clothesline on which we hang up a sequence of numbers for display.
— Herbert Wilf,Generatingfunctionology (1994)
Unlike an ordinary series, theformalpower series is not required toconverge: in fact, the generating function is not actually regarded as afunction, and the "variable" remains anindeterminate. One can generalize to formal power series in more than one indeterminate, to encode information about infinite multi-dimensional arrays of numbers. Thus generating functions are not functions in the formal sense of a mapping from adomain to acodomain.
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 ofx, and which has the formal series as itsseries expansion; this explains the designation "generating functions". However such interpretation is not required to be possible, because formal series are not required to give aconvergent series when a nonzero numeric value is substituted for x.
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.
When the termgenerating function is used without qualification, it is usually taken to mean an ordinary generating function. Theordinary generating function of a sequencean is:Ifan is theprobability mass function of adiscrete random variable, then its ordinary generating function is called aprobability-generating function.
Theexponential generating function of a sequencean is
Exponential generating functions are generally more convenient than ordinary generating functions forcombinatorial enumeration problems that involve labelled objects.[3]
Another benefit of exponential generating functions is that they are useful in transferring linearrecurrence relations to the realm ofdifferential equations. For example, take theFibonacci sequence{fn} that satisfies the linear recurrence relationfn+2 =fn+1 +fn. The corresponding exponential generating function has the form
and its derivatives can readily be shown to satisfy the differential equationEF″(x) = EF′(x) + EF(x) as a direct analogue with the recurrence relation above. In this view, the factorial termn! is merely a counter-term to normalise the derivative operator acting onxn.
ThePoisson generating function of a sequencean is
TheLambert series of a sequencean isNote that in a Lambert series the indexn starts at 1, not at 0, as the first term would otherwise be undefined.
The Lambert series coefficients in the power series expansionsfor integersn ≥ 1 are related by thedivisor sumThemain article provides several more classical, or at least well-known examples related to specialarithmetic functions innumber theory. As an example of a Lambert series identity not given in the main article, we can show that for|x|, |xq| < 1 we have that[4]
where we have the special case identity for the generating function of thedivisor function,d(n) ≡σ0(n), given by
TheBell series of a sequencean is an expression in terms of both an indeterminatex and a primep and is given by:[5]
Formal Dirichlet series are often classified as generating functions, although they are not strictly formal power series. TheDirichlet series generating function of a sequencean is:[6]
The Dirichlet series generating function is especially useful whenan is amultiplicative function, in which case it has anEuler product expression[7] in terms of the function's Bell series:
Ifan is aDirichlet character then its Dirichlet series generating function is called aDirichletL-series. We also have a relation between the pair of coefficients in theLambert series expansions above and their DGFs. Namely, we can prove that:if and only ifwhereζ(s) is theRiemann zeta function.[8]
The sequenceak generated by aDirichlet series generating function (DGF) corresponding to:has the ordinary generating function:
The idea of generating functions can be extended to sequences of other objects. Thus, for example, polynomial sequences ofbinomial type are generated by:wherepn(x) is a sequence of polynomials andf(t) is a function of a certain form.Sheffer sequences are generated in a similar way. See the main articlegeneralized Appell polynomials for more information.
Examples ofpolynomial sequences generated by more complex generating functions include:
Other sequences generated by more complex generating functions include:
Knuth's article titled "Convolution Polynomials"[9] defines a generalized class ofconvolution polynomial sequences by their special generating functions of the formfor some analytic functionF with a power series expansion such thatF(0) = 1.
We say that a family of polynomials,f0,f1,f2, ..., forms aconvolution family ifdegfn ≤n and if the following convolution condition holds for allx,y and for alln ≥ 0:
We see that for non-identically zero convolution families, this definition is equivalent to requiring that the sequence have an ordinary generating function of the first form given above.
A sequence of convolution polynomials defined in the notation above has the following properties:
For a fixed non-zero parameter, we have modified generating functions for these convolution polynomial sequences given bywhere𝓕t(z) is implicitly defined by afunctional equation of the form𝓕t(z) =F(x𝓕t(z)t). Moreover, we can use matrix methods (as in the reference) to prove that given two convolution polynomial sequences,⟨fn(x) ⟩ and⟨gn(x) ⟩, with respective corresponding generating functions,F(z)x andG(z)x, then for arbitraryt we have the identity
Examples of convolution polynomial sequences include thebinomial power series,𝓑t(z) = 1 +z𝓑t(z)t, so-termedtree polynomials, theBell numbers,B(n), theLaguerre polynomials, and theStirling convolution polynomials.
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 thePoincaré polynomial and others.
A fundamental generating function is that of the constant sequence1, 1, 1, 1, 1, 1, 1, 1, 1, ..., whose ordinary generating function is thegeometric series
The left-hand side is theMaclaurin series expansion of the right-hand side. Alternatively, the equality can be justified by multiplying the power series on the left by1 −x, and checking that the result is the constant power series 1 (in other words, that all coefficients except the one ofx0 are equal to 0). Moreover, there can be no other power series with this property. The left-hand side therefore designates themultiplicative inverse of1 −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 substitutionx →ax gives the generating function for thegeometric sequence1,a,a2,a3, ... for any constanta:
(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,
One can also introduce regular gaps in the sequence by replacingx by some power ofx, so for instance for the sequence1, 0, 1, 0, 1, 0, 1, 0, ... (which skips overx,x3,x5, ...) one gets the generating function
By squaring the initial generating function, or by finding the derivative of both sides with respect tox and making a change of running variablen →n + 1, one sees that the coefficients form the sequence1, 2, 3, 4, 5, ..., so one has
and the third power has as coefficients thetriangular numbers1, 3, 6, 10, 15, 21, ... whose termn is thebinomial coefficient(n + 2
2), so that
More generally, for any non-negative integerk and non-zero real valuea, it is true that
Since
one can find the ordinary generating function for the sequence0, 1, 4, 9, 16, ... ofsquare numbers by linear combination of binomial-coefficient generating sequences:
We may also expand alternately to generate this same sequence of squares as a sum of derivatives of thegeometric series in the following form:
By induction, we can similarly show for positive integersm ≥ 1 that[10][11]
where{n
k} denote theStirling numbers of the second kind and where the generating function
so that we can form the analogous generating functions over the integralmth powers generalizing the result in the square case above. In particular, since we can write
we can apply a well-known finite sum identity involving theStirling numbers to obtain that[12]
The ordinary generating function of a sequence can be expressed as arational function (the ratio of two finite-degree polynomials) if and only if the sequence is alinear 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 linearfinite 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 deriveBinet's formula for theFibonacci numbers via generating function techniques.
We also notice that the class of rational generating functions precisely corresponds to the generating functions that enumeratequasi-polynomial sequences of the form[13]
where the reciprocal roots,, are fixed scalars and wherepi(n) is a polynomial inn for all1 ≤i ≤ℓ.
In general,Hadamard products of rational functions produce rational generating functions. Similarly, if
is a bivariate rational generating function, then its correspondingdiagonal generating function,
isalgebraic. For example, if we let[14]
then this generating function's diagonal coefficient generating function is given by the well-known OGF formula
This result is computed in many ways, includingCauchy's integral formula orcontour integration, taking complexresidues, or by direct manipulations offormal power series in two variables.
Multiplication of ordinary generating functions yields a discreteconvolution (theCauchy product) of the sequences. For example, the sequence of cumulative sums (compare to the slightly more generalEuler–Maclaurin formula)of a sequence with ordinary generating functionG(an;x) has the generating functionbecause1/1 −x is the ordinary generating function for the sequence(1, 1, ...). See also thesection on convolutions in the applications section of this article below for further examples of problem solving with convolutions of generating functions and interpretations.
For integersm ≥ 1, we have the following two analogous identities for the modified generating functions enumerating the shifted sequence variants of⟨gn −m ⟩ and⟨gn +m ⟩, respectively:
We have the following respective power series expansions for the first derivative of a generating function and its integral:
The differentiation–multiplication operation of the second identity can be repeatedk times to multiply the sequence bynk, but that requires alternating between differentiation and multiplication. If instead doingk differentiations in sequence, the effect is to multiply by thekthfalling factorial:
Using theStirling numbers of the second kind, that can be turned into another formula for multiplying by as follows (see the main article ongenerating function transformations):
A negative-order reversal of this sequence powers formula corresponding to the operation of repeated integration is defined by thezeta series transformation and its generalizations defined as a derivative-basedtransformation of generating functions, or alternately termwise by and performing anintegral transformation on the sequence generating function. Related operations of performingfractional integration on a sequence generating function are discussedhere.
In this section we give formulas for generating functions enumerating the sequence{fan +b} given an ordinary generating functionF(z), wherea ≥ 2,0 ≤b <a, anda andb are integers (see themain article on transformations). Fora = 2, this is simply the familiar decomposition of a function intoeven and odd parts (i.e., even and odd powers):
More generally, suppose thata ≥ 3 and thatωa = exp2πi/a denotes theathprimitive root of unity. Then, as an application of thediscrete Fourier transform, we have the formula[15]
For integersm ≥ 1, another useful formula providing somewhatreversed floored arithmetic progressions — effectively repeating each coefficientm times — are generated by the identity[16]
A formal power series (or function)F(z) is said to beholonomic if it satisfies a linear differential equation of the form[17]
where the coefficientsci(z) are in the field of rational functions,. Equivalently, is holonomic if the vector space over 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) are polynomials inz. Thus we can see an equivalent condition that a generating function is holonomic if its coefficients satisfy aP-recurrence of the form
for all large enoughn ≥n0 and where theĉi(n) are fixed finite-degree polynomials inn. In other words, the properties that a sequence beP-recursive and have a holonomic generating function are equivalent. Holonomic functions are closed under theHadamard product operation⊙ on generating functions.
The functionsez,logz,cosz,arcsinz,, thedilogarithm functionLi2(z), thegeneralized hypergeometric functionspFq(...; ...;z) and the functions defined by the power series
and the non-convergentare all holonomic.
Examples ofP-recursive sequences with holonomic generating functions includefn ≔1/n + 1(2n
n) andfn ≔2n/n2 + 1, where sequences such as andlogn arenotP-recursive due to the nature of singularities in their corresponding generating functions. Similarly, functions with infinitely many singularities such astanz,secz, andΓ(z) arenot holonomic functions.
Tools for processing and working withP-recursive sequences inMathematica include the software packages provided for non-commercial use on theRISC Combinatorics Group algorithmic combinatorics software site. Despite being mostly closed-source, particularly powerful tools in this software suite are provided by theGuess
package for guessingP-recurrences for arbitrary input sequences (useful forexperimental mathematics and exploration) and theSigma
package which is able to find P-recurrences for many sums and solve for closed-form solutions toP-recurrences involving generalizedharmonic numbers.[18] Other packages listed on this particular RISC site are targeted at working with holonomicgenerating functions specifically.
When the seriesconverges absolutely,is the discrete-time Fourier transform of the sequencea0,a1, ....
In calculus, often the growth rate of the coefficients of a power series can be used to deduce aradius 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 theasymptotic growth of the underlying sequence.
For instance, if an ordinary generating functionG(an;x) that has a finite radius of convergence ofr can be written as
where each ofA(x) andB(x) is a function that isanalytic to a radius of convergence greater thanr (or isentire), and whereB(r) ≠ 0 thenusing thegamma function, abinomial coefficient, or amultiset coefficient. Note that limit asn goes to infinity of the ratio ofan to any of these expressions is guaranteed to be 1; not merely thatan is proportional to them.
Often this approach can be iterated to generate several terms in an asymptotic series foran. In particular,
The asymptotic growth of the coefficients of this generating function can then be sought via the finding ofA,B,α,β, andr to describe the generating function, as above.
Similar asymptotic analysis is possible for exponential generating functions; with an exponential generating function, it isan/n! that grows according to these asymptotic formulae. Generally, if the generating function of one sequence minus the generating function of a second sequence has a radius of convergence that is larger than the radius of convergence of the individual generating functions then the two sequences have the same asymptotic growth.
As derived above, the ordinary generating function for the sequence of squares is:
Withr = 1,α = −1,β = 3,A(x) = 0, andB(x) =x + 1, we can verify that the squares grow as expected, like the squares:
The ordinary generating function for theCatalan numbers is
Withr =1/4,α = 1,β = −1/2,A(x) =1/2, andB(x) = −1/2, we can conclude that, for the Catalan numbers:
The generating function in several variables can be generalized to arrays with multiple indices. These non-polynomial double sum examples are calledmultivariate generating functions, orsuper generating functions. For two variables, these are often calledbivariate generating functions.
The ordinary generating function of a two-dimensional arrayam,n (wheren andm are natural numbers) is:For instance, since(1 +x)n is the ordinary generating function forbinomial coefficients for a fixedn, one may ask for a bivariate generating function that generates the binomial coefficients(n
k) for allk andn. To do this, consider(1 +x)n itself as a sequence inn, and find the generating function iny that has these sequence values as coefficients. Since the generating function foran is:the generating function for the binomial coefficients is:Other examples of such include the following two-variable generating functions for thebinomial coefficients, theStirling numbers, and theEulerian numbers, whereω andz denote the two variables:[19]
Multivariate generating functions arise in practice when calculating the number ofcontingency tables of non-negative integers with specified row and column totals. Suppose the table hasr rows andc columns; the row sums aret1,t2 ...tr and the column sums ares1,s2 ...sc. Then, according toI. J. Good,[20] the number of such tables is the coefficient of:in:
Expansions of (formal)Jacobi-type andStieltjes-typecontinued fractions (J-fractions andS-fractions, respectively) whosehth rational convergents represent2h-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 theJacobi-type continued fractions (J-fractions) are expanded as in the following equation and have the next corresponding power series expansions with respect toz for some specific, application-dependent component sequences,{abi} and{ci}, wherez ≠ 0 denotes the formal variable in the second power series expansion given below:[21]
The coefficients of, denoted in shorthand byjn ≔ [zn]J[∞](z), in the previous equations correspond to matrix solutions of the equations:
wherej0 ≡k0,0 = 1,jn =k0,n forn ≥ 1,kr,s = 0 ifr >s, and where for all integersp,q ≥ 0, we have anaddition formula relation given by:
Forh ≥ 0 (though in practice whenh ≥ 2), we can define the rationalhth convergents to the infiniteJ-fraction,J[∞](z), expanded by:
component-wise through the sequences,Ph(z) andQh(z), defined recursively by:
Moreover, the rationality of the convergent functionConvh(z) for allh ≥ 2 implies additional finite difference equations and congruence properties satisfied by the sequence ofjn,and forMh ≔ ab2 ⋯ abh + 1 ifh ‖Mh then we have the congruence
for non-symbolic, determinate choices of the parameter sequences{abi} and{ci} whenh ≥ 2, that is, when these sequences do not implicitly depend on an auxiliary parameter such asq,x, orR as in the examples contained in the table below.
The next table provides examples of closed-form formulas for the component sequences found computationally (and subsequently proved correct in the cited references[22])in several special cases of the prescribed sequences,jn, generated by the general expansions of theJ-fractions defined in the first subsection. Here we define0 < |a|, |b|, |q| < 1 and the parameters andx to be indeterminates with respect to these expansions, where the prescribed sequences enumerated by the expansions of theseJ-fractions are defined in terms of theq-Pochhammer symbol,Pochhammer symbol, and thebinomial coefficients.
The radii of convergence of these series corresponding to the definition of the Jacobi-typeJ-fractions given above are in general different from that of the corresponding power series expansions defining the ordinary generating functions of these sequences.
Generating functions for the sequence ofsquare numbersan =n2 are:
Generating function type | Equation |
---|---|
Ordinary generating function | |
Exponential generating function | |
Bell series | |
Dirichlet series |
whereζ(s) is theRiemann zeta function.
Generating functions are used to:
Generating functions give us several methods to manipulate sums and to establish identities between sums.
The simplest case occurs whensn = Σn
k = 0ak. We then know thatS(z) =A(z)/1 −z for the corresponding ordinary generating functions.
For example, we can manipulatewhereHk = 1 +1/2 + ⋯ +1/k are theharmonic numbers. Letbe the ordinary generating function of the harmonic numbers. Thenand thus
Usingconvolution with the numerator yieldswhich can also be written as
As another example of using generating functions to relate sequences and manipulate sums, for an arbitrary sequence⟨fn ⟩ we define the two sequences of sumsfor alln ≥ 0, and seek to express the second sums in terms of the first. We suggest an approach by generating functions.
First, we use thebinomial transform to write the generating function for the first sum as
Since the generating function for the sequence⟨ (n + 1)(n + 2)(n + 3)fn ⟩ is given bywe may write the generating function for the second sum defined above in the form
In particular, we may write this modified sum generating function in the form offora(z) = 6(1 − 3z)3,b(z) = 18(1 − 3z)3,c(z) = 9(1 − 3z)3, andd(z) = (1 − 3z)3, where(1 − 3z)3 = 1 − 9z + 27z2 − 27z3.
Finally, it follows that we may express the second sums through the first sums in the following form:
In this example, we reformulate a generating function example given in Section 7.3 ofConcrete 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 (denotedUn) to tile a 3-by-n rectangle with unmarked 2-by-1 domino pieces. Let the auxiliary sequence,Vn, be defined as the number of ways to cover a 3-by-n rectangle-minus-corner section of the full rectangle. We seek to use these definitions to give aclosed form formula forUn 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-by-n rectangle, we are able to express the following mutually dependent, ormutually recursive, recurrence relations for our two sequences whenn ≥ 2 defined as above whereU0 = 1,U1 = 0,V0 = 0, andV1 = 1:
Since we have that for all integersm ≥ 0, the index-shifted generating functions satisfy[note 1]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 bywhich then implies by solving the system of equations (and this is the particular trick to our method here) that
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 thatU2n + 1 ≡ 0 and thatfor all integersn ≥ 0. We also note that the same shifted generating function technique applied to the second-orderrecurrence for theFibonacci 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 onrational functions given above.
A discreteconvolution 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 (seeCauchy 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 theprobability generating function, orpgf, of a random variableZ is denoted byGZ(z), then we can show that for any two random variables[23]ifX andY are independent.
The number of ways to payn ≥ 0 cents in coin denominations of values in the set {1, 5, 10, 25, 50} (i.e., in pennies, nickels, dimes, quarters, and half dollars, respectively), where we distinguish instances based upon the total number of each coin but not upon the order in which the coins are presented, is given by the ordinary generating functionWhen we also distinguish based upon the order in which the coins are presented (e.g., one penny then one nickel is distinct from one nickel then one penny), the ordinary generating function is
If we allow then cents to be paid in coins ofany positive integer denomination, we arrive at thepartition function ordinary generating function expanded by an infiniteq-Pochhammer symbol product,When the order of the coins matters, the ordinary generating function is
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 theCatalan numbers,Cn. In particular, this sequence has the combinatorial interpretation as being the number of ways to insert parentheses into the productx0 ·x1 ·⋯·xn so that the order of multiplication is completely specified. For example,C2 = 2 which corresponds to the two expressionsx0 · (x1 ·x2) and(x0 ·x1) ·x2. It follows that the sequence satisfies a recurrence relation given byand so has a corresponding convolved generating function,C(z), satisfying
SinceC(0) = 1 ≠ ∞, we then arrive at a formula for this generating function given by
Note that the first equation implicitly definingC(z) above implies thatwhich then leads to another "simple" (of form) continued fraction expansion of this generating function.
Afan of ordern is defined to be a graph on the vertices{0, 1, ...,n} with2n − 1 edges connected according to the following rules: Vertex 0 is connected by a single edge to each of the othern vertices, and vertex is connected by a single edge to the next vertexk + 1 for all1 ≤k <n.[24] There is one fan of order one, three fans of order two, eight fans of order three, and so on. Aspanning 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 treesfn of a fan of ordern are possible for eachn ≥ 1.
As an observation, we may approach the question by counting the number of ways to join adjacent sets of vertices. For example, whenn = 4, we have thatf4 = 4 + 3 · 1 + 2 · 2 + 1 · 3 + 2 · 1 · 1 + 1 · 2 · 1 + 1 · 1 · 2 + 1 · 1 · 1 · 1 = 21, which is a sum over them-fold convolutions of the sequencegn =n = [zn]z/(1 −z)2 form ≔ 1, 2, 3, 4. More generally, we may write a formula for this sequence asfrom which we see that the ordinary generating function for this sequence is given by the next sum of convolutions asfrom which we are able to extract an exact formula for the sequence by taking thepartial fraction expansion of the last generating function.
![]() | This sectionneeds expansion with: This section needs to be added to the list of techniques with generating functions. You can help byadding to it.(April 2017) |
One often encounters generating functions specified by a functional equation, instead of an explicit specification. For example, the generating functionT(z) for the number of binary trees onn nodes (leaves included) satisfies
TheLagrange inversion theorem is a tool used to explicitly evaluate solutions to such equations.
Lagrange inversion formula—Let be a formal power series with a non-zero constant term. Then the functional equationadmits a unique solution in, which satisfies
where the notation returns the coefficient of in.
Applying the above theorem to our functional equation yields (with):
Via the binomial theorem expansion, for even, the formula returns. This is expected as one can prove that the number of leaves of a binary tree are one more than the number of its internal nodes, so the total sum should always be an odd number. For odd, however, we get
The expression becomes much neater if we let be the number of internal nodes: Now the expression just becomes theth Catalan number.
Sometimes the sumsn 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 haven as limit in the summation. When n does not appear explicitly in the summation, we may considern as a "free" parameter and treatsn as a coefficient ofF(z) = Σsnzn, change the order of the summations onn andk, and try to compute the inner sum.
For example, if we want to computewe can treatn as a "free" parameter, and set
Interchanging summation ("snake oil") gives
Now the inner sum iszm + 2k/(1 −z)m + 2k + 1. Thus
Then we obtain
It is instructive to use the same method again for the sum, but this time takem as the free parameter instead ofn. We thus set
Interchanging summation ("snake oil") gives
Now the inner sum is(1 +z)n +k. Thus
Thus we obtainform ≥ 1 as before.
We say that two generating functions (power series) are congruent modulom, writtenA(z) ≡B(z) (modm) if their coefficients are congruent modulom for alln ≥ 0, i.e.,an ≡bn (modm) for all relevant cases of the integersn (note that we need not assume thatm is an integer here—it may very well be polynomial-valued in some indeterminatex, for example). If the "simpler" right-hand-side generating function,B(z), is a rational function ofz, then the form of this sequence suggests that the sequence iseventually periodic modulo fixed particular cases of integer-valuedm ≥ 2. For example, we can prove that theEuler numbers,satisfy the following congruence modulo 3:[25]
One useful method of obtaining congruences for sequences enumerated by special generating functions modulo any integers (i.e., not only prime powerspk) is given in the section on continued fraction representations of (even non-convergent) ordinary generating functions byJ-fractions above. We cite one particular result related to generating series expanded through a representation by continued fraction from Lando'sLectures on Generating Functions as follows:
Theorem: congruences for series generated by expansions of continued fractions—Suppose that the generating functionA(z) is represented by an infinitecontinued fraction of the formand thatAp(z) denotes thepth convergent to this continued fraction expansion defined such thatan = [zn]Ap(z) for all0 ≤n < 2p. Then:
Generating functions also have other uses in proving congruences for their coefficients. We cite the next two specific examples deriving special case congruences for theStirling numbers of the first kind and for thepartition functionp(n) which show the versatility of generating functions in tackling problems involvinginteger sequences.
Themain article on the Stirling numbers generated by the finite products
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 referenceGeneratingfunctionology.We repeat the basic argument and notice that when reduces modulo 2, these finite product generating functions each satisfy
which implies that the parity of theseStirling numbers matches that of the binomial coefficient
and consequently shows that[n
k] is even wheneverk < ⌊n/2 ⌋.
Similarly, we can reduce the right-hand-side products defining the Stirling number generating functions modulo 3 to obtain slightly more complicated expressions providing that
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 thatthepartition functionp(n) is generated by the reciprocal infiniteq-Pochhammer symbol product (orz-Pochhammer product as the case may be) given by
This partition function satisfies many knowncongruence properties, which notably include the following results though there are still many open questions about the forms of related integer congruences for the function:[26]
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 in the binomial coefficient generating functionall of the coefficients are divisible by 5 except for those which correspond to the powers1,z5,z10, ... and moreover in those cases the remainder of the coefficient is 1 modulo 5. Thus, or equivalentlyIt follows that
Using the infinite product expansions ofit can be shown that the coefficient ofz5m + 5 inz · ((1 −z)(1 −z2)⋯)4 is divisible by 5 for allm.[27] Finally, sincewe may equate the coefficients ofz5m + 5 in the previous equations to prove our desired congruence result, namely thatp(5m + 4) ≡ 0 (mod 5) for allm ≥ 0.
There are a number of transformations of generating functions that provide other applications (see themain article). A transformation of a sequence'sordinary 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 (seeintegral transformations) or weighted sums over the higher-order derivatives of these functions (seederivative transformations).
Generating function transformations can come into play when we seek to express a generating function for the sums
in the form ofS(z) =g(z)A(f(z)) involving the original sequence generating function. For example, if the sums arethen the generating function for the modified sum expressions is given by[28](see also thebinomial transform and theStirling transform).
There are also integral formulas for converting between a sequence's OGF,F(z), and its exponential generating function, or EGF,F̂(z), and vice versa given by
provided that these integrals converge for appropriate values ofz.
An initial listing of special mathematical series is foundhere. A number of useful and special sequence generating functions are found in Section 5.4 and 7.4 ofConcrete Mathematics and in Section 2.5 of Wilf'sGeneratingfunctionology. Other special generating functions of note include the entries in the next table, which is by no means complete.[29]
![]() | This sectionneeds expansion with: Lists of special and special sequence generating functions. The next table is a start. You can help byadding to it.(April 2017) |
Formal power series | Generating-function formula | Notes |
---|---|---|
is a first-orderharmonic number | ||
is aBernoulli number | ||
is aFibonacci number and | ||
denotes therising factorial, orPochhammer symbol and some integer | ||
is thepolylogarithm function and is a generalizedharmonic number for | ||
is aStirling number of the second kind and where the individual terms in the expansion satisfy | ||
The two-variable case is given by | ||