You are on page 1of 33

GENERATING FUNCTIONS AND RECURRENCE

RELATIONS
Generating Functions
Recurrence Relations
Suppose a
0
, a
1
, a
2
, . . . , a
n
, . . . ,is an infinite sequence.
A recurrence recurrence relation is a set of equations
a
n
= f
n
(a
n−1
, a
n−2
, . . . , a
n−k
). (1)
The whole sequence is determined by (1) and the values of
a
0
, a
1
, . . . , a
k−1
.
Generating Functions
Linear Recurrence
Fibonacci Sequence
a
n
= a
n−1
+ a
n−2
n ≥ 2.
a
0
= a
1
= 1.
Generating Functions
b
n
= |B
n
| = |{x ∈ {a, b, c}
n
: aa does not occur in x}|.
b
1
= 3 : a b c
b
2
= 8 : ab ac ba bb bc ca cb cc
b
n
= 2b
n−1
+ 2b
n−2
n ≥ 2.
Generating Functions
b
n
= 2b
n−1
+ 2b
n−2
n ≥ 2.
Let
B
n
= B
(b)
n
∪ B
(c)
n
∪ B
(a)
n
where B
(α)
n
= {x ∈ B
n
: x
1
= α} for α = a, b, c.
Now |B
(b)
n
| = |B
(c)
n
| = |B
n−1
|. The map f : B
(b)
n
→ B
n−1
,
f (bx
2
x
3
. . . x
n
) = x
2
x
3
. . . x
n
is a bijection.
B
(a)
n
= {x ∈ B
n
: x
1
= a and x
2
= b or c}. The map
g : B
(a)
n
→ B
(b)
n−1
∪ B
(c)
n−1
,
g(ax
2
x
3
. . . x
n
) = x
2
x
3
. . . x
n
is a bijection.
Hence, |B
(a)
n
| = 2|B
n−2
|.
Generating Functions
Towers of Hanoi
Peg 1
Peg 2 Peg 3
H
n
is the minimum number of moves needed to shift
n rings from Peg 1 to Peg 2. One is not allowed to
place a larger ring on top of a smaller ring.
Generating Functions
Hn-1 moves
1 move
Hn-1 moves
H
n
= 2H
n−1
+ 1
Generating Functions
A has n dollars. Everyday A buys one of a Bun (1 dollar), an
Ice-Cream (2 dollars) or a Pastry (2 dollars). How many ways
are there (sequences) for A to spend his money?
Ex. BBPIIPBI represents “Day 1, buy Bun. Day 2, buy Bun etc.”.
u
n
= number of ways
= u
n,B
+ u
n,I
+ u
n,P
where u
n,B
is the number of ways where A buys a Bun on day
1 etc.
u
n,B
= u
n−1
, u
n,I
= u
n,P
= u
n−2
.
So
u
n
= u
n−1
+ 2u
n−2
,
and
u
0
= u
1
= 1.
Generating Functions
If a
0
, a
1
, . . . , a
n
is a sequence of real numbers then its
(ordinary) generating function a(x) is given by
a(x) = a
0
+ a
1
x + a
2
x
2
+· · · a
n
x
n
+· · ·
and we write
a
n
= [x
n
]a(x).
Generating Functions
a
n
= 1
a(x) =
1
1 −x
= 1 + x + x
2
+· · · + x
n
+· · ·
a
n
= n + 1.
a(x) =
1
(1 −x)
2
= 1 + 2x + 3x
2
+· · · + (n + 1)x
n
+· · ·
a
n
= n.
a(x) =
x
(1 −x)
2
= x + 2x
2
+ 3x
3
+· · · + nx
n
+· · ·
Generating Functions
Generalised binomial theorem:
a
n
=

α
n

a(x) = (1 + x)
α
=

¸
n=0

α
n

x
n
.
where

α
n

=
α(α −1)(α −2) · · · (α −n + 1)
n!
.
a
n
=

m+n−1
n

a(x) =
1
(1 −x)
m
=

¸
n=0

−m
n

(−x)
n
=

¸
n=0

m + n −1
n

x
n
.
Generating Functions
General view.
Given a recurrence relation for the sequence (a
n
), we
(a) Deduce from it, an equation satisfied by the generating
function a(x) =
¸
n
a
n
x
n
.
(b) Solve this equation to get an explicit expression for the
generating function.
(c) Extract the coefficient a
n
of x
n
from a(x), by expanding a(x)
as a power series.
Generating Functions
Solution of linear recurrences
a
n
−6a
n−1
+ 9a
n−2
= 0 n ≥ 2.
a
0
= 1, a
1
= 9.

