Skip to content
Infinitesimal Dynamics home
Notebook: 0 XP

Discrete Mathematics / Further counting, graphs and algorithms

Generating Functions

Store a whole sequence as the coefficients of one power series, then let algebra do the counting.

3 min read · 1 sections · 1 checks

Contents 2 sections
  1. §1A clothesline for numbers
  2. ?Check yourself

By the end you can

  • Write the generating function of a sequence
  • Multiply generating functions to count combinations
  • Solve a recurrence with a generating function

Helps to know: Recurrence Relations, The Binomial Theorem and Pascal’s Triangle

§1A clothesline for numbers

The sequence a0,a1,a2,…a_0, a_1, a_2, \ldots becomes A(x)=∑anxnA(x) = \sum a_n x^n. The all-ones sequence is 11−x\frac{1}{1-x}; multiplying two generating functions counts ways to split a total between two independent choices.

Example 1Change for 10 cents with 1¢, 2¢ and 5¢ coins

  1. Each coin type contributes a factor: 11−x⋅11−x2⋅11−x5\frac{1}{1-x} \cdot \frac{1}{1-x^2} \cdot \frac{1}{1-x^5}.

Check yourself

  1. Q1
    The generating function of 1,2,4,8,…1, 2, 4, 8, \ldots is…