0% found this document useful (0 votes)
16 views36 pages

DM 5

The document discusses recurrence relations and generating functions for sequences, providing examples of different sequences and their corresponding generating functions. It outlines definitions, properties, and operations related to generating functions, as well as exercises to apply the concepts. Additionally, it covers the calculation of coefficients in generating functions and introduces linear recurrence relations with examples.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views36 pages

DM 5

The document discusses recurrence relations and generating functions for sequences, providing examples of different sequences and their corresponding generating functions. It outlines definitions, properties, and operations related to generating functions, as well as exercises to apply the concepts. Additionally, it covers the calculation of coefficients in generating functions and introduces linear recurrence relations with examples.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 36

Recurrence Relations

Generating Functions of Sequences


Sequences
A = {ar}, r = 0 .. .
Examples:

1. A = {ar}, r = 0 .. , where ar = 2r.


= {1, 2, 4, 8, 16, …, 2r, …}
2. B = {br}, r = 0 .. , where
br = 0, if 0  r  4
= 2, if 5  r  9
= 3, if r = 10
= 4, if 11  r
= {0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 3, 4, 4, …}
3. C = {cr}, r = 0 .. , where cr = r + 1.
= {1, 2, 3, 4, 5, …}

4. D = {dr}, r = 0 .. , where dr = r2.


= {0, 1, 4, 9, 16, 25, …}
Generating function for the sequence A = {ar}, r = 0 .. .

A(X) = a0 + a1X + a2 X2 + … + anXn + …


=  ar Xr, r = 0 .. .

Examples:

1. Generating function for the sequence A = {a r}, r = 0 .. ,


where ar = 2r.
A(X) = 1 + 2X + 4X2 + … + 2n Xn + …
=  2r Xr, r = 0 .. .
2. Generating function for the sequence B = {b r}, r = 0 .. ,
where
br = 0, if 0  r  4
= 2, if 5  r  9
= 3, if r = 10
= 4, if 11  r
B(X) = 2X5 + 2X6 + 2X7 + 2X8 + 2X9 + 3X10 + 4X11 +
4X12 + … + 4Xn + …

3. Generating function for the sequence C = {c r}, r = 0 .. ,


where cr = r + 1.
C(X) = 1 + 2X + 3X2 + … + (n+1)Xn + …
=  (r+1)Xr, r = 0 .. .

4. Generating function for the sequence D = {d r}, r = 0 .. ,


where dr = r2.
D(X) = X + 4X2 + 9X3+ 16X4 + 25X5 + … + n2 Xn + …
=  r2 Xr, r = 0 .. .
Definitions

Let the Generating Functions / Formal Power Series be


A(X) =  ar Xr, r = 0 .. .
and B(X) =  bs Xs, s = 0 .. .

1. Equality
A(X) = B(X), iff an = bn for each n  0.

2. Multiplication by a scalar number C


C A(X) =  (C ar) Xr, r = 0 .. .

3. Sum
A(X) + B(X) =  (an + bn) Xr, r = 0 .. .

4. Product

A(X) B(X) =  Pn Xn, n = 0 .. ,


where Pn = j+k-n aj bk.
Exercises:
1. Find a Generating function for the sequence
A = {ar}, r = 0 .. , where
ar = 1, if 0  r  2
= 3, if 3  r  5
= 0, if r 
A(X) = 1 + X + X2 + 3X3 + 3X4 + 3X5

2. Build a generating function for ar = no. of integral solutions to the


equation e1 + e2 + e3 = r, if 0  ei  3 for each i.
A(X) = (1 + X + X2 + X3)3
3. Write a generating function for ar = no. of ways of selecting r balls from 3
red balls, 5 blue balls, and 7 white balls.
A(X) = (1 + X + X2 + X3) (1 + X + X2 + X3 + X4+ X5)
(1 + X + X2 + X3 + X4 + X5 + X6 + X7)
4. Find the coefficient of X23 in (1 + X5 + X9)10.
e1 + e2 + … + e10 = 23 where ei = 0, 5, 9.
1 x 5 + 2 x 9 + 7 x 0 = 23
Coefficient of X23 = 10! / (1! 2! 7!)
= 10 . 9 . 8 / (2)
= 10. 9 . 4
= 360
5. Find the coefficient of X32 in (1 + X5 + X9)10.
e1 + e2 + … + e10 = 32 where ei = 0, 5, 9.
1 x 5 + 3 x 9 + 6 x 0 = 32
Coefficient of X32 = 10! / (1! 3! 6!)
= 10 . 9 . 8 . 7/ (3 . 2)
= 10. 3 . 4 . 7
= 840
6. Find a Generating function for the no. of r-combinations of {3.a, 5.b, 2.c}.
A(X) = (1 + X + X2 + X3) (1 + X + X2 + X3 + X4+ X5 )
(1 + X + X2)
Calculating Coefficient of generating function

