Ma · Mathematics

How to Find a Closed Form for an Ordinary Generating Function

Published By the 9to5Science editorial team

At a glance

  1. 1. Specify the sequence

    Write the terms and state whether indexing begins at n = 0 or n = 1.

  2. 2. Form the series

    Define the ordinary generating function as the sum of each term multiplied by x to its index.

  3. 3. Use structure

    Apply a known series identity, shift indices, or translate a recurrence into an equation for the generating function.

  4. 4. Check coefficients

    Expand the result far enough to verify that its coefficients match the original sequence.

Advertisement

An ordinary generating function encodes a sequence as the coefficients of a power series. But the title alone does not specify which sequence to use, so it cannot determine one particular closed form. The method depends on the terms or on a rule—such as a recurrence—that defines them.

Definition and indexing

For a sequence a0,a1,a2,…a_0,a_1,a_2,\ldots, its ordinary generating function (OGF) is

A(x)=∑n=0∞anxn=a0+a1x+a2x2+⋯ .A(x)=\sum_{n=0}^{\infty}a_nx^n=a_0+a_1x+a_2x^2+\cdots.

The coefficient of xnx^n is the sequence term ana_n. If a sequence instead starts at a1a_1, its OGF is commonly written ∑n=1∞anxn\sum_{n=1}^{\infty}a_nx^n. State the indexing convention, since shifting the starting index changes the series.

A closed form means an expression more compact than the defining infinite sum, often a rational function or an expression involving familiar functions. Some sequences have simple closed forms; others do not have a useful elementary one. A generating function can still be defined as a formal power series even when the series does not converge for any nonzero value of xx.

Recognize a standard series

Start by writing several terms of the sequence and comparing them with known expansions. The geometric series is the most common starting point:

∑n=0∞xn=11−x,∣x∣<1.\sum_{n=0}^{\infty}x^n=\frac{1}{1-x},\qquad |x|<1.

For example, if an=3na_n=3^n, then

A(x)=∑n=0∞3nxn=∑n=0∞(3x)n=11−3x,A(x)=\sum_{n=0}^{\infty}3^nx^n =\sum_{n=0}^{\infty}(3x)^n =\frac{1}{1-3x},

for ∣x∣<1/3|x|<1/3. As a formal power series, the identity also holds without making a numerical convergence claim.

Powers of nn can be generated by differentiating the geometric series. For an=n2a_n=n^2, use the operator xddxx\frac{d}{dx} twice:

∑n=0∞nxn=xddx(11−x)=x(1−x)2,∑n=0∞n2xn=xddx(x(1−x)2)=x(1+x)(1−x)3.\begin{aligned} \sum_{n=0}^{\infty}nx^n &=x\frac{d}{dx}\left(\frac{1}{1-x}\right) =\frac{x}{(1-x)^2},\\ \sum_{n=0}^{\infty}n^2x^n &=x\frac{d}{dx}\left(\frac{x}{(1-x)^2}\right) =\frac{x(1+x)}{(1-x)^3}. \end{aligned}

Thus the OGF for 0,1,4,9,16,…0,1,4,9,16,\ldots is x(1+x)/(1−x)3x(1+x)/(1-x)^3. The constant term is zero because the sequence starts with a0=02=0a_0=0^2=0.

Translate a recurrence into an equation

If the sequence is defined recursively, multiply its recurrence by the matching power of xx and sum over the valid indices. Initial terms must be handled separately; this is where indexing errors often occur.

For example, let the Fibonacci sequence be F0=0F_0=0, F1=1F_1=1, and Fn=Fn−1+Fn−2F_n=F_{n-1}+F_{n-2} for n≥2n\ge2. Define F(x)=∑n=0∞FnxnF(x)=\sum_{n=0}^{\infty}F_nx^n. Then

F(x)−x=∑n=2∞Fnxn=∑n=2∞Fn−1xn+∑n=2∞Fn−2xn=xF(x)+x2F(x).\begin{aligned} F(x)-x &=\sum_{n=2}^{\infty}F_nx^n\\ &=\sum_{n=2}^{\infty}F_{n-1}x^n +\sum_{n=2}^{\infty}F_{n-2}x^n\\ &=xF(x)+x^2F(x). \end{aligned}

The left side omits the n=1n=1 term, which is F1x=xF_1x=x. Rearranging gives

F(x)=x1−x−x2.F(x)=\frac{x}{1-x-x^2}.

To check, expand the denominator’s reciprocal: F(x)=x+x2+2x3+3x4+5x5+⋯F(x)=x+x^2+2x^3+3x^4+5x^5+\cdots, whose coefficients are the Fibonacci numbers under the stated convention.

Common mistakes

  • Leaving out initial terms: When shifting a sum, write down the first few terms or explicitly subtract any terms that fall outside the recurrence’s range.
  • Changing the indexing silently: The OGF for a1,a2,…a_1,a_2,\ldots may differ by a factor of xx, or by a shift and a correction term, from one indexed starting at zero.
  • Assuming every OGF is rational: Linear recurrences with constant coefficients have rational OGFs, but arbitrary sequences need not. A closed form may not exist in the desired class of expressions.
  • Confusing formal identities with convergence: Algebraic manipulations of formal power series concern coefficients. If you interpret the series as a function of a real or complex variable, also check its radius of convergence.

To find a specific OGF, you need the sequence’s terms or a defining rule. Once you have that information, write the series, identify a standard expansion or recurrence, and verify the resulting coefficients.

References

  1. Herbert S. Wilf, Generatingfunctionology

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.