How to Find a Closed Form for an nth Term Using Generating Functions
At a glance
- 1. Define the series
Write the sequence as an ordinary generating function A(x) = sum of a_n x^n, using the same starting index as the sequence.
- 2. Translate the recurrence
Multiply the recurrence by a suitable power of x, sum over its valid indices, and insert the initial values.
- 3. Simplify the function
Solve for A(x), then factor its denominator when possible.
- 4. Extract coefficients
Use known power-series expansions or partial fractions to read off the coefficient of x^n.
A generating function can convert a recurrence into an algebraic equation. Once you solve that equation, extracting the coefficient of gives the sequence’s nth term. For many linear recurrences with constant coefficients, this leads to a formula involving powers of a few roots.
There is no single closed-form formula that works for every generating function. The method is to derive the function correctly and then choose a coefficient-extraction technique that fits its form.
Encode the sequence
For a sequence , its ordinary generating function is
The coefficient of in is , written . A recurrence for creates relations among shifted versions of this series. For example,
These identities are useful because they express shifted sequence terms using and the initial values.
A step-by-step method
- Choose the indexing. Decide whether the sequence starts at or , and define accordingly.
- Multiply and sum the recurrence. If the recurrence is valid for , multiply each side by and sum over those indices. Use shifted-series identities, keeping the initial terms separate.
- Solve for . Rearrange the resulting equation. A linear recurrence with constant coefficients usually gives a rational function.
- Extract . Factor the denominator, use partial fractions, or apply a known series expansion.
- Check initial terms. Compare the formula with the given starting values and, if practical, substitute it into the recurrence.
Worked example: the Fibonacci sequence
Let , , and for . Define
Summing the recurrence after multiplying by gives
The left side is , and the first sum on the right is . Substituting and yields
Multiplying by and collecting the terms in gives
Let and . Since and , the denominator factors as
Partial fractions give
Using the geometric-series identity , compare coefficients of to obtain
This is a closed form for every . Although it contains square roots and can look non-integer, its value is an integer because it equals the Fibonacci number defined by the recurrence.
Why partial fractions work
A common piece of a rational generating function has the form , where is a positive integer. Its coefficient is
Thus, for a proper rational function whose denominator factors into linear terms, partial fractions produce a finite sum of terms that are polynomials in times powers of constants. If the rational function has a polynomial part, that part contributes only finitely many coefficients and must be included separately. Repeated roots account for the polynomial factors in . If the denominator has irreducible quadratic factors over the real numbers, the resulting expression can instead be written using complex roots or equivalent trigonometric terms.
Common mistakes
- Dropping initial terms: A shifted series such as is not simply . The missing starting terms must be subtracted.
- Starting the sum at the wrong index: A recurrence may hold only for or later. The range changes which initial terms appear in the generating-function equation.
- Mixing ordinary and exponential generating functions: This article uses . An exponential generating function uses and has different shift rules.
- Assuming every answer is elementary: A generating function may have coefficients expressible only through a more advanced function, or the phrase “closed form” may not have a universally agreed boundary. A useful result can still be a coefficient formula or an exact recurrence.
When the generating function is not rational
The same principle still applies: the nth term is the coefficient . But a non-rational generating function may require methods such as the binomial theorem, known series expansions, or contour integration to extract that coefficient. First simplify the function and identify a series expansion valid around ; then read off the coefficient matching the chosen indexing.
References
- Herbert S. Wilf, Generatingfunctionology
Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.