4. To solve the recurrence relation by
generating functions, we have numeric
function for the closed form expression of
generating function
A(z) = a0 + a1z + a2z2 + a3z3 + β¦
6. Example 1:
Solve recurrence relation by generating function
1. Multiply both sides by zr
Steps to follow
ar - 2ar-1 - 3ar-2 = 0, for r ο³ 2, a0 = 3; a1 = 1
a r - 2 1
r
- 3
2
r
= 0r
z ar-
z ar-
z
7. Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο³ 2, a0 = 3; a1 = 1
2. Since r ο³ 2, summing for all r, we get
arzr β 2 ar-1zr β 3 ar-2zr = 0
r = 2
ο₯
r = 2
ο₯
r = 2
ο₯
Solving individually
For the 1st term:
ο arzr = a2z2 + a3z3 + a4z4 + οοοr = 2
ο₯
A(z) = a0 + a1z + a2z2 + a3z3 + β¦
ο arzr = A(z) - a0 - a1zr = 2
ο₯
ο ο ο
8. Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο³ 2, a0 = 3; a1 = 1
For the 2nd term:
ο ar-1zr = a1z2 + a2z3 + a3z4 + οοο
r = 2
ο₯
Factoring out z:
ο ar-1zr = z[A(z) β a0 ]r = 2
ο₯
A(z) = a0 + a1z + a2z2 + a3z3 + β¦
Z(a1z + a2z2 + a3z3 + οοο)
9. Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο³ 2, a0 = 3; a1 = 1
For the 3rd term:
ο ar-2zr = a0z2 + a1z3 + a2z4 + οοο
r = 2
ο₯
Factoring out z2:
ο ar-2zr = z2[A(z)]r = 2
ο₯
A(z) = a0 + a1z + a2z2 + a3z3 + β¦
z2( a0 + a1z + a2z2 + οοο)
10. Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο³ 2, a0 = 3; a1 = 1
Substitute
ο ar-2zr = z2[A(z)]r = 2
ο arzr β 2ο ar-1zr β 3 ο ar-2zr = 0
r = 2
ο₯
r = 2
ο₯
r = 2
ο₯
by
ο arzr = A(z) - a0 - a1zr = 2
ο₯
ο₯
ο ar-1zr = z[A(z) β a0 ]r = 2
ο₯
11. Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο³ 2, a0 = 3; a1 = 1
We get
z2[A(z)]A(z) - a0 - a1z z[A(z) β a0 ]β 2 β 3
Substitute the value of a0 = 3; a1 = 1
A(z) β 3 - (1)z z[A(z) β 3 ]β 2 β 3z2[A(z)]
simplify
A(z) =
π βππ
π βππ βππ π
13. Solving Recurrence relation using Generating Functions
ar - 2ar-1 - 3ar-2 = 0, for r ο³ 2, a0 = 3; a1 = 1
π βππ
(π βππ)(π+π)
=
π
(π βππ)
π
(π + π)
+
From the table previously presented:
A(z) =
π
πβππ
π π
ar = 1 ο 3r + 2 ο (-1)r
14. Example 2
G(x) = a0 + a1x + a2x2 + ο ο ο = ο anxn:
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
Let G(x) be the generating function for the sequence
a0; a1; a2; : : :. That is,
We will use generating functions to obtain a formula
for an.
ο₯
n=0
15. Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
The first step in the process is to use the
recurrence relation to replace
This can only be done when n ο³ 2,
an by an-1 - 6an-2.
so the first two terms (arising form the initial
conditions) need to be separated from the
sigma notation to obtain:
16. G(x) = a0 + a1x + ο anxn
= a0 + a1x + ο(an-1 - 6an-1)xn
= a0 + a1x + ο an-1xn- ο6an-1xn
ο₯
n=2
ο₯
n=2
ο₯
n=2
ο₯
n=2
= a0 + a1x + x ο an-1xn-1- 6x2οan-2xn-2
ο₯
n=2
ο₯
n=2
In the last line above, constants and powers of x have
been factored out
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
17. so that the power to which x is raised βinside"
each sum exactly matches the subscript on the
coefficient ai.
which will make it easy to recognize each
summation as being G(x), with a few terms
possibly missing.
The reason for doing this is that the next step is
to make a change of index (on the subscripts),
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
18. In the first sum
When n = 2, k = 1
ο₯
n=2
Put k = n - 1
ο an-1xn-1
As n goes to infinity, so does k.
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
19. ο₯
k=2
ο akxk = G(x) - ao
the sum becomes
With this change of index,
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
20. In the next sum
ο₯
n=2
ο an-2xn-2
When n = 2, k = 0
Put k = n - 2
As n goes to infinity, so does k.
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
21. ο₯
k=0
ο akxk = G(x)
the sum becomes
With this change of index,
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
22. Combining these steps,
we arrive at
G(x) = a0 + a1x + x(G(x) - a0) - 6x2G(x).
After plugging in the known values for
a0 and a1,
then rearranging
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
23. G(x) =
π + ππ
π β π + ππ π
this becomes
(1 - x + 6x2)G(x) = 1 + 4x.
Hence, we obtain the closed form
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
24. Notice the similarity of the coefficients in
1 - x + 6x2 and an β an-1 + 6an-2.
The next step is to use partial fractions to
determine the power series representation
of
1
1 β π₯ + 6π₯2
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
25. We will eventually want the
sum of coefficient of xn and
four times the coefficient of xn-1
in this series.
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
26. Next, we want to write
1- x + 6x2
If ο‘ and ο’ are integers,
they are positive among the
divisors of 6 and their negatives.
(1- ο‘x)(1- ο’x).=
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
27. Multiplying
(1- ο‘x)(1- ο’x).
we have,
1 - ο‘x - ο’x + ο‘ο’x2
ο‘ο’ = 6
ο’ = 1- ο‘
lead to
- ο‘ - ο’= -1 or
1- x + 6x2
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
28. ο‘ο’ = 6
Therefore,
ο‘(1- ο‘) = 6
ο‘- ο‘2 = 6
and the quadratic formula gives
β =
1 Β± π 23
2
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
29. Let,
πΌ =
1 β π 23
2
π½ =
1 + π 23
2
So that
If, 1
1 β π₯ + 6π₯2
=
π΄
1 β πΌπ₯
+
π΅
1 β π½π₯
=
π΄ 1 β π½π₯ + π΅(1 β πΌπ₯)
(1 β πΌπ₯)(1 β π½π₯)
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
30. -ο’A - ο‘B = 0
then, equating coefficients of like powers of x
from the leftmost and rightmost expressions
gives the two equations in the two
unknowns A and B:
A + B = 1
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
31. so that (ο‘ - ο’ )A = ο‘ .
Since ο‘ - ο’ = -i 23,
the quantity
π΄ =
πΌ
βi 23
=
1 β π 23
β2i 23
π 23
i 23
ο =
23 + π 23
46
B = 1 - A =
and, therefore,
23 β π 23
46
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
32. Hence,
1
1 β π₯ + 6π₯2
=
π΄
1 β πΌπ₯
+
π΅
1 β π½π₯
ο₯
n=0
Aο πΌnxn= +
ο₯
n=0
Bο π½nxn
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
33. The coefficient of xn is
AπΌ + π΅π½ = +
23 + π 23
46
1 β π 23
2
π
23 β π 23
46
1 + π 23
2
π
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.
34. The coefficient of xn in
G(x) =(1+ππ±)
and 4 times the coefficient of xn-1 in,
is the sum of the coefficient of xn in
1
1 β π₯ + 6π₯2
π
π β π + ππ π
1
1 β π₯ + 6π₯2
Solving Recurrences using Generating Functions
Let a0 = 1; a1 = 5, and an = an-1 - 6an-2 for n ο³ 2.