Ordinary generating functions
An ordinary generating function (OGF) encodes an entire sequence of numbers into a single algebraic expression. Instead of working with a sequence term by term, you package it into a power series and then use algebra to discover properties of the sequence that would be hard to spot otherwise. OGFs are one of the central tools in combinatorics for solving counting problems, proving identities, and finding closed-form expressions.
Definition and Structure
The ordinary generating function for a sequence is the formal power series
Each term of the sequence becomes the coefficient of the corresponding power of . The variable is just a placeholder; you're not plugging in actual numbers. That's why these are called formal power series: convergence doesn't matter. You never need to worry about whether the series "adds up" to a finite value. You just manipulate the expressions algebraically.
A key fact is the uniqueness property: two formal power series are equal if and only if every corresponding coefficient matches. So each sequence determines exactly one OGF, and each OGF determines exactly one sequence.
Properties and Operations
The real power of OGFs comes from the fact that algebraic operations on the generating functions correspond to natural operations on the sequences they encode.
Addition. If and , then
You just add the sequences term by term. Straightforward.
Multiplication (Cauchy product). This is where things get interesting. The product gives a new series whose coefficient of is the convolution:
Combinatorially, this counts the number of ways to split into two parts and choose from set for one part and set for the other. Multiplication of OGFs is the algebraic version of combining independent choices.
Shifting. To shift a sequence to the right (inserting zeros at the front), multiply by a power of . For example, shifts the sequence two positions to the right. To shift left (removing initial terms), you subtract them off and divide:
Differentiation. Taking the derivative of multiplies each coefficient by its index:
So , which is useful when your sequence involves factors of .
Other operations:
- Hadamard product: multiplying corresponding terms (not the same as the Cauchy product; this doesn't arise from simple multiplication of OGFs)
- Substitution/composition: replacing with another series in , which enables more complex sequence constructions
Common Sequences and Their Generating Functions
A handful of OGFs show up constantly. Knowing these by heart saves a lot of time.
The constant sequence :
This is the geometric series formula, treated formally. It's the single most important OGF to remember, because many others are built from it.
The geometric sequence :
So the coefficient of in is simply .
Binomial coefficients. The generating function for the th row of Pascal's triangle is:
More generally, the generalized binomial series gives the OGF for choosing with repetition.
Fibonacci numbers :
This comes directly from the recurrence with initial conditions .
Catalan numbers :
Partition numbers. The number of ways to write as a sum of positive integers (order doesn't matter) is encoded by the infinite product:
Each factor accounts for using 0, 1, 2, ... copies of the part .

Constructing Generating Functions
When you face a new counting problem, here's a general approach for building its OGF:
- Identify the sequence. Write out the first several terms of whatever you're counting.
- Look for a recurrence. If satisfies a recurrence relation (like ), multiply both sides by , sum over all valid , and express everything in terms of .
- Solve for . The recurrence turns into an algebraic equation in . Solve it to get a closed-form expression.
- Use combinatorial structure directly. If the problem involves independent choices (e.g., "pick items from several categories"), write a generating function for each category and multiply them together.
Example: Deriving the Fibonacci OGF.
Start with for , with .
-
Define .
-
Multiply the recurrence by and sum from to :
-
Rewrite each side using :
- Left side:
- First sum on right:
- Second sum on right:
-
Solve: , giving .
This same strategy works for any linear recurrence with constant coefficients.
Interpreting Coefficients
Combinatorial Interpretations
The notation means "the coefficient of in ." Reading off these coefficients is how you extract answers from a generating function.
Some important examples:
- . This counts the number of weak compositions of into nonnegative parts (equivalently, multisets of size from types).
- In a product , the coefficient counts the total number of ways to pick one structure of size from and one of size from , summed over all .
- When you impose restrictions on a counting problem (e.g., "each part is at most 3"), you modify the individual factors in the product accordingly.

Extraction Techniques
Once you have a closed-form OGF, you need to pull out the coefficient of . The main techniques:
Partial fraction decomposition (for rational OGFs). If where , factor and decompose:
Then . This is exactly how you derive the Binet formula for Fibonacci numbers.
Binomial series expansion. For OGFs involving square roots or fractional powers, use the generalized binomial theorem:
where for any real .
Taylor expansion. Expand around using standard series identities.
Lagrange inversion. When is defined implicitly (e.g., for some function ), this theorem gives a formula for directly. The Catalan number OGF is a classic application.
Closed-Form Expressions for Sequences
Derivation Methods
The typical workflow for finding a closed-form expression for :
- Set up the OGF from a recurrence or combinatorial description.
- Simplify the OGF into a recognizable closed form (rational function, product, etc.).
- Decompose using partial fractions (for rational OGFs) or series expansions.
- Extract the coefficient of from each term.
- Verify by checking the formula against known initial values and the original recurrence.
For rational generating functions with distinct roots, the closed form will always be a linear combination of exponentials: . Repeated roots introduce polynomial factors like .
Advanced Techniques
These go beyond the basics but are worth knowing at this level:
- Kernel method: used for functional equations where satisfies something like . You find a substitution that "kills" one side of the equation.
- Singularity analysis: to find the asymptotic behavior of (how it grows for large ), you analyze the singularities of in the complex plane. The dominant singularity (closest to the origin) controls the growth rate.
- Darboux's method: a specific technique for extracting asymptotics from OGFs with algebraic singularities (like square roots).
- Riordan arrays: a framework that organizes families of sequences defined by related generating functions into infinite lower-triangular matrices, making certain recurrence patterns easier to handle.