Registry Synced

Generating Functions

224 words
1 min read

Reading compass

Now ยท 4.1 Intuition: Encoding Sequences as Power Series

Generating Functions

4.1 Intuition: Encoding Sequences as Power Series

A generating function wraps an entire sequence into a single algebraic expression. Operations on the series translate to operations on the sequence.
๐Ÿ”‘ Key Insight: Generating functions turn combinatorial problems into algebra problems.

4.2 Ordinary Generating Functions (OGF)

For sequence {an}\{a_n\}: G(x)=โˆ‘n=0โˆžanxnG(x) = \sum_{n=0}^\infty a_n x^n

Key OGFs

  • โˆ‘n=0โˆžxn=11โˆ’x\sum_{n=0}^\infty x^n = \frac{1}{1-x}
  • โˆ‘n=0โˆž(n+kโˆ’1kโˆ’1)xn=1(1โˆ’x)k\sum_{n=0}^\infty \binom{n+k-1}{k-1} x^n = \frac{1}{(1-x)^k}
  • โˆ‘n=0โˆžnxn=x(1โˆ’x)2\sum_{n=0}^\infty n x^n = \frac{x}{(1-x)^2}
  • โˆ‘n=0โˆž(mn)xn=(1+x)m\sum_{n=0}^\infty \binom{m}{n} x^n = (1+x)^m

4.3 Using OGF to Solve Recurrences

Example: Fibonacci Fn=Fnโˆ’1+Fnโˆ’2F_n = F_{n-1} + F_{n-2} Let G(x)=โˆ‘FnxnG(x) = \sum F_n x^n. G(x)=F0+F1x+โˆ‘n=2โˆž(Fnโˆ’1+Fnโˆ’2)xnG(x) = F_0 + F_1 x + \sum_{n=2}^\infty (F_{n-1} + F_{n-2}) x^n =0+x+xโˆ‘n=1โˆžFnxn+x2โˆ‘n=0โˆžFnxn= 0 + x + x\sum_{n=1}^\infty F_n x^n + x^2\sum_{n=0}^\infty F_n x^n =x+xG(x)+x2G(x)= x + x G(x) + x^2 G(x) G(x)(1โˆ’xโˆ’x2)=xG(x)(1 - x - x^2) = x G(x)=x1โˆ’xโˆ’x2G(x) = \frac{x}{1-x-x^2}

4.4 Exponential Generating Functions (EGF)

E(x)=โˆ‘n=0โˆžanxnn!E(x) = \sum_{n=0}^\infty a_n \frac{x^n}{n!} EGF is natural for labeled structures (permutations, sets).

โœ… Practice Questions

Q1: Find the OGF for an=2na_n = 2^n.
Solution
G(x)=โˆ‘2nxn=โˆ‘(2x)n=11โˆ’2xG(x) = \sum 2^n x^n = \sum (2x)^n = \frac{1}{1-2x}. Q2: Find the coefficient of x5x^5 in (1โˆ’x)โˆ’3(1-x)^{-3}. Solution
(1โˆ’x)โˆ’3=โˆ‘(n+22)xn(1-x)^{-3} = \sum \binom{n+2}{2} x^n. Coefficient of x5x^5: (72)=21\binom{7}{2} = 21. Join Discord PreviousRecurrence ApplicationsNextGraph Theory Basics
Document outline

Keep your place and jump directly to a heading.

Table of contents

No note selected

Open a chapter to see its outline, backlinks, and sources here.