¸
n=2
(a
n
−6a
n−1
+ 9a
n−2
)x
n
= 0. (2)
Generating Functions

¸
n=2
a
n
x
n
= a(x) −a
0
−a
1
x
= a(x) −1 −9x.

¸
n=2
6a
n−1
x
n
= 6x

¸
n=2
a
n−1
x
n−1
= 6x(a(x) −a
0
)
= 6x(a(x) −1).

¸
n=2
9a
n−2
x
n
= 9x
2

¸
n=2
a
n−2
x
n−2
= 9x
2
a(x).
Generating Functions
a(x) −1 −9x −6x(a(x) −1) + 9x
2
a(x) = 0
or
a(x)(1 −6x + 9x
2
) −(1 + 3x) = 0.
a(x) =
1 + 3x
1 −6x + 9x
2
=
1 + 3x
(1 −3x)
2
=

¸
n=0
(n + 1)3
n
x
n
+ 3x

¸
n=0
(n + 1)3
n
x
n
=

¸
n=0
(n + 1)3
n
x
n
+

¸
n=0
n3
n
x
n
=

¸
n=0
(2n + 1)3
n
x
n
.
a
n
= (2n + 1)3
n
.
Generating Functions
Fibonacci sequence:

¸
n=2
(a
n
−a
n−1
−a
n−2
)x
n
= 0.

¸
n=2
a
n
x
n


¸
n=2
a
n−1
x
n


¸
n=2
a
n−2
x
n
= 0.
(a(x) −a
0
−a
1
x) −(x(a(x) −a
0
)) −x
2
a(x) = 0.
a(x) =
1
1 −x −x
2
.
Generating Functions
a(x) = −
1

1
−x)(ξ
2
−x)
=
1
ξ
1
−ξ
2

1
ξ
1
−x

1
ξ
2
−x

=
1
ξ
1
−ξ
2

ξ
−1
1
1 −x/ξ
1

ξ
−1
2
1 −x/ξ
2

where
ξ
1
= −

5 + 1
2
and ξ
2
=

5 −1
2
are the 2 roots of
x
2
+ x −1 = 0.
Generating Functions
Therefore,
a(x) =
ξ
−1
1
ξ
1
−ξ
2

¸
n=0
ξ
−n
1
x
n

ξ
−1
2
ξ
1
−ξ
2

¸
n=0
ξ
−n
2
x
n
=

¸
n=0
ξ
−n−1
1
−ξ
−n−1
2
ξ
1
−ξ
2
x
n
and so
a
n
=
ξ
−n−1
1
−ξ
−n−1
2
ξ
1
−ξ
2
=
1

5

¸


5 + 1
2

n+1

1 −

5
2

n+1
¸

.
Generating Functions
Inhomogeneous problem
a
n
−3a
n−1
= n
2
n ≥ 1.
a
0
= 1.

¸
n=1
(a
n
−3a
n−1
)x
n
=

¸
n=1
n
2
x
n

¸
n=1
n
2
x
n
=

¸
n=2
n(n −1)x
n
+

¸
n=1
nx
n
=
2x
2
(1 −x)
3
+
x
(1 −x)
2
=
x + x
2
(1 −x)
3

¸
n=1
(a
n
−3a
n−1
)x
n
= a(x) −1 −3xa(x)
= a(x)(1 −3x) −1.
Generating Functions
a(x) =
x + x
2
(1 −x)
3
(1 −3x)
+
1
1 −3x
=
A
1 −x
+
B
(1 −x)
2
+
C
(1 −x)
3
+
D + 1
1 −3x
where
x + x
2

= A(1 −x)
2
(1 −3x) + B(1 −x)(1 −3x)
+ C(1 −3x) + D(1 −x)
3
.
Then
A = −1/2, B = 0, C = −1, D = 3/2.
Generating Functions
So
a(x) =
−1/2
1 −x

1
(1 −x)
3
+
5/2
1 −3x
= −
1
2

¸
n=0
x
n


¸
n=0

n + 2
2

x
n
+
5
2

¸
n=0
3
n
x
n
So
a
n
= −
1
2

n + 2
2

+
5
2
3
n
= −
3
2

3n
2

