Generating Functions II Great Theoretical Ideas In Computer Science S. Rudich V. Adamchik CS 15-251 Spring 2006 Lecture 14 Mar 02, 2006 Carnegie Mellon University Generating Functions II
What is a closed form the Fibonacci power series? F0=0, F1=1, Fn=Fn-1+Fn-2 for n2 What is a closed form the Fibonacci power series?
T0=1, T1=1, Tn = T0 Tn-1 + T1 Tn-2+…+Tn-1 T0 Counting binary trees
Solving with Generating Functions ak = ak-1 + ak-2 , kr2 a0=0, a1=1 We assume that f(x) is a generating function
ak = ak-1 + ak-2 , kr2 What are the generating functions for sequences ak, ak-1, ak-2 when k = 2, 3, 4,… ?
What is the generating function for ak , k = 2,3, … ?
What is the generating function for ak-1, k = 2,3, … ?
What is the generating function for ak-2, k = 0, 1, 2, … ?
Solving with Generating Functions ak = ak-1 + ak-2 , k>1 a0=0, a1=1 In terms of generating functions
ak = ak-1 + ak-2
Simple Transformations If f(x) is a generating function for ak, then ak-1 -> x f(x) ak-2 -> x2 f(x)
Find a GF for a0=2, a1=4,a2=31 an=4an-1+3an-2-18an-3
T0=1, T1=1, Tn = T0 Tn-1 + T1 Tn-2+…+Tn-1 T0 Counting binary trees
T0=1, T1=1, Tn = T0 Tn-1 + T1 Tn-2+…+Tn-1 T0 Let f(x) be a generating function Then summing-up the above recurrence, yields
Power series multiplication Let us multiply formal power series p(x) = a0 + a1 x + a2 x2 + … q(x) = b0 + b1x + b2 x2 + … p(x)q(x) = a0b0 + (a0b1+a1b0) x + (a0b2+a1b1+a2b0) x2 +…
Power series multiplication If then
T0=1, T1=1, Tn = T0 Tn-1 + T1 Tn-2+…+Tn-1 T0
T0=1, T1=1, Tn = T0 Tn-1 + T1 Tn-2+…+Tn-1 T0
Counting Binary Trees
Applying some calculus… Catalan Numbers
Newton’s Binomial Theorem
Newton’s Binomial Theorem
Use generating functions to show that Proving Identities Use generating functions to show that
Consider the right hand side
Use the binomial theorem to obtain What is the coefficient by xn?
Study Bee Solving recurrences via GFs Power series manipulations Proving identities via GFs Study Bee