If A(X) =  ar Xr, r = 0 .. , then A(X) is said to have a multiplicative inverse


if there is B(X) =  bk Xk, k = 0 .. 
such that A(X) B(X) = 1.

a0 b 0 = 1
a1 b 0 + a0 b1 = 0
a0 b 2 + a1 b1 + a2 b0 = 0
a0 b 3 + a1 b2 + a 2 b1 + a3 b0 = 0

a0 b 2 + a0 b2 + … + a 0 b2 = 0

b0 = 1 / a0
b1 = –a1 b0 / a0
b2 = –a1 b1 – a2 b0 / a0

Geometric Series

A(X) = 1 – X
a0 = 1, a1 = –1.
b0 = 1 / a 0 = 1
b1 = –a1 b0 / a0 = –(–1) (1) / (1) = 1
b2 = –a1 b1 – a2 b0 / a0 = –(–1) (1) – (0) (1) / (1) = 1

bi = 1
1 / (1 – X) =  Xr, r = 0 .. .
Replace X by aX, where a is a real no.

1 / (1 – aX) =  ar Xr, r = 0 .. .

Let a = –1
1 / (1 + X) =  (–1)r Xr, r = 0 .. .
1 / (1 + aX) =  (–1)r ar Xr, r = 0 .. .
1 / (1 – X)n = ( Xk) n, k = 0 .. .
=  C(n – 1 + r, r) Xr, r = 0 .. .
1 / (1 + X)n = ( (–1)r Xk) n, k = 0 .. .

=  C(n – 1 + r, r) (–1)r Xr, r = 0 .. .

1 / (1 – aX)n = ( ar Xk ) n, k = 0 .. .

=  C(n – 1 + r, r) ar Xr, r = 0 .. .

1 / (1 – Xk) =  Xkr, k = 0 .. .

1 / (1 + Xk) =  (–1)r Xkr, k = 0 .. .

1 / (a – X) = (1 / a)  Xr / ar, r = 0 .. .

1 / (X – a) = (–1 / a)  Xr / ar, r = 0 .. .

1 / (X + a) = (1 / a)  Xr / ((–1)r ar), r = 0 .. .

1 + X + X2 + … + Xn = (1 – Xn+1 ) / (1 – x)
Special Cases of Binomial Theorem

(1 + X)n = 1 + C(n, 1) X + C(n, 2) X2 + … + C(n, n) Xn

(1 + Xk) n = 1 + C(n, 1) Xk + C(n, 2) X2k + … + C(n, n) Xnk

(1 – X) = 1 – C(n, 1) X + C(n, 2) X2 + … + (–1)n C(n, n) Xn

(1 – Xk) n = 1 – C(n, 1) Xk + C(n, 2) X2k + … + (–1)n C(n, n) Xnk


Examples:

1. Calculate A(X) =  ar Xr, r = 0 ..  = 1 / (X2 – 5X + 6).

(X2 – 5X + 6) = (X – 3) (X – 2)
1 / (X2 – 5X + 6) = A / (X – 3) + B / (X – 2)
 A(X – 2) + B(X – 3) = 1
Let X = 2, Then B = –1
Let X = 3, Then A = 1
1 / (X2 – 5X + 6)
= 1 / (X – 3) – 1 / (X – 2)
= (–1 / 3)  Xr / 3r – (–1 / 2)  Xr / 2r, r = 0 .. .
= (–1 / 3)  Xr / 3r + (1 / 2)  Xr / 2r, r = 0 .. .
2. Compute the coefficients of A(X) =  ar Xr, r = 0 .. 
= (X2 – 5X + 3) / (X4 – 5X2 + 4).

(X4 – 5X2 + 4) = (X2 – 1) (X2 – 4)