n
2
2
+
5
2
3
n
.
Generating Functions
General case of linear recurrence
a
n
+ c
1
a
n−1
+· · · + c
k
a
n−k
= u
n
, n ≥ k.
u
0
, u
1
, . . . , u
k−1
are given.
¸
(a
n
+ c
1
a
n−1
+· · · + c
k
a
n−k
−u
n
) x
n
= 0
It follows that for some polynomial r (x),
a(x) =
u(x) + r (x)
q(x)
where
q(x) = 1 + c
1
x + c
2
x
2
+· · · + c
k
x
k
=
k
¸
i =1
(1 −α
i
x)
and α
1
, α
2
, . . . , α
k
are the roots of p(x) = 0 where
p(x) = x
k
q(1/x) = x
k
+ c
1
x
k−1
+· · · + c
0
.
Generating Functions
Products of generating functions
a(x) =

¸
n=0
a
n
x
n
, b(x)) =

¸
n=0
b
n
x
n
.
a(x)b(x) = (a
0
+ a
1
x + a
2
x
2
+· · · ) ×
(b
0
+ b
1
x + b
2
x
2
+· · · )
= a
0
b
0
+ (a
0
b
1
+ a
1
b
0
)x +
(a
0
b
2
+ a
1
b
1
+ a
2
b
0
)x
2
+· · ·
=

¸
n=0
c
n
x
n
where
c
n
=
n
¸
k=0
a
k
b
n−k
.
Generating Functions
Combinatorially, suppose that A, B are sets of objects and A
contains a
n
objects of weight n and B contains b
n
objects of
weight n, for all n ≥ 0.
We now consider pairs of objects (a, b) where a ∈ A, b ∈ B.
The weight of pair (a, b) is the weight of a plus the weight of b.
c
n
is the number of pairs of weight n.
Generating Functions
Simple example:
Let A = B = {0, 1, 2, . . . , } where the weight of i is i .
We want to count the number of pairs (a, b) with a + b = n.
(This is of course n + 1).
a
n
= b
n
= 1, n ≥ 0 and so a(x) = b(x) = 1/(1 −x).
Thus
c(x) =
1
(1 −x)
2
=

¸
n=0
(n + 1)x
n
.
Generating Functions
Suppose that we have r generating functions
a
1
(x), a
2
(x), . . . , a
r
(x) where
a
i
(x) =

¸
n=0
a
i ,n
x
n
and a
i ,n
is the number of objects in A
i
and weight n. Then if
c(x) = a
1
(x)a
2
(x) · · · a
r
(x) =
¸
n≥0
c
n
x
n
then c
n
is the number
of sequences x
1
x
2
· · · x
r
where
weight (x
1
) + weight (x
2
) +· · · + weight (x
r
) = n
This can be proved by induction on r .
Generating Functions
As an example, let A
1
= A
2
= · · · = A
r
= {0, 1, 2, . . . , }. Then
the number of sequences x
1
, x
2
, . . . , x
r
≥ 0 satisfying
x
1
+· · · x
r
= n is given by
[x
n
]
1
(1 −x)
r
= (−1)
n

−r
n

=

n + r −1
n

.
Generating Functions
Derangements
n! =
n
¸
k=0

n
k

d
n−k
.
Explanation:

n
k

d
n−k
is the number of permutations with
exactly k cycles of length 1. Choose k elements (

n
k

ways) for
which π(i ) = i and then choose a derangement of the
remaining n −k elements.
So
1 =
n
¸
k=0
1
k!
d
n−k
(n −k)!

¸
n=0
x
n
=

¸
n=0

n
¸
k=0
1
k!
d
n−k
(n −k)!

x
n
. (3)
Generating Functions
Let
d(x) =

¸
m=0
d
m
m!
x
m
.
From (3) we have
1
1 −x
= e
x
d(x)
d(x) =
e
−x
1 −x
=

¸
n=0
n
¸
k=0

(−1)
k
k!

x
n
.
So
d
n
n!
=
n
¸
k=0
(−1)
k
k!
.
Generating Functions
Triangulation of n-gon
Let
a
n
= number of triangulations of P
n+1
=
n
¸
k=0
a
k
a
n−k
n ≥ 2 (4)
a
0
= 0, a
1
= a
2
= 1.
+1
1
n+1
k
Generating Functions
Explanation of (4):
a
k
a
n−k
counts the number of triangulations in which edge
1, n + 1 is contained in triangle 1, k + 1, n + 1.
There are a
k
ways of triangulating 1, 2, . . . , k + 1, 1 and for
each such there are a
n−k
ways of triangulating
k + 1, k + 2, . . . , n + 1, k + 1.
Generating Functions
x +

