Lemma › Techniques › Generating Functions
Olympiad problem-solving technique
Generating Functions
Turn a sequence into a single function.
Encode a sequence as the coefficients of a power series . Recurrences become algebraic equations, convolutions become products, and the answer falls out of a coefficient extraction.
The workhorse identities: and — 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.
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 levelMore techniques
- The Extremal PrincipleConsider the largest, the smallest, the closest.
- Smoothing & NormalisationNudge the variables toward equality and watch the bound improve.
- All 26 techniques →