= (X – 1) (X + 1) (X – 2) (X + 2)
(X2 – 5X + 3) / (X4 – 5 X2 + 4)
= A / (X – 1) + B / (X + 1) + C / (X – 2) + D / (X + 2)
(X2 – 5X + 3) = A (X + 1) (X – 2) (X + 2)
+ B (X – 1) (X – 2) (X + 2)
+ C (X – 1) (X + 1) (X + 2)
+ D (X – 1) (X + 1) (X – 2)
For X = 1, A = 1 / 6
For X = –1, B = 3 / 2
For X = 2, C = –1 / 4
For X = –2, D = –17 / 12
(X2 – 5X + 3) / (X4 – 5 X2 + 4)
= 1/(6(X – 1)) + 3/(2(X + 1)) – 1/(4(X – 2)) – 17/(12(X + 2))
= (–1/6)Xr + 3/2(–1) r Xr – 1/4(–1/2) Xr /2r
17/12(1/2) Xr /((–1)r 2r), r = 0 .. 
=  [(–1/6) + 3/2(–1)r + 1/8(1/ 2r) – 17/24(–1)r / 2r)] Xr, r = 0 .. 
3. Find the coefficient of X20 in (X3 + X4 + X5 + …)5.
(X3 + X4 + X5 + …)5
= [X3 (1 + X + X2 + …)]5
= X15 (Xr)5, r = 0 .. 
= X15 C(5 – 1 + r, r) Xr, r = 0 .. 
= X15 C(4 + r, r) Xr, r = 0 .. 
Coefficient of X20 in (X3 + X4 + X5 + …)5
= Coefficient of X5 in C(4 + r, r) Xr, r = 0 .. 
r=5
C(4 + r, r)
= C(9, 5)
= 9! / (5! 4!)
= 9 . 8 . 7 . 6 / (4 . 3 . 2)
=9.7.2
= 126
Recurrence relations

Recurrence relation
Formula that relates for any integer n ≥ 1, the nth term of a sequence
A = {ar}, r = 0 ..  to one or more of the terms a0, a1, …, an-1.

Examples
an + 5an-1 + 6an-2 = 0.
an + 5an-1 + 6an-2 = 3n2 – 2n + 1.
Linear recurrence relation
A recurrence relation of the form
c0(n) + c1(n)an + … + ck(n) an-k = f(n) for n ≥ k,
where c0(n), c1(n), …, ck(n), and f(n) are functions of n.
Example
an – (n – 1)an-1 – (n – 1)an-2 = 5n.

Linear recurrence relation of degree k


c0(n) and ck(n) are not identically zero.
Example
an + 5an-1 + 6an-2 = 0.
Linear recurrence relation with constant coefficients
c0(n), c1(n), …, ck(n) are constants.
Example
an + 5an-1 + 6an-2 = 0.

Homogeneous recurrence relation


f(n) is identically zero.
Example
an + 5an-1 + 6an-2 = 0.

Inhomogeneous recurrence relation


f(n) is not identically zero.
Example
an + 5an-1 + 6an-2 = 5n.
Solving recurrence relation by substitution and Generating
functions
Solving recurrence relation by substitution / Backtracking
Technique for finding an explicit formula for the sequence defined
by a recurrence relation.
Backtrack the value of an by substituting the definition of an-1, an-2,
… until a pattern is clear.
Examples
1. Use the technique of backtracking, to find an explicit formula for the
sequence defined by the recurrence relation and initial condition for
an = an-1+ 3, a1=2.
an = an-1 + 3 or an = an-1+ 1.3
= (an-2 + 3) + 3 = an-2+ 2.3
= ((an-3 + 3) + 3) + 3 = an-3+ 3.3
… …
= an-(n-1) + (n–1).3
= a1+ (n–1).3
= 2 + (n–1).3
 The explicit formula for the sequence is
an = 2 + (n-1).3
2. Use the technique of backtracking, to find an explicit formula for the
sequence defined by the recurrence relation and initial condition for
an = 2.5an-1, a1 = 4.

an = 2.5an-1
= 2.5(2.5an-2)
= (2.5)2an-2
= (2.5)3an-3

= (2.5)n-1an-(n-1)
= (2.5)n-1a1
= 4(2.5)n-1
 Explicit formula is an = 4(2.5)n-1
3. Use the technique of backtracking, to find an explicit formula for the
sequence defined by the recurrence relation and initial condition for
an= 5an-1+ 3, a1= 3.

an = 5an-1 + 3
= 5(5an-2+ 3) + 3
= 52an-2 + (5 + 1)3
= 52 (5an-3+ 3) + (5 + 1)3
= 53an-3 + (52 + 5 + 1)3

= 5n-1an-(n-1)+ (5n-2+ … + 52 + 5 + 1)3
=5n-1 a1 + (5n-2+ … + 52+ 5 + 1)3
= 5n-13 + (5n-2+ … + 52 + 5 + 1)3
= (5n-1+ 5n-2+ … + 52 + 5 + 1)3
= 3(5n– 1) / 4
 Explicit formula is an = 3(5n– 1) / 4