¸
n=2
a
n
x
n
= x +

¸
n=2

n
¸
k=0
a
k
a
n−k

x
n
.
But,
x +

¸
n=2
a
n
x
n
= a(x)
since a
0
= 0, a
1
= 1.

¸
n=2

n
¸
k=0
a
k
a
n−k

x
n
=

¸
n=0

n
¸
k=0
a
k
a
n−k

x
n
= a(x)
2
.
Generating Functions
So
a(x) = x + a(x)
2
and hence
a(x) =
1 +

1 −4x
2
or
1 −

1 −4x
2
.
But a(0) = 0 and so
a(x) =
1 −

1 −4x
2
=
1
2

1
2

1 +

¸
n=1
(−1)
n−1
n2
2n−1

2n −2
n −1

(−4x)
n

=

¸
n=1
1
n

2n −2
n −1

x
n
.
So
a
n
=
1
n

2n −2
n −1

.
Generating Functions

Recurrence Relations Suppose a0 , a1 , a2 , . . . , an , . . . ,is an infinite sequence. A recurrence recurrence relation is a set of equations an = fn (an−1 , an−2 , . . . , an−k ). The whole sequence is determined by (1) and the values of a0 , a1 , . . . , ak −1 . (1)

Generating Functions

Linear Recurrence Fibonacci Sequence

an = an−1 + an−2 a0 = a1 = 1.

n ≥ 2.

Generating Functions

