genfuncintro

Mathematics for Computer Science
MIT 6.042J/18.062J
Generating
Functions
Albert R Meyer,
April 26, 2013
genfuncintro.1
Infinite Geometric Series
S(x) ::= 1+ x + x + + x +
2
n
xS(x) = x + x + + x +
2
Albert R Meyer,
April 26, 2013
n
genfuncintro.2
Infinite Geometric Series
S(x) ::= 1+ x + x +
2
xS(x) = x + x +
2
+x +
n
+x +
n
S(x)−xS(x) = 1
S(x) =
Albert R Meyer,
April 26, 2013
genfuncintro.3
Infinite Geometric Series
S(x) ::= 1+ x + x +
2
xS(x) = x + x +
2
+x +
n
+x +
n
S(x)−xS(x) = 1
1+ x + x +
2
+x +
Albert R Meyer,
n
April 26, 2013
=
genfuncintro.4
Ordinary Generating Functions
The ordinary generating function
for the infinite sequence
〈g0, g1, g2, , gn, 〉
is the power series:
G(x) = g0 + g1x + g2x2 +  + gn xn + 
Albert R Meyer,
April 26, 2013
genfuncintro.6
Infinite Geometric Series
“corresponds to”
1, 1, 1, …

=
1+x+x +
2
Albert R Meyer,
April 26, 2013
1
1-x
genfuncintro.7
Coefficients
Albert R Meyer,
April 26, 2013
genfuncintro.8
Infinite Geometric Series
1+ x + x +
2
1
=
1-x
+x +
n
take derivatives
1+ 2x +
Albert R Meyer,
+ nx +
n-1
1
=
2
(1 - x)
April 26, 2013
genfuncintro.9
Infinite Geometric Series
“corresponds to”
1, 2, 3, …

1+ 2x + 3x +
+ nx +
2
n-1
1
=
2
(1 - x)
Albert R Meyer,
April 26, 2013
genfuncintro.10
Gen Func for
“corresponds to”
1, 2, 3, …

1
=
2
(1 - x)
Albert R Meyer,
April 26, 2013
genfuncintro.11
Gen Func for
Albert R Meyer,
April 26, 2013
genfuncintro.12
right shift by times x
Albert R Meyer,
April 26, 2013
genfuncintro.13
Gen Func for
x
=
2
(1- x)
2
0+ x + 2x +
+ nx +

0,1, 2, 3, …
“corresponds to”
Albert R Meyer,
n
April 26, 2013
genfuncintro.15