4. Use the technique of backtracking, to find an explicit formula for the
sequence defined by the recurrence relation and initial condition for
an = a n-1+ n, a1 = 4.

an = a n-1 + n
= an-2 + (n–1) + n
= an-3 + (n–2) + (n–1) + n

= an-(n-1)+ [n– (n–1) + 1] + … + (n–1) + n
= a1 + 2 + … + (n–1) + n
= a1 – 1 + [1 + 2 + … + (n-1) + n]
= 4 – 1 + n(n+1)/2
= 3 + n(n+1)/2

 Explicit formula is an = 3 + n(n+1)/2


Solving recurrence relations by Generating functions
Shifting properties of generating functions
Xk A(X) = Xk  anXn, n = 0 .. 
=  an Xn+k, n = 0 .. 
Replacing n+k by r, we get
 ar-k Xr, r = k .. 
Equivalent expressions for generating functions
If A(X) =  anXn, n = 0 .. , then
 anXn, n = k ..  = A(X) – a0 – a1X – … – ak-1Xk-1.
 an-1Xn, n = k ..  = X(A(X) – a0– a1X – … – ak-2Xk-2).
 an-2 Xn, n = k ..  = X2(A(X) – a0 – a1X – … – ak-3Xk-3).
 an-3 Xn, n = k ..  = X3(A(X) – a0 – a1X – … – ak-4Xk-4).

 an-k Xn, n = k ..  = Xk(A(X)).
Examples
 1. Solve the recurrence relation an – 7 an-1 + 10 an-2 = 0, n ≥ 0,
a0 = 10, a1 = 41, using generating functions.

1. Let A(X) =  an Xn, n = 0 .. .


2. Multiply each term in the recurrence relation by X n and sum from
2 to ∞.
 an Xn – 7 an-1 Xn + 10 an-2 Xn = 0, n = 2 .. .
3. Replace each infinite sum by an equivalent expression.
[A(X) – a0 – a1X] – 7X[A(X) – a0] + 10X2[A(X)] = 0.
4. Simplify.
A(X)(1 – 7X +10X2) = a0 + a1X – 7 a0 X.
A(X) = [a0 + (a1 – 7 a0)X] / (1 – 7X +10X2)
= [a0 + (a1 – 7 a0)X] / [(1 – 2X) (1 – 5X)]
5. Decompose A(X) as a sum of partial fractions.
A(X) = C1 / (1 – 2X) + C2 / (1 – 5X)
6. Express A(X) as a sum of familiar series.
A(X) = C1  2n Xn + C2  5n Xn , n = 0 .. .
= (C1 2n + C2 5n) Xn , n = 0 .. .
7. Express an as the coefficient of Xn in A(X) and in the sum of the
other series.
an = C1 2n + C2 5n.
8. Determine the values of C1 and C2 .
For n = 0, a0 = C1 + C2 = 10 … (1)
For n = 1, a1 = 2 C1 + 5 C2 = 41 … (2)
Solving (1) and (2), we get
C1 = 3
C2 = 7
 an = (3) 2n + (7) 5n.
 2. Solve the recurrence relation an – 9 an-1 + 26 an-2 – 24 an-3 = 0,
n ≥ 3, a0 = 0, a1 = 1, and a2 = 10 using generating functions.

1. Let A(X) =  an Xn, n = 0 .. .


2. Multiply each term in the recurrence relation by X n and sum from 3
to ∞.
 an Xn – 9  an-1 Xn + 26  an-2 Xn – 24  an-3 Xn = 0,