b1 = 3 : a b c b2 = 8 : ab ac ba bb bc ca cb cc bn = 2bn−1 + 2bn−2 n ≥ 2. c}n : aa does not occur in x}|. b. Generating Functions .bn = |Bn | = |{x ∈ {a.

(a) Bn = Bn ∪ Bn ∪ Bn (b) (c) = {x ∈ Bn : x1 = α} for α = a. . f (bx2 x3 .bn = 2bn−1 + 2bn−2 Let where Bn (b) (α) n ≥ 2. c. (c) (b) Now |Bn | = |Bn | = |Bn−1 |. . g(ax2 x3 . . xn is a bijection. Hence. |Bn | = 2|Bn−2 |. xn ) = x2 x3 . The map f : Bn → Bn−1 . . . The map (a) (b) (c) g : Bn → Bn−1 ∪ Bn−1 . xn is a bijection. xn ) = x2 x3 . . . (a) (a) Generating Functions . Bn = {x ∈ Bn : x1 = a and x2 = b or c}. b. .

One is not allowed to place a larger ring on top of a smaller ring.Towers of Hanoi Peg 1 Peg 2 Peg 3 H n is the minimum number of moves needed to shift n rings from Peg 1 to Peg 2. Generating Functions .

Hn = 2Hn−1 + 1 H n-1 moves 1 move H n-1 moves Generating Functions .

A has n dollars. Everyday A buys one of a Bun (1 dollar). and u0 = u1 = 1.B + un. Day 2.B = un−1 .P where un. So un = un−1 + 2un−2 . buy Bun. Generating Functions . un. un.I = un.”.P = un−2 . un = number of ways = un. How many ways are there (sequences) for A to spend his money? Ex. BBPIIPBI represents “Day 1. buy Bun etc. an Ice-Cream (2 dollars) or a Pastry (2 dollars).I + un.B is the number of ways where A buys a Bun on day 1 etc.

.If a0 . . a1 . Generating Functions . . an is a sequence of real numbers then its (ordinary) generating function a(x) is given by a(x) = a0 + a1 x + a2 x 2 + · · · an x n + · · · and we write an = [x n ]a(x). .

a(x) = x = x + 2x 2 + 3x 3 + · · · + nx n + · · · (1 − x)2 Generating Functions .an = 1 a(x) = 1 = 1 + x + x2 + · · · + xn + · · · 1−x an = n + 1. a(x) = 1 = 1 + 2x + 3x 2 + · · · + (n + 1)x n + · · · (1 − x)2 an = n.

Generalised binomial theorem: an = α n ∞ a(x) = (1 + x)α = n=0 α n x . n where α n = α(α − 1)(α − 2) · · · (α − n + 1) . n Generating Functions . n! an = m+n−1 n a(x) = 1 = (1 − x)m ∞ n=0 −m (−x)n = n ∞ n=0 m+n−1 n x .

General view. Given a recurrence relation for the sequence (an ). we (a) Deduce from it. by expanding a(x) as a power series. an equation satisfied by the generating function a(x) = n an x n . (c) Extract the coefficient an of x n from a(x). (b) Solve this equation to get an explicit expression for the generating function. Generating Functions .

∞ n ≥ 2. n=2 (an − 6an−1 + 9an−2 )x n = 0.Solution of linear recurrences an − 6an−1 + 9an−2 = 0 a0 = 1. a1 = 9. (2) Generating Functions .

Generating Functions .∞ n=2 ∞ an x n = a(x) − a0 − a1 x = a(x) − 1 − 9x. ∞ 6an−1 x n = 6x n=2 n=2 an−1 x n−1 ∞ = 6x(a(x) − 1). ∞ = 6x(a(x) − a0 ) an−2 x n−2 n=2 9an−2 x n = 9x 2 n=2 = 9x 2 a(x).

Generating Functions . a(x) = = n=0 ∞ 1 + 3x 1 + 3x = 2 1 − 6x + 9x (1 − 3x)2 ∞ ∞ (n + 1)3n x n + 3x n=0 ∞ (n + 1)3n x n n3n x n = n=0 ∞ (n + 1)3n x n + n=0 = n=0 (2n + 1)3n x n .or a(x) − 1 − 9x − 6x(a(x) − 1) + 9x 2 a(x) = 0 a(x)(1 − 6x + 9x 2 ) − (1 + 3x) = 0. an = (2n + 1)3n .

1 − x − x2 Generating Functions .Fibonacci sequence: ∞ n=2 ∞ (an − an−1 − an−2 )x n = 0. n=2 (a(x) − a0 − a1 x) − (x(a(x) − a0 )) − x 2 a(x) = 0. ∞ ∞ n=2 an x n − n=2 an−1 x n − an−2 x n = 0. a(x) = 1 .

a(x) = − = = where 1 (ξ1 − x)(ξ2 − x) 1 1 1 − ξ1 − ξ2 ξ1 − x ξ2 − x 1 ξ1 − ξ2 √ −1 −1 ξ1 ξ2 − 1 − x/ξ1 1 − x/ξ2 5+1 ξ1 = − and ξ2 = 2 are the 2 roots of x 2 + x − 1 = 0. √ 5−1 2 Generating Functions .

Generating Functions .Therefore. a(x) = = n=0 −1 ξ1 ξ1 − ξ2 ∞ ∞ −n ξ1 x n n=0 −n−1 −n−1 ξ1 − ξ2 ξ −1 − 2 ξ1 − ξ2 xn ∞ −n ξ2 x n n=0 ξ1 − ξ2 and so an = = −n−1 −n−1 ξ1 − ξ2 ξ1 − ξ  √2 5+1 1 √  2 5 n+1 − √ 1− 5 2 n+1  .

Generating Functions .Inhomogeneous problem a0 = 1. n2 x n n=1 (an − 3an−1 )x ∞ n = n=1 ∞ ∞ n x n=1 2 n = n=2 n(n − 1)x + x)3 + n nx n n=1 = = ∞ 2x 2 (1 − x + x2 (1 − x)3 x (1 − x)2 n=1 (an − 3an−1 )x n = a(x) − 1 − 3xa(x) = a(x)(1 − 3x) − 1. ∞ an − 3an−1 = n2 ∞ n ≥ 1.

D = 3/2. C = −1. Generating Functions . B = 0. Then A = −1/2.a(x) = = where 1 x + x2 + 3 (1 − 3x) 1 − 3x (1 − x) A C D+1 B + + + 1−x (1 − x)2 (1 − x)3 1 − 3x x + x 2 ∼ A(1 − x)2 (1 − 3x) + B(1 − x)(1 − 3x) = + C(1 − 3x) + D(1 − x)3 .

So a(x) = 5/2 −1/2 1 + − 3 1−x 1 − 3x (1 − x) ∞ ∞ n=0 1 = − 2 So x − n n=0 n+2 n 5 x + 2 2 ∞ 3n x n n=0 n+2 5 1 + 3n an = − − 2 2 2 3 3n n2 5 n − + 3 . = − − 2 2 2 2 Generating Functions .

.General case of linear recurrence an + c1 an−1 + · · · + ck an−k = un . n ≥ k. u0 . . . uk −1 are given. Generating Functions . αk are the roots of p(x) = 0 where p(x) = x k q(1/x) = x k + c1 x k −1 + · · · + c0 . a(x) = where k u(x) + r (x) q(x) q(x) = 1 + c1 x + c2 x + · · · + ck x = 2 k i=1 (1 − αi x) and α1 . . . α2 . . u1 . . . (an + c1 an−1 + · · · + ck an−k − un ) x n = 0 It follows that for some polynomial r (x).

k =0 Generating Functions . b(x)) = n=0 bn x n .Products of generating functions ∞ ∞ a(x) = n=0 an x n . a(x)b(x) = (a0 + a1 x + a2 x 2 + · · · ) × = a0 b0 + (a0 b1 + a1 b0 )x + ∞ (b0 + b1 x + b2 x 2 + · · · ) (a0 b2 + a1 b1 + a2 b0 )x 2 + · · · cn x n = n=0 where cn = n ak bn−k .

The weight of pair (a. b) is the weight of a plus the weight of b. b) where a ∈ A.Combinatorially. for all n ≥ 0. We now consider pairs of objects (a. B are sets of objects and A contains an objects of weight n and B contains bn objects of weight n. suppose that A. b ∈ B. Generating Functions . cn is the number of pairs of weight n.

} where the weight of i is i. We want to count the number of pairs (a. Generating Functions . . 1. . n ≥ 0 and so a(x) = b(x) = 1/(1 − x). b) with a + b = n. . Thus c(x) = = n=0 1 (1 − x)2 ∞ (n + 1)x n . . (This is of course n + 1). 2.Simple example: Let A = B = {0. an = bn = 1.

Generating Functions . a2 (x).n is the number of objects in Ai and weight n. ar (x) where ∞ ai (x) = n=0 ai. Then if c(x) = a1 (x)a2 (x) · · · ar (x) = n≥0 cn x n then cn is the number of sequences x1 x2 · · · xr where weight(x1 ) + weight(x2 ) + · · · + weight(xr ) = n This can be proved by induction on r . . . .n x n and ai.Suppose that we have r generating functions a1 (x). .

. . . . . x2 . let A1 = A2 = · · · = Ar = {0. . xr ≥ 0 satisfying x1 + · · · xr = n is given by [x n ] 1 −r = (−1)n r n (1 − x) = n+r −1 . n Generating Functions . 2. }. 1.As an example. . Then the number of sequences x1 . .

(3) Generating Functions .Derangements n n! = k =0 n k n dn−k . k Explanation: dn−k is the number of permutations with n exactly k cycles of length 1. So n 1 = ∞ k =0 ∞ 1 dn−k k ! (n − k )! n k =0 xn = n=0 n=0 1 dn−k k ! (n − k )! x n. Choose k elements ( k ways) for which π(i) = i and then choose a derangement of the remaining n − k elements.

m! From (3) we have 1 1−x = ex d(x) e−x 1−x ∞ d(x) = = n n=0 k =0 (−1)k k! x n. k! Generating Functions . So dn n! = n k =0 (−1)k .Let d(x) = ∞ m=0 dm m x .

a1 = a2 = 1. k +1 1 n+1 Generating Functions .Triangulation of n-gon Let an = number of triangulations of Pn+1 n = k =0 ak an−k n≥2 (4) a0 = 0.

k + 1. n + 1. 1 and for each such there are an−k ways of triangulating k + 1. n + 1. 2.Explanation of (4): ak an−k counts the number of triangulations in which edge 1. . . . . n + 1 is contained in triangle 1. k + 1. There are ak ways of triangulating 1. . k + 1. k + 2. . . . Generating Functions .

But. ∞ n ∞ n ak an−k n=2 k =0 xn = n=0 2 k =0 ak an−k xn = a(x) . Generating Functions . a1 = 1. x+ an x n = a(x) n=2 since a0 = 0.∞ ∞ n x+ n=2 an x = x + n=2 ∞ k =0 n ak an−k x n.

n n−1 an = 1 2n − 2 . 2 2 But a(0) = 0 and so √ 1 − 1 − 4x a(x) = 2 ∞ 1 1 (−1)n−1 2n − 2 = (−4x)n 1+ − 2 2 n22n−1 n − 1 n=1 ∞ = n=1 1 2n − 2 n x . n n−1 Generating Functions So .So a(x) = x + a(x)2 and hence a(x) = 1+ √ √ 1 − 4x 1 − 1 − 4x or .