6th Recurrence
6th Recurrence
4 Generating Functions
Definition 1. The generating function for the sequence a0 , a1 , a2 , . . . , ak , . . . of real numbers is the infinite
series
X ∞
G(x) = a0 + a1 x + · · · + ak xk + · · · = ak xk .
k=0
Remark 1. When generating functions are used to solve counting problems, they are usually considered to
be formal power series.
Example 1. The generating function for the sequence 1, 1, 1, 1, . . . is
∞
X 1
1 + x + x2 + · · · = xk = for |x| < 1.
1−x
k=0
1
when |ax| < 1, or equivalently, when |x| < |a| for a 6= 0.
P∞ P∞
Theorem 1. Let f (x) = k=0 ak xk and g(x) = k=0 bk xk . Then
∞
X ∞
X Xk
f (x) + g(x) = (ak + bk )xk and f (x)g(x) = aj bk−j xk .
k=0 k=0 j=0
1
Example 3. Let f (x) = (1−x)2 . Use the theorem to find the coefficients a0 , a1 , . . . in the expansion f (x) =
P∞ k
k=0 ak x .
Remark 2. This result also can be derived from Example 1 by differentiation. Taking derivatives is a useful
technique for producing new identities from existing identities for generating functions.
d
(1 − x)−1 = −1 · (1 − x)−1−1 · (−1) = (1 − x)−2
dx
and
∞ ∞ ∞
!
d X
k
X X
x = kxk−1 = (k + 1)xk
dx
k=0 k=1 k=0
and hence
∞
1 X
= (k + 1)xk .
(1 − x)2
k=0
1
Using Generating Functions to Solve Recurrence Relations
We may use recurrences to derive generating functions.
Example 4. Find the generating function for the sequence {an } defined by a0 = 1 and
2
functions studied in calculus) gives
1 − 9x A B
= +
(1 − 10x)(1 − 8x) 1 − 10x 1 − 8x
A(1 − 8x) + B(1 − 10x)
=
(1 − 10x)(1 − 8x)
A − 8Ax + B − 10Bx
=
(1 − 10x)(1 − 8x)
A + B − (8A + 10B)x
=
(1 − 10x)(1 − 8x)
Therefore
A+B =1
8A + 10B = 9
B =1−A
and hence
8A + 10(1 − A) = 9
∴ 8A + 10 − 10A = 9
∴ 10 − 2A = 9
∴ −2A = −1
1
∴A=
2
1 1
∴B =1− = .
2 2
Thus
1/2 1/2 1 1 1
G(x) = + = · + .
1 − 10x 1 − 8x 2 1 − 10x 1 − 8x
Using Example 2 twice (once with a = 10 and once with a = 8) gives
∞ ∞
!
1 X
n n
X
n n
G(x) = · 10 x + 8 x
2 n=0 n=0
∞
X 1
= · (10n + 8n ) xn .
n=0
2