n = 3 .. .
3. Replace each infinite sum by an equivalent expression.
[A(X) – a0 – a1 X – a2 X2] – 9X [A(X) –a0 – a1X] –
26X2 [A(X) – a0] –24X3[A(X)] = 0.
4. Simplify.
A(X)(1 – 9X + 26X2 – 24X3)
= a0 + a1 X + a2 X2 – 9 a0 X – 9 a1 X2 + 26 a0 X2.
A(X) = [a0 + ( a1 – 9 a0 ) X + ( a2 – 9 a1+ 26 a0 ) X2] /
(1– 9X + 26X2 – 24X3)
= [a0 + (a1 – 9 a0) X + (a2 – 9 a1 + 26 a0) X2] /
[(1 – 2X) (1 – 3X) (1 – 4X)]
5. Decompose A(X) as a sum of partial fractions.
A(X) = C1 / (1 – 2X) + C2/ (1 – 3X) + C3/ (1 – 4X)
6. Express A(X) as a sum of familiar series.
A(X) = C1  2n Xn + C2  3n Xn + C3  4n Xn, n = 0 .. .
= (C12n + C2 3n + C2 3n + C3 4n) Xn, n = 0 .. .
7. Express an as the coefficient of Xn in A(X) and in the sum of the
other series.
an = C1 2n + C2 3n + C3 4n.
8. Determine the values of C1, C2 and C3.
Substituting a0 = 0, a1 = 1, and a2 = 10 in step 4, we get
A(X) = [X + X2] / [(1 – 2X) (1 – 3X) (1 – 4X)]
= C1 / (1 – 2X) + C2 / (1 – 3X) + C3 / (1 – 4X)
i.e., C1(1 – 3X) (1 – 4X) + C2 (1 – 2X) (1 – 4X)
+ C3(1 – 2X) (1 – 3X) = X + X2
for X = 1/2, C1 = 3/2
for X = 1/3, C2 = –4
for X = 1/4, C3 = 5/2

 an = (3/2) 2n – (4) 3n + (5/2) 4n .


Exercises
1. Solve the recurrence relation an – an-1 – 9 an-2+ 9 an-3= 0, n ≥ 3,
a0 = 0, a1 = 1, and a2 = 2 using generating functions.
2. Solve the recurrence relation an– 3 an-2 + 2 an-3= 0, n ≥ 3, a0 = 1,
a1 = 0, and a2 = 0 using generating functions
Method of Characteristics roots
Characteristic equation for a linear homogeneous recurrence relation
of degree k, an = r1an-1+ … + rkan-k is
xk = r1xk-1+ r2xk-2+ … + rk.
1. Characteristic equation x2 – r1x – r2 = 0 of the recurrence relation
an = r1an-1+ r2an-2, having two distinct roots s1 and s2.
Explicit formula for the sequence is an = us1n + vs2n and u and v
depend on the initial conditions.
2. Characteristic equation x2 – r1x – r2 = 0 of the recurrence relation
an = r1an-1+ r2an-2 having a single root s.
Explicit formula for the sequence is an = usn + vnsn and u and v
depend on the initial conditions.
Examples
1. Solve the recurrence relation an = 4an-1 + 5an-2, a1 = 2, a2 = 6.
The associated equation is x2 – 4x – 5 = 0
i.e. (x – 5)(x + 1) = 0
 The different roots are s1 = 5 and s2 = –1.
Explicit formula is an = us1n + vs2n
a1 = u(5) + v(–1) = 5u – v
Given a1 = 2
 5u – v = 2 (1)
a2 = u(5)2 + v(–1)2 = 25u + v
Given a2 = 6
 25u + v = 6 (2)
Solving the equations (1) and (2), we get
u = 4/15 and v = –2/3
 Explicit formula is an = us1n + vs2n
= 4/15(5)n –2/3(–1)n
2. Solve the recurrence relation an = -6an-1 – 9an-2,
a1 = 2.5, a2 = 4.7.
The associated equation is x2 + 6x + 9 = 0
i.e. (x + 3)2 = 0
 The multiple root is s = –3.

Explicit formula is an = usn + vsn


a1 = u(–3) + vn(–3) = –3u + 3v

Given a1 = 2.5
 –3u + 3v = 2.5 (1)

a2 = u(–3)2 + vn(–3)2 = 9u + 18v

Given a2 = 4.7
 9u + 18v = 4.7 (2)

Solving the equations (1) and (2), we get


u = –19.7/9 and v = 12.2/9

 Explicit formula is an = usn + vnsn


= (–19.7/9)(–3)n + (12.2/9)n(–3)n
3. Solve the recurrence relation an = 2an-2 , a1 = 2, a2 = 6.

The associated equation is x2 – 2 = 0


i.e. (x – 2)(x + 2) = 0
 The different roots are s1 = 2 and s2 = –2.

Explicit formula is an = us1n + vs2n

a1 = u(2) + v(–2) = 2u – 2v

Given a1 = 2
 2u – 2v = 2
u–v=1 (1)

a2 = u(2)2 + v(–2)2 = 2u + 2v

Given a2 = 6
 2u + 2v = 6
u+v=3 (2)

Solving the equations (1) and (2), we get


u = 2 and v = 1

 Explicit formula is an = us1n + vs2n

= 2(2)n + (–2)n

You might also like