PrevNext

Overview

Generating functions encode sequences into algebraic objects. Even simple applications can simplify counting and recurrence problems.

Key Ideas

  • The coefficient of xnx^n in (1+x+x2+)k(1+x+x^2+\cdots)^k counts solutions to x1++xk=nx_1+\cdots+x_k=n with nonnegative integers.
  • Finite options become finite polynomials like (1+x+x2)(1+x+x^2).
  • Multiplying series corresponds to combining choices.

Core Skills

Translate Choices to Factors

Each variable contributes a factor (1+x+x2+)(1+x+x^2+\cdots) or a finite polynomial depending on constraints.

Extract Coefficients

Use known expansions like (1x)k(1-x)^{-k} or binomial coefficients to read off coefficients.

Use Truncation

When only low-degree terms matter, ignore higher powers after expansion.

Worked Example

Count solutions to a+b+c=5a+b+c=5 with a,b,c0a,b,c\ge0.

The generating function is (1+x+x2+)3=1(1x)3(1+x+x^2+\cdots)^3=\frac{1}{(1-x)^3}. The coefficient of x5x^5 is (5+3131)=21\binom{5+3-1}{3-1}=21.

More Examples

Example 1: Bounded Variables

Count solutions to x+y+z=4x+y+z=4 with 0x,y,z20\le x,y,z\le 2.

Use (1+x+x2)3(1+x+x^2)^3 and extract the x4x^4 coefficient.

Example 2: Distinct Parts

Count partitions of nn into distinct parts.

Use the generating function k1(1+xk)\prod_{k\ge1}(1+x^k).

Example 3: Recurrence Extraction

If A(x)=11xx2A(x)=\frac{1}{1-x-x^2}, then the coefficients satisfy Fibonacci.

Strategy Checklist

  • Translate each constraint into a factor.
  • Use binomial series for (1x)k(1-x)^{-k}.
  • Truncate when only a few coefficients are needed.

Practice Problems

StatusSourceProblem NameDifficultyTags
AIMEVery Hard
Show TagsGenerating Functions
AIMEVery Hard
Show TagsCounting

Module Progress:

Join the AoPS Community!

Stuck on a problem, or don't understand a module? Join the AoPS community and get help from other math contest students.

PrevNext