Examples for simple sequences 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 fundamental generating function is that of the constant sequence , whose ordinary generating function is the
geometric series \sum_{n=0}^\infty x^n= \frac{1}{1-x}. The left-hand side is the
Maclaurin series expansion of the right-hand side. Alternatively, the equality can be justified by multiplying the power series on the left by , and checking that the result is the constant power series 1 (in other words, that all coefficients except the one of are equal to 0). Moreover, there can be no other power series with this property. The left-hand side therefore designates the
multiplicative inverse of 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 gives the generating function for the
geometric sequence for any constant : \sum_{n=0}^\infty(ax)^n= \frac{1}{1-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= \frac{1}{1+x}. One can also introduce regular gaps in the sequence by replacing by some power of , so for instance for the sequence (which skips over ) one gets the generating function \sum_{n=0}^\infty x^{2n} = \frac{1}{1-x^2}. By squaring the initial generating function, or by finding the derivative of both sides with respect to and making a change of running variable , one sees that the coefficients form the sequence , so one has \sum_{n=0}^\infty(n+1)x^n= \frac{1}{(1-x)^2}, and the third power has as coefficients the
triangular numbers whose term is the
binomial coefficient , so that \sum_{n=0}^\infty\binom{n+2}2 x^n= \frac{1}{(1-x)^3}. More generally, for any non-negative integer and non-zero real value , it is true that \sum_{n=0}^\infty a^n\binom{n+k}k x^n= \frac{1}{(1-ax)^{k+1}}\,. Since 2\binom{n+2}2 - 3\binom{n+1}1 + \binom{n}0 = 2\frac{(n+1)(n+2)}2 -3(n+1) + 1 = n^2, one can find the ordinary generating function for the sequence of
square numbers by linear combination of binomial-coefficient generating sequences: G(n^2;x) = \sum_{n=0}^\infty n^2x^n = \frac{2}{(1-x)^3} - \frac{3}{(1-x)^2} + \frac{1}{1-x} = \frac{x(x+1)}{(1-x)^3}. We may also expand alternately to generate this same sequence of squares as a sum of derivatives of the
geometric series in the following form: \begin{align} G(n^2;x) & = \sum_{n=0}^\infty n^2x^n \\[4px] & = \sum_{n=0}^\infty n(n-1) x^n + \sum_{n=0}^\infty n x^n \\[4px] & = x^2 D^2\left[\frac{1}{1-x}\right] + x D\left[\frac{1}{1-x}\right] \\[4px] & = \frac{2 x^2}{(1-x)^3} + \frac{x}{(1-x)^2} =\frac{x(x+1)}{(1-x)^3}. \end{align} By induction, we can similarly show for positive integers that n^m = \sum_{j=0}^m \begin{Bmatrix} m \\ j \end{Bmatrix} \frac{n!}{(n-j)!}, where {{math|{{resize|150%|{}}{{resize|150%|}}}}} denote the
Stirling numbers of the second kind and where the generating function \sum_{n = 0}^\infty \frac{n!}{ (n-j)!} \, z^n = \frac{j! \cdot z^j}{(1-z)^{j+1}}, so that we can form the analogous generating functions over the integral th powers generalizing the result in the square case above. In particular, since we can write \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 \sum_{n = 0}^\infty n^m z^n = \sum_{j=0}^m \begin{Bmatrix} m+1 \\ j+1 \end{Bmatrix} \frac{(-1)^{m-j} j!}{(1-z)^{j+1}}.
Rational functions 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 f_n = p_1(n) \rho_1^n + \cdots + p_\ell(n) \rho_\ell^n, where the reciprocal roots, \rho_i \isin \mathbb{C}, are fixed scalars and where is a polynomial in for all . In general,
Hadamard products of rational functions produce rational generating functions. Similarly, if F(s, t) := \sum_{m,n \geq 0} f(m, n) w^m z^n is a bivariate rational generating function, then its corresponding
diagonal generating function, \operatorname{diag}(F) := \sum_{n = 0}^\infty f(n, n) z^n, is
algebraic. For example, if we let F(s, t) := \sum_{i,j \geq 0} \binom{i+j}{i} s^i t^j = \frac{1}{1-s-t}, then this generating function's diagonal coefficient generating function is given by the well-known OGF formula \operatorname{diag}(F) = \sum_{n = 0}^\infty \binom{2n}{n} z^n = \frac{1}{\sqrt{1-4z}}. This result is computed in many ways, including
Cauchy's integral formula or
contour integration, taking complex
residues, or by direct manipulations of
formal power series in two variables.
Operations on generating functions 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 (compare to the slightly more general
Euler–Maclaurin formula) (a_0, a_0 + a_1, a_0 + a_1 + a_2, \ldots) of a sequence with ordinary generating function has the generating function G(a_n; x) \cdot \frac{1}{1-x} because is the ordinary generating function for the sequence . 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.
Shifting sequence indices For integers , we have the following two analogous identities for the modified generating functions enumerating the shifted sequence variants of and , respectively: \begin{align} & z^m G(z) = \sum_{n = m}^\infty g_{n-m} z^n \\[4px] & \frac{G(z) - g_0 - g_1 z - \cdots - g_{m-1} z^{m-1}}{z^m} = \sum_{n = 0}^\infty g_{n+m} z^n. \end{align}
Differentiation and integration of generating functions We have the following respective power series expansions for the first derivative of a generating function and its integral: \begin{align} G'(z) & = \sum_{n = 0}^\infty (n+1) g_{n+1} z^n \\[4px] z \cdot G'(z) & = \sum_{n = 0}^\infty n g_{n} z^n \\[4px] \int_0^z G(t) \, dt & = \sum_{n = 1}^\infty \frac{g_{n-1}}{n} z^n. \end{align} The differentiation–multiplication operation of the second identity can be repeated times to multiply the sequence by , but that requires alternating between differentiation and multiplication. If instead doing differentiations in sequence, the effect is to multiply by the th
falling factorial: z^k G^{(k)}(z) = \sum_{n = 0}^\infty n^\underline{k} g_n z^n = \sum_{n = 0}^\infty n (n-1) \dotsb (n-k+1) g_n z^n \quad\text{for all } k \in \mathbb{N}. Using the
Stirling numbers of the second kind, that can be turned into another formula for multiplying by n^k as follows (see the main article on
generating function transformations): \sum_{j=0}^k \begin{Bmatrix} k \\ j \end{Bmatrix} z^j F^{(j)}(z) = \sum_{n = 0}^\infty n^k f_n z^n \quad\text{for all } k \in \mathbb{N}. A negative-order reversal of this sequence powers formula corresponding to the operation of repeated integration is defined by the
zeta series transformation and its generalizations defined as a derivative-based
transformation of generating functions, or alternately termwise by and performing an
integral transformation on the sequence generating function. Related operations of performing
fractional integration on a sequence generating function are discussed
here.
Enumerating arithmetic progressions of sequences In this section we give formulas for generating functions enumerating the sequence {{math|{
fan +
b}}} given an ordinary generating function , where , , and and are integers (see the
main article on transformations). For , this is simply the familiar decomposition of a function into
even and odd parts (i.e., even and odd powers): \begin{align} \sum_{n = 0}^\infty f_{2n} z^{2n} &= \frac{F(z) + F(-z)}{2} \\[4px] \sum_{n = 0}^\infty f_{2n+1} z^{2n+1} &= \frac{F(z) - F(-z)}{2}. \end{align} More generally, suppose that and that denotes the th
primitive root of unity. Then, as an application of the
discrete Fourier transform, we have the formula \sum_{n = 0}^\infty f_{an+b} z^{an+b} = \frac{1}{a} \sum_{m=0}^{a-1} \omega_a^{-mb} F\left(\omega_a^m z\right). For integers , another useful formula providing somewhat
reversed floored arithmetic progressions — effectively repeating each coefficient times — are generated by the identity \sum_{n = 0}^\infty f_{\left\lfloor \frac{n}{m} \right\rfloor} z^n = \frac{1-z^m}{1-z} F(z^m) = \left(1 + z + \cdots + z^{m-2} + z^{m-1}\right) F(z^m).
-recursive sequences and holonomic generating functions Definitions A formal power series (or function) is said to be
holonomic if it satisfies a linear differential equation of the form c_0(z) F^{(r)}(z) + c_1(z) F^{(r-1)}(z) + \cdots + c_r(z) F(z) = 0, where the coefficients are in the field of rational functions, \mathbb{C}(z). Equivalently, F(z) is holonomic if the
vector space over \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, are polynomials in . Thus we can see an equivalent condition that a generating function is holonomic if its coefficients satisfy a
-recurrence of the form \widehat{c}_s(n) f_{n+s} + \widehat{c}_{s-1}(n) f_{n+s-1} + \cdots + \widehat{c}_0(n) f_n = 0, for all large enough and where the are fixed finite-degree polynomials in . In other words, the properties that a sequence be
-recursive and have a holonomic generating function are equivalent. Holonomic functions are closed under the
Hadamard product operation on generating functions.
Examples The functions , , , , \sqrt{1 + z}, the
dilogarithm function , the
generalized hypergeometric functions and the functions defined by the power series \sum_{n = 0}^\infty \frac{z^n}{(n!)^2} and the non-convergent \sum_{n = 0}^\infty n! \cdot z^n are all holonomic. Examples of -recursive sequences with holonomic generating functions include and , where sequences such as \sqrt{n} and are
not -recursive due to the nature of singularities in their corresponding generating functions. Similarly, functions with infinitely many singularities such as , , and Gamma function| are
not holonomic functions.
Software for working with ''''-recursive sequences and holonomic generating functions Tools for processing and working with -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
-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 -recurrences involving generalized
harmonic numbers. Other packages listed on this particular RISC site are targeted at working with holonomic
generating functions specifically.
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 .
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 that has a finite radius of convergence of can be written as G(a_n; x) = \frac{A(x) + B(x) \left (1- \frac{x}{r} \right )^{-\beta}}{x^\alpha} where each of and is a function that is
analytic to a radius of convergence greater than (or is
entire), and where then a_n \sim \frac{B(r)}{r^\alpha \Gamma(\beta)} \, n^{\beta-1}\left(\frac{1}{r}\right)^n \sim \frac{B(r)}{r^{\alpha}} \binom{n+\beta-1}{n}\left(\frac{1}{r}\right)^n = \frac{B(r)}{r^\alpha} \left(\!\!\binom{\beta}{n}\!\!\right)\left(\frac{1}{r}\right)^n\,, using the
gamma function, a
binomial coefficient, or a
multiset coefficient. Note that limit as goes to infinity of the ratio of to any of these expressions is guaranteed to be 1; not merely that is proportional to them. Often this approach can be iterated to generate several terms in an asymptotic series for . In particular, G\left(a_n - \frac{B(r)}{r^\alpha} \binom{n+\beta-1}{n}\left(\frac{1}{r}\right)^n; x \right) = G(a_n; x) - \frac{B(r)}{r^\alpha} \left(1 - \frac{x}{r}\right)^{-\beta}\,. The asymptotic growth of the coefficients of this generating function can then be sought via the finding of , , , , and to describe the generating function, as above. Similar asymptotic analysis is possible for exponential generating functions; with an exponential generating function, it is 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.
Asymptotic growth of the sequence of squares As derived above, the ordinary generating function for the sequence of squares is: G(n^2; x) = \frac{x(x+1)}{(1-x)^3}. With , , , , and , 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} \left (\frac{1}{r} \right)^n = \frac{1+1}{1^{-1}\,\Gamma(3)}\,n^{3-1} \left(\frac1 1\right)^n = n^2.
Asymptotic growth of the Catalan numbers The ordinary generating function for the
Catalan numbers is G(C_n; x) = \frac{1-\sqrt{1-4x}}{2x}. With , , , , and , we can conclude that, for the Catalan numbers: C_n \sim \frac{B(r)}{r^\alpha \Gamma(\beta)} \, n^{\beta-1} \left(\frac{1}{r} \right)^n = \frac{-\frac12}{\left(\frac14\right)^1 \Gamma\left(-\frac12\right)} \, n^{-\frac12-1} \left(\frac{1}{\,\frac14\,}\right)^n = \frac{4^n}{n^\frac32 \sqrt\pi}.
Bivariate and multivariate generating functions The generating function in several variables can be generalized to arrays with multiple indices. These non-polynomial double sum examples are called
multivariate generating functions, or
super generating functions. For two variables, these are often called
bivariate generating functions.
Bivariate case The ordinary generating function of a two-dimensional array (where and are natural numbers) is: G(a_{m,n};x,y)=\sum_{m,n=0}^\infty a_{m,n} x^m y^n.For instance, since is the ordinary generating function for
binomial coefficients for a fixed , one may ask for a bivariate generating function that generates the binomial coefficients for all and . To do this, consider itself as a sequence in , and find the generating function in that has these sequence values as coefficients. Since the generating function for is: \frac{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}.Other examples of such include the following two-variable generating functions for the
binomial coefficients, the
Stirling numbers, and the
Eulerian numbers, where and denote the two variables: \begin{align} e^{z+wz} & = \sum_{m,n \geq 0} \binom{n}{m} w^m \frac{z^n}{n!} \\[4px] e^{w(e^z-1)} & = \sum_{m,n \geq 0} \begin{Bmatrix} n \\ m \end{Bmatrix} w^m \frac{z^n}{n!} \\[4px] \frac{1}{(1-z)^w} & = \sum_{m,n \geq 0} \begin{bmatrix} n \\ m \end{bmatrix} w^m \frac{z^n}{n!} \\[4px] \frac{1-w}{e^{(w-1)z}-w} & = \sum_{m,n \geq 0} \left\langle\begin{matrix} n \\ m \end{matrix} \right\rangle w^m \frac{z^n}{n!} \\[4px] \frac{e^w-e^z}{w e^z-z e^w} &= \sum_{m,n \geq 0} \left\langle\begin{matrix} m+n+1 \\ m \end{matrix} \right\rangle \frac{w^m z^n}{(m+n+1)!}. \end{align}
Multivariate case 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 rows and columns; the row sums are and the column sums are . Then, according to
I. J. Good, the number of such tables is the coefficient of: x_1^{t_1}\cdots x_r^{t_r}y_1^{s_1}\cdots y_c^{s_c}in:\prod_{i=1}^{r}\prod_{j=1}^c\frac{1}{1-x_iy_j}.
Representation by continued fractions (Jacobi-type ''''-fractions) Definitions Expansions of (formal)
Jacobi-type and
Stieltjes-type continued fractions (
-fractions and
-fractions, respectively) whose th rational convergents represent
-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 (-fractions) are expanded as in the following equation and have the next corresponding power series expansions with respect to for some specific, application-dependent component sequences, {{math|{ab
i}}} and {{math|{
ci}}}, where denotes the formal variable in the second power series expansion given below: \begin{align} J^{[\infty]}(z) & = \cfrac{1}{1-c_1 z-\cfrac{\text{ab}_2 z^2}{1-c_2 z-\cfrac{\text{ab}_3 z^2}{\ddots}}} \\[4px] & = 1 + c_1 z + \left(\text{ab}_2+c_1^2\right) z^2 + \left(2 \text{ab}_2 c_1+c_1^3 + \text{ab}_2 c_2\right) z^3 + \cdots \end{align} The coefficients of z^n, denoted in shorthand by , in the previous equations correspond to matrix solutions of the equations: \begin{bmatrix}k_{0,1} & k_{1,1} & 0 & 0 & \cdots \\ k_{0,2} & k_{1,2} & k_{2,2} & 0 & \cdots \\ k_{0,3} & k_{1,3} & k_{2,3} & k_{3,3} & \cdots \\ \vdots & \vdots & \vdots & \vdots \end{bmatrix} = \begin{bmatrix}k_{0,0} & 0 & 0 & 0 & \cdots \\ k_{0,1} & k_{1,1} & 0 & 0 & \cdots \\ k_{0,2} & k_{1,2} & k_{2,2} & 0 & \cdots \\ \vdots & \vdots & \vdots & \vdots \end{bmatrix} \cdot \begin{bmatrix}c_1 & 1 & 0 & 0 & \cdots \\ \text{ab}_2 & c_2 & 1 & 0 & \cdots \\ 0 & \text{ab}_3 & c_3 & 1 & \cdots \\ \vdots & \vdots & \vdots & \vdots \end{bmatrix}, where , for , if , and where for all integers , we have an
addition formula relation given by: j_{p+q} = k_{0,p} \cdot k_{0,q} + \sum_{i=1}^{\min(p, q)} \text{ab}_2 \cdots \text{ab}_{i+1} \times k_{i,p} \cdot k_{i,q}.
Properties of the ''''th convergent functions For (though in practice when ), we can define the rational th convergents to the infinite -fraction, , expanded by: \operatorname{Conv}_h(z) := \frac{P_h(z)}{Q_h(z)} = j_0 + j_1 z + \cdots + j_{2h-1} z^{2h-1} + \sum_{n = 2h}^\infty \widetilde{j}_{h,n} z^n component-wise through the sequences, and , defined recursively by: \begin{align} P_h(z) & = (1-c_h z) P_{h-1}(z) - \text{ab}_h z^2 P_{h-2}(z) + \delta_{h,1} \\ Q_h(z) & = (1-c_h z) Q_{h-1}(z) - \text{ab}_h z^2 Q_{h-2}(z) + (1-c_1 z) \delta_{h,1} + \delta_{0,1}. \end{align} Moreover, the rationality of the convergent function for all implies additional finite difference equations and congruence properties satisfied by the sequence of ,
and for if then we have the congruence j_n \equiv [z^n] \operatorname{Conv}_h(z) \pmod h, for non-symbolic, determinate choices of the parameter sequences {{math|{ab
i}}} and {{math|{
ci}}} when , that is, when these sequences do not implicitly depend on an auxiliary parameter such as , , or as in the examples contained in the table below.
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, , generated by the general expansions of the -fractions defined in the first subsection. Here we define and the parameters R, \alpha \isin \mathbb{Z}^+ and to be indeterminates with respect to these expansions, where the prescribed sequences enumerated by the expansions of these -fractions are defined in terms of the
-Pochhammer symbol,
Pochhammer symbol, and the
binomial coefficients. The radii of convergence of these series corresponding to the definition of the Jacobi-type -fractions given above are in general different from that of the corresponding power series expansions defining the ordinary generating functions of these sequences. ==Examples==