Folioby Interconnected
Log InSign Up

Recurrences and generating functions: what happens when you turn a sequence into a function

A generating function is the "business card" of a sequence. Multiplication becomes convolution, and recurrences become algebraic equations. We derive the closed form for the Fibonacci numbers (Binet's formula) as a showcase of the method.

FO
Folio Official
March 1, 2026

You have set up a recurrence, but you cannot find a closed-form solution – a frustrating and common experience. The generating function is a device that packages a sequence into a single formal power series and, in doing so, transforms the recurrence into an algebraic equation that can be solved by routine methods.

1 Generating functions: a sequence's business card

Definition 1 (Ordinary generating function).
The ordinary generating function (OGF) of a sequence {an​}n=0∞​ is the formal power series
A(x)=n=0∑∞​an​xn=a0​+a1​x+a2​x2+⋯
Remark 2.
The word "formal" is critical. We do not care whether the series converges; x is not a variable into which we substitute concrete values. Rather, x serves as a bookkeeping device – a shelf on which to arrange the coefficients an​. This deliberate indifference to convergence is what makes generating functions so flexible.

2 Basic generating functions

Example 3 (Geometric series).
The generating function of the constant sequence an​=1 (for n≥0) is
n=0∑∞​xn=1−x1​,
the familiar geometric series formula.
Example 4 ((1+x)n and binomial coefficients).
The generating function of ak​=(kn​) (for k=0,1,…,n, and 0 thereafter) is
k=0∑n​(kn​)xk=(1+x)n,
which is the binomial theorem with y=1.

3 Multiplication is convolution

The most powerful property of generating functions is that their product corresponds to convolution of the coefficient sequences.

Theorem 5 (Product and convolution).
If A(x)=∑an​xn and B(x)=∑bn​xn, then the product C(x)=A(x)B(x) has coefficients
cn​=k=0∑n​ak​bn−k​,
which is the convolution of {an​} and {bn​}.
Remark 6.
Convolution arises naturally in "two-stage selection" problems. Suppose ak​ counts the number of ways to assemble k yen in coins, and bj​ counts the number of ways to assemble j yen in banknotes. Then cn​=∑k​ak​bn−k​ counts the number of ways to assemble a total of n yen using a combination of coins and banknotes. In the language of generating functions, this becomes the single multiplication C(x)=A(x)B(x).

4 The generating function of the Fibonacci sequence

Definition 7 (Fibonacci sequence).
The Fibonacci sequence is defined by F0​=0, F1​=1, and Fn​=Fn−1​+Fn−2​ for n≥2.

We derive the generating function F(x)=∑n=0∞​Fn​xn from the recurrence.

Theorem 8.
The generating function of the Fibonacci sequence is
F(x)=1−x−x2x​.
Proof.
Multiply both sides of the recurrence Fn​=Fn−1​+Fn−2​ by xn and sum over n≥2:
n=2∑∞​Fn​xn=n=2∑∞​Fn−1​xn+n=2∑∞​Fn−2​xn.

The left-hand side is F(x)−F0​−F1​x=F(x)−x. On the right, the first sum is x(F(x)−F0​)=xF(x) and the second is x2F(x).

Thus F(x)−x=xF(x)+x2F(x), which gives F(x)=x/(1−x−x2). □

5 Binet's formula: from generating function to closed form

We perform a partial fraction decomposition of F(x)=x/(1−x−x2). Factoring 1−x−x2=−(x−α)(x−β), where α and β are the roots of x2+x−1=0:

α=2−1+5​​,β=2−1−5​​.

A partial fraction decomposition followed by geometric series expansion yields the celebrated result.

Theorem 9 (Binet's formula).
Fn​=5​1​[(21+5​​)n−(21−5​​)n].
Remark 10.
That the integer sequence Fn​ has a closed form involving 5​ is startling at first. The resolution is that (1−5​)/2 has absolute value less than 1, so its n-th power vanishes as n→∞. Asymptotically, Fn​ is governed by the golden ratio φ=(1+5​)/2; more precisely, Fn​=⌊φn/5​+1/2⌋.

6 The generating function method: a recipe

The general procedure for solving a recurrence via generating functions consists of four steps:

  1. Multiply both sides of the recurrence by xn and sum over the appropriate range.

  2. Express everything in terms of the generating function A(x) to obtain an algebraic equation.

  3. Solve for A(x) in closed form.

  4. Extract the coefficient an​ via partial fractions, known expansions, or other techniques.

Remark 11.
The essence of this method is a translation: a recurrence (a statement in the discrete world) becomes an algebraic equation (a statement in the continuous world). We solve the equation in the continuous world and then translate the answer back. Generating functions serve as a bridge between the discrete and the continuous.

7 Takeaway

  • A generating function packages a sequence into a formal power series – a compact "business card" for the sequence.

  • The product of generating functions corresponds to convolution, automating multi-stage counting.

  • The Fibonacci generating function is x/(1−x−x2), from which Binet's formula follows.

  • The core strategy is to convert a recurrence into an algebraic equation and solve it there.

In the next article, we meet the Catalan numbers – a single sequence that, mysteriously, answers at least five apparently unrelated counting problems.

CombinatoricsMathematicsBetween the Lines
FO
Folio Official

Mathematics "between the lines" — exploring the intuition textbooks leave out, written in LaTeX on Folio.

1 followers·107 articles
Combinatorics — Between the LinesPart 4 of 8
Previous
Inclusion--exclusion: why the alternating signs work
Next
Why the Catalan numbers appear everywhere: parenthesizations, binary trees, and lattice paths

Share your expertise with the world

Write articles with LaTeX support, build your audience, and earn from your knowledge.

Start Writing — It's Free

More from Folio Official

Folio Official·March 1, 2026

Combinatorics meets dynamic programming: when counting becomes computation

Dynamic programming is bottom-up evaluation of a recurrence; a generating function is its analytic closed form. We draw the correspondence between the knapsack DP and generating function multiplication, discuss convolution and FFT, and survey the connections across the entire series.

CombinatoricsMathematicsBetween the Lines
Folio Official·March 1, 2026

Inclusion--exclusion: why the alternating signs work

The inclusion--exclusion principle corrects for overcounting by alternately adding and subtracting intersection sizes. We prove the general formula using indicator functions, apply it to count derangements, and trace the thread forward to the Mobius inversion formula on partially ordered sets.

CombinatoricsMathematicsBetween the Lines
Folio Official·March 1, 2026

Counting under symmetry: Burnside's lemma and Polya's enumeration theorem

When objects related by rotation or reflection are considered identical -- as with necklaces -- naive counting fails. Using the language of group actions, Burnside's lemma reduces the problem to a clean formula: the number of distinct objects equals the average number of fixed points across the group.

CombinatoricsMathematicsBetween the Lines
Folio Official·March 1, 2026

What does it mean to count? Addition, multiplication, and surjections

Counting is the act of measuring the cardinality of a set. Whether you add or multiply depends on whether your set decomposes as a disjoint union or a Cartesian product. From this single viewpoint, permutations, combinations, and the surjection formula all emerge naturally.

CombinatoricsMathematicsBetween the Lines