Quiz 2
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=0anxnG(x) = \sum_{n=0}^\infty a_n x^n

Key OGFs

  • n=0xn=11x\sum_{n=0}^\infty x^n = \frac{1}{1-x}
  • n=0(n+k1k1)xn=1(1x)k\sum_{n=0}^\infty \binom{n+k-1}{k-1} x^n = \frac{1}{(1-x)^k}
  • n=0nxn=x(1x)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=Fn1+Fn2F_n = F_{n-1} + F_{n-2} Let G(x)=FnxnG(x) = \sum F_n x^n. G(x)=F0+F1x+n=2(Fn1+Fn2)xnG(x) = F_0 + F_1 x + \sum_{n=2}^\infty (F_{n-1} + F_{n-2}) x^n =0+x+xn=1Fnxn+x2n=0Fnxn= 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)(1xx2)=xG(x)(1 - x - x^2) = x G(x)=x1xx2G(x) = \frac{x}{1-x-x^2}

4.4 Exponential Generating Functions (EGF)

E(x)=n=0anxnn!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=112xG(x) = \sum 2^n x^n = \sum (2x)^n = \frac{1}{1-2x}. Q2: Find the coefficient of x5x^5 in (1x)3(1-x)^{-3}. Solution
(1x)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
System Normal // Awaiting Context

Intelligence Hub

Navigate the knowledge graph to generate context. The Hub adapts dynamically to surface backlinks, related notes, and metadata insights.