Folioby Interconnected
Log InSign Up

Generating Functions I (Ordinary): Encoding Sequences as Power Series

We introduce ordinary generating functions (OGFs), establish the connection between products and convolutions, derive Binet's formula for the Fibonacci numbers via OGFs, and present the generating functions for the Catalan numbers and the partition function.

FO
Folio Official
March 1, 2026

1 Definition of Ordinary Generating Functions

Definition 1 (Ordinary generating function).
Given a sequence (an​)n≥0​, the formal power series
A(x)=n=0∑∞​an​xn
is called the ordinary generating function (OGF) of (an​).
Remark 2.
Generating functions are treated as "formal" power series — we do not need to substitute a specific value for x or worry about convergence. What matters is the algebraic manipulation of coefficients. That said, analytic arguments are sometimes employed to derive explicit formulas.
Example 3.
The OGF of the constant sequence an​=1 (n≥0) is ∑n=0∞​xn=1−x1​. The OGF of an​=n is ∑n=0∞​nxn=(1−x)2x​.

2 Products and Convolution

Theorem 4.
Let A(x) and B(x) be the OGFs of sequences (an​) and (bn​), respectively. The coefficient cn​ of the product C(x)=A(x)B(x) is given by
cn​=k=0∑n​ak​bn−k​.
This is called the convolution of (an​) and (bn​).
Proof.
This is immediate from the definition of the product of formal power series: A(x)B(x)=∑n​(∑k=0n​ak​bn−k​)xn. □

3 Fibonacci Numbers and Binet's Formula

Definition 5 (Fibonacci sequence).
The Fibonacci sequence is defined by F0​=0, F1​=1, and Fn​=Fn−1​+Fn−2​ for n≥2.
Theorem 6 (Binet's formula).
Fn​=5​φn−ψn​
where φ=21+5​​ and ψ=21−5​​.
Proof.
Set F(x)=∑n=0∞​Fn​xn. Multiplying the recurrence Fn​=Fn−1​+Fn−2​ by xn and summing over n≥2 yields
F(x)−F1​x−F0​=x(F(x)−F0​)+x2F(x).
Solving for F(x) gives F(x)(1−x−x2)=x, whence F(x)=1−x−x2x​.

We now perform a partial fraction decomposition. Since 1−x−x2=−(x−(−φ−1))(x−(−ψ−1)), we obtain
F(x)=5​1​(1−φx1​−1−ψx1​).
Expanding 1−αx1​=∑n=0∞​αnxn and reading off the coefficient of xn gives Fn​=5​φn−ψn​. □

4 The Generating Function for the Catalan Numbers

Definition 7 (Catalan number).
The n-th Catalan number is Cn​=n+11​(n2n​) for n≥0.
Theorem 8.
The OGF C(x)=∑n=0∞​Cn​xn of the Catalan numbers is
C(x)=2x1−1−4x​​.
Proof.
The Catalan numbers satisfy the recurrence Cn​=∑k=0n−1​Ck​Cn−1−k​ for n≥1, with C0​=1. In terms of the OGF, this translates to C(x)=1+xC(x)2. Solving the quadratic xC2−C+1=0 yields C(x)=2x1±1−4x​​. The initial condition C(0)=C0​=1 forces us to take the minus sign. □

5 The Generating Function for the Partition Numbers

Definition 9 (Partition number).
The number of ways to write a nonneg\/ative integer n as a sum of positive integers, disregarding order, is called the partition numberp(n).
Theorem 10 (Euler's generating function for the partition numbers).
n=0∑∞​p(n)xn=k=1∏∞​1−xk1​
Proof.
For each positive integer k, using k exactly j times in a partition corresponds to the monomial xkj. The generating function for the number of times k can be used is
1−xk1​=j=0∑∞​xkj.
Taking the product over all k≥1, the coefficient of xn in the resulting product counts the number of ways to partition n into positive integer parts, which is p(n). □
Remark 11.
A recurrence for the partition numbers can be derived from Euler's pentagonal number theorem: ∏k=1∞​(1−xk)=∑m=−∞∞​(−1)mxm(3m−1)/2.
CombinatoricsDiscrete MathematicsTextbookGenerating FunctionsOGF
FO
Folio Official

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

1 followers·107 articles
Combinatorics TextbookPart 5 of 13
Previous
The Inclusion--Exclusion Principle: Counting by Alternating Sums
Next
Generating Functions II (Exponential): Counting Labeled Structures

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

Recurrence Relations and Counting: Solving Linear Recurrences

We present the method of characteristic equations for solving linear recurrences with constant coefficients, treat the case of repeated roots, discuss nonhomogeneous recurrences, establish the equivalence with generating functions, and introduce matrix exponentiation and the Kitamasa method.

CombinatoricsDiscrete MathematicsTextbook
Folio Official·March 1, 2026

The Inclusion--Exclusion Principle: Counting by Alternating Sums

We prove the inclusion--exclusion principle and apply it to derive the formula for the number of derangements D_n, Euler's totient function, the relationship between surjections and Stirling numbers of the second kind, and the M\"{o}bius inversion formula.

CombinatoricsDiscrete MathematicsTextbook
Folio Official·March 1, 2026

Combinatorial Designs and Latin Squares: Balanced Arrangements

We define Latin squares and prove their existence, introduce mutually orthogonal Latin squares (MOLS), develop the theory of balanced incomplete block designs (BIBDs), prove Fisher's inequality, and discuss the connection with finite projective planes.

CombinatoricsDiscrete MathematicsTextbook
Folio Official·March 1, 2026

Burnside's Lemma and P\'olya Enumeration: Counting Under Symmetry

Starting from the definitions of group actions, orbits, and stabilizers, we prove Burnside's lemma (the Cauchy--Frobenius theorem), introduce the cycle index of a permutation group, and derive P\'olya's enumeration theorem. Applications to necklace and bracelet counting are given.

CombinatoricsDiscrete MathematicsTextbook