LemmaTechniques › Generating Functions
Olympiad problem-solving technique

Generating Functions

Turn a sequence into a single function.

Encode a sequence a0,a1,a2,a_0, a_1, a_2, \dots as the coefficients of a power series anxn\sum a_n x^n. Recurrences become algebraic equations, convolutions become products, and the answer falls out of a coefficient extraction.

The workhorse identities: 11x=xn\frac{1}{1-x} = \sum x^n and 1(1x)k=(n+k1k1)xn\frac{1}{(1-x)^k} = \sum \binom{n+k-1}{k-1} x^n — the second is stars and bars in disguise.

Best deployed when a counting problem has an awkward constraint that is easy to write as a factor of a product.

Where it appears on Lemma: Level 7 (recurrences) and Level 8 (combinatorics).

Train it on Lemma

Generating Functions unlocks at Level 7 of Lemma's eight-level ladder, with lessons that teach it and drills that make it stick. 78 lessons, 624 curated problems and unlimited generated practice at six difficulties. Free to start — no card, no trial clock.

Find your level

More techniques