Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
15 views

Recurrence Relation and Generating Functions Notes

Sequences and series

Uploaded by

harshcsk2023
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Recurrence Relation and Generating Functions Notes

Sequences and series

Uploaded by

harshcsk2023
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Module 5 Generating Functions and Recurrence Relations

Introduction :
Recursion is an elegant and powerful problem  solving technique, used extensively in
both discrete mathematics and computer science. Many programming languages, such
as ALGOL, FORTRAN 90, C++ and Java, support recursion.

In addition, there are three simple methods for solving recurrence relations : iterations,
characteristic equations and generating functions.

We also establish the validity of recursive algorithms using induction and analyze their
complexities using bigoh and bigtheta notations.

Definition :
An equation that expresses a n , the general term of the sequence {an} in terms of one or
more of the previous terms of the sequence, namely a 0 , a1 , ………, an1 for all integers n
with n n0 , where n0 is an called a recurrence relation for {an} or a difference equation.

If the terms of a sequence satisfy a recurrence relation, then the sequence is called a
solution of recurrence relation.

Type I
Non-Homogenous, Linear Recurrence Relation
1. Determine the sequence a n whose recurrence relation is an = an1 + 3 with initial
condition a1 = 2.

Soln. :
This is linear, nonhomogenous recurrence relation.
 We use back tracking method
an = an1 + 3 with a1 = 2
an = an2 3 3
= an2 3 3
= an3 33 3
= an3 3 3 3
     
= ann1 3 3 3 ... to (n 1)
= a1 + 3(n 1)
= 3n 1
 Sequence is 2, 5, 8, 11, …
2. Determine the sequence b n whose recurrence relation is bn = 2bn1 + 1 with initial
condition b1 = 7.

Soln. :
The recurrence relation is linear & nonhomogenous
 We use back tracking method
b n = 2bn1 + 1, b1 = 7
bn = 2(2bn2 + 1) + 1
= 22 bn2 2 1
= 22 2b n3 12 1
= 23 bn3 22 2 1
…………………….
= 2n1b  2 n2 2n3 ... 2 1

 
n n1
n1 2 n2
=
2 b1  12 2 ... 2

= 2n1 7 
12 n1

1

2 1
= 7 2 2 1
n1 n1

bn = 8 2n1 1 2n2 1


 The sequence is 7, 15, 31, 63, …

Type II
Homogenous, Linear Recurrence Relation

Note :
(a) If the characteristic equation ax2 + bx + c = 0 has two roots s 1 and s 2 , then
Case (i) If s 1 ≠ s 2 , then the formula for the sequence is given by a n = us 1n vs 2n
Case (ii) If it has equal roots each = s, then the formula for the sequence is given
n n
by an = us + vns , where u and v are constants depending on initial
conditions.

(b) If the characteristic equation ax3 + bx2 + cx + d = 0 has 3 roots S 1, S 2 and S3 then
Case (i) if, s 1 = s 2 = s 3 = s (say)
then the formula for the sequence is given by
a n = (u +v n + wn2) . sn
Case (ii) if s 1 = s 2 = s (say)
and s  s 3
then the formula for the sequence is given by
an = (u vn).s n n
 w s3
Case (iii) if s1 s2 s3
then the formula for the sequence is given by
an u s1n v s2n w s3n
where u, v, w are constants depending on initial conditions.
3. Determine the sequence whose recurrence relation is given by C n = 3Cn1 2Cn2
with initial conditions C 1 = 5, C 2 = 3.
[D-08]

Soln. :
The quadratic equation associated with this recurrence relation is x2 = 3x  2 with
every linear homogenous recurrence relation there is associated a quadratic
equation.
 C n = 3Cn 1 2 C n 2
 x2 = 3x 2
x 3x + 2 = 0
2

 (x 1) (x 2) = 0


x = 1, 2
n

n
C n = u (1) + vn (2)
 C n = u + v (2)
Put n = 1
 C 1 = u + 2v
 u + 2v = 5 … (1)
Put n = 2
 C 2 = u + 4v
 u + 4v = 3 … (2)
 v = 1 & u = 7
 C n = 7 (2)
n

 Sequence is 5, 3, 1, 9, …

4. Determine the sequence whose recurrence relation is a n = 2an1 an2 with initial
conditions a1 = 1.5, a2 = 3. [M-09]

Soln. :
a n = 2an1 an2 & the associated quadratic equation is x = 2x 1
2

 x2 2x + 1 = 0
 (x 1)2 = 0
 x = 1, 1
 Formula for sequence is an u1 vn1
n n

 an u vn
Put n = 1
 a1 = u + v u + v = 1.5 …(1)
Put n = 2
 a2 = u + 2v u + 2v = 3 …(2)
 v = 1.5 & u = 0
 a n = (1.5) n
The sequence is 1.5, 3, 4.5, 6, …
5. Determine the sequence whose recurrence relation is a n = 4an1 5an2 with a1 = 2
& a2 = 6.

Soln. :
x2 = 4x + 5 x2 4x 5 = 0
x 5x + x 5 = 0
2

x (x 5) + 1(x 5) = 0 (x + 1) (x 5) = 0


x = 1 & x = 5
u  1 v 5
n n
 an =

Put n = 1
 a1 = u + 5vu + 5v = 2 …(1)

Put n = 2
 a2 = u + 25v u + 25v = 6 …(2)

30 v = 8
 v = 4/15
 u + 4/3 = 2
4 2
 u = 2 
3 3
 2  n  4  n
  1 
  
5
an =  
 3  15 

Fibonacci Sequence
1, 1, 2, 3, 5, 8, …
fn fn1 fn2
The recurrence relation is given by fn fn1 fn2 which is homogenous & linear. The
quadratic equation is x2 = x + 1, f 1 = f2 = 1
 x2 x 1 = 0
114
 x =
2
1 5
 x =
2

 x1 1 5 ; x 1 5
2 2 2
 fn = us1 vs 2
n n

n n
1 5  1 5 
 fn = u  
 v  
 2   2 
 Put n = 1  
   1 5  v 15 
 f1 =   
u 
 2   2 
 u1 5   v1 5 
= 1 …(1)
  
  2   2 
Put n = 2 
2 2
1 5  15 
 f 2 = u  
 v   2 

 2   
2 5 2
 u1 5   v1 =1 …(2)
   
 2   2 
1 1
Solving (1) & (2) simultaneous u  & v 
5 5
n n
1 1 5  1 1 5 
 fn =  
  
 

5  2  5  2 

Procedure to find particular solution :
For the certain functions F(n) such as polynomials in n and power of constants, the forms
of the corresponding particular solution.

Forms of F(n) Form of a(p) to be assumed


n
1. c, a constant A, a constant
2. n A0 n2+ A1
3. A0 n + A 1n + A 2
n2t A 0 nt + A 1n(t 1)+ ………+A n
4. n , t Z+
5. rn, r  R [r is not a root Arn
characteristic equation]

When F(n) is linear combination of the terms is 1st column then an(p) is the linear
combination of corresponding terms in 2nd column.

Case (1) When, F(n) = rn or (A + B n) rn


where, ‘r’ is nonrepeated root of Recurrence relation.
then, a n(p) is assumed Anrn or (n(A + Bn)rn

Case (2) When F(n) = rn


where, r is twice repeated roots
then, a n(p) is assumed An2rn and so on.

Solved Examples :
1. Find the solution of recurrence relation.
a n = 5a n1 6a n2 + 7n
Soln.:
Given recurrence relation is
a n = 5a n1 6a n2 + 7n
a n 5a n1 6a n2 = 7n …(1)
For homogeneous solution
Put a n = x2, a n 1 = x and a n 2 = 1
the characteristic equation is given by
x2 5x + 6 = 0
(x 2) (x + 3) = 0
x = 2, 3
 (h) n n
an = u(2) v(3) …(2)
For particular solution
(p) n
an = A(7)
Sub in (1)
A(7)n 5A(7)n1 6A(7)
5 6
n2
= 7n
1 
A(7)n = 7n
 
 7 49 
Comparing
 5both sides  49
6
A 1   = 1,  A =
 7 49  20
49 n
 (p)
(7) …(3)
an =
20
 Adding equations (2) and (3) w.r.t. t
n n 49 n
 a = (h) (p)
u(2) v(3)  (7)
an an =
20

2. (i) a 5a 6a 3r2 (ii) a 5a 6a 3 r2 2r 1
r r1 r2 r r1 r2

Soln.:
(i) a 5a  6a 3r2 …(1)
r r1 r2
This is a linear and nonhomogeneous recurrence relation.
Its solution is given by
(H) (p)
ar = ar ar
where a r(H) is homogeneous solution and apn is particular solution.
x2 5x 6 = 0
(x + 2) (x + 3)= 0
x = 2, x = 3  arH u(2)r v(3)r (u, v are constants)
For particular solution,
the particular solution of f(n) = 3r2 is given by A 2r2 A1r A 0 where A2,A1,A0
are constants.
 apr = A 2r 2  A1r A0
2
 ar1 = A2 (r 1) A1(r 1) A0
 ar2 = A2 (r 2)2 A1(r 2) A0
 2 2 2
[A2r A1r A0 ] 5[A 2 (r 1) A1(r 1) A0 ] 6[A2 (r 1) A1(r 1) A0 ] 3r
…(from (1))
Simplifying the above equation, we get
2 2
12 A2r (34A2 12A1)r (12A0 29 A2 17A1) 3r
Comparing coefficients, we get,
1
12 A2 = 3  A =
2
17 4
12A1 34A2 = 0  A1 =
24

115
29A2 17A1 12A0 = 0  A0 =
288
 Particular solution is
1 2 17 115
anp = r
4  24 r  288

(ii) a 5 a 6a 3 r2 2r 1


r r1 r2
Here,
f(r) = 3 r2 2r 1
Its particular solution is given by
2
A 2r  A1r A0

Substituting in above equation, we get,


2 2 2
(A2r A1r A0 ) 5[A 2 (r 1) A1(r 1) A0 ] 6[A2 (r 2) A1(r 2) A0 ]
= 3r2 2r 1

 12 A 2r2 (12 A1 34 A2 )r (29 A2 17 A1 12 A0 ) = 3r2 2r 1



Comparing coefficients of ‘r’, 
1
12 A2 = 3  A2 =
4
13
12 A1 34 A2 = 2  A1 =
24
71
12 A0 17A1 29A2 = 1  A0 =
288

3. Find the solution to the recurrence relation


a n = 3an1 3an2 an3
with initial conditions a0 = 1, a1 = 2 and a2 = 1.

Soln.: 
an = 3an1 3an2 an3
 an 3an1 3an2 an3 = 0
It is a linear Homogeneous recurrence relation.
Its characteristic equation is
x3 3x2 3x 1 = 0
 (x 1)3 = 0
 x = 1, 1, 1
There are three equal roots, the homogeneous solution is given by
an(h) = (u vn wn2 )(1)n
where u, v, w are constants
 a0 = 1
 1 = (u v 0 w 0) (1)0
u = 1
 a1 = 2
2 = (u 1v 1w)(1)
1 = v+w
and  a2 = 1
1 = (u 2v 4w)(1)
2 = 2v + 4w
 1 = v + 2w
 2 = w
 w = 2
 v = 3
Solution is
an = (13n 2n2 )(1)n

4. Solve the recurrence relation


a n = 3an 1 3an2 an 3
with a0 = 5, A1 = 9, a2 = 15

Soln.:
Given recurrence relation is
an = 3a 3a a
n1 n2 n3
where a0 5, a1 9, a2 15
The characteristic equation is
x3 3x2 3x 1 = 0
 (x 1) = 0
3

x = 1, 1, 1
The homogeneous solution is
(h) 2 n
an = (u vn wn ) (1) …(1)
Putting n = 0 in (1)
5 = (u + 0 + 0) 1
u = 5

Putting n = 1 in (1),
9 = (u + v + w) (1)
9 = 5+v+w
 4 = v+w …(2)
Putting n = 2 in (1), we get,
15 = (u 2v 4w)(1)2
15 = 5 + 2v + 4w
 5 = v + 2w …(3)
 w = 1 (From (2), (3))
 v = 3
 Solution is
an = (5 3n n2 ) (1)n

5. Find the solution to the recurrence relation a n = 6 an1  11an2 + 6an3 with initial
condition
a0 = 2, a1 = 5 and a2 = 15.

Soln.:
an = 6 an1 11an2 + 6an3
where a0 = 2, a1 = 5, a 2 = 15

Recurrence relation is
Its characteristic equation is
x3 6x2 11x 6 = 0
 x x (5x2 11x 6) =
3 2
0
 x 2 (x 1) [(5x 6)(x 1)] = 0
 (x 1) (x 5x 6) =
2
0
 (x 1) (x 2) (x 3) = 0
 x = 1, 2, 3

The homogeneous solution of given recurrence relation is given in the form of


(h) n n n
an = u(1) v (2) w(3)

Putting n = 0
2 = u+v+w

Putting n = 1
5 = u + 2v + 3w

Putting n = 2
w = 2; v + 2w = 3 ; 2v + 3w = 5
15 = u + 4v + 9w
Solving the above system of linear equations, we get
u = 1
v = 1
w = 2
Solution of the recurrence relation is
n n
an = 1(2) 2 : (3)
Graded Questions :

1. What is the solution of the recurrence relation.


an 6an1 9an2
with initial conditions a0 = 1 and a1 = 6 ?
2. Find the solution of recurrence relation [M-12]
a n = 5a n1 6a n2 + 7n
3. Solve the recurrence relation
dn = 4 dn1 dn2 
Subject to the initial conditions d 0 = 1 = d1.
4. Determine whether the sequence {an} is solution of recurrence relation
an = 2an1 an2 for n = 2, 3, 4, ….. where a n = 3n for every nonnegative integer n.
Answer the same question for a n = 5.
5. Find the solution of an2 2 an1 3an 0 that satisfies a0 =1, a1 = 2.
6. Find the solution of Fibonacci relation an an1 an2 with the initial conditions
a0 = 0, a1 = 1.
7. Given that a 0 0, a1 1, a 2 4 and a 3 12 satisfy the recurrence relation
ar C1 ar1 C2 ar2 0 Determine a r .
8. Find the solution of recurrence relation : a n = 5 a n1 6a n2 + 7n [D-10, M-11]
9. Determine the sequence whose recurrence relation is a n = 4an1 + 5an2 with a1 = 2
and a2 =6. [D-11]
10. Solve the following recurrence relations :
(i) ar 7 ar1 10 ar2 0 , given that a0 0 & a1 3
(ii) ar 4 ar1 4 ar2 0 , given that a0 1 & a1 6
(iii) ar 6 ar1 9 ar2 3 , given that a0 0 & a1 1
(iv) ar ar1 ar2 0 , given that a0 0 & a1 2
(v) ar 2 ar1 2 ar2 ar3 0 given that a0 2, a1 & a2 1
11. Find the particular solution of the following :
r
(i) ar 5 ar1 6 ar2 1 (ii) ar ar1 3r 2
(iii) a 2 a 3. 2r (iv) a 4 a  4 a (r 1) 2r
r r1 r r1 r2
12. Find the homogeneous solution of the following :
(i) ar 6 ar1 12 ar2 8 ar3 = 0 (ii) 4 ar 20 ar1 17 ar2 4 ar3 = 0

Generating Functions

Definition :
Let a0 , a1 , a2 , a3 …. be a sequence of real numbers, then the function.
2 3 n
g(x) = a0 + a1 x + a2 x + a3 x + …. + a n x + ….
is the generating function for the sequence. {an}.
Generating functions for a finite sequence a 0 , a , …., a n can also be defined by letting
n1n
ai = 0 for i > n. Thus,, g (x) = a 0 + a1 x + …. + a n x is the generating function for the finite
sequence a0 , a1 , …., an
e.g. g(x) = 1 + 2x + 3x2 + …. + (n+1)xn + ….
is the generating function for positive integers.

g(x) = 1 + x + x2 + x3 + ……+xn1 is the generating function for the sequence of n ones.


xn 1
2 3 n1
g(x) = 1 + x + x + x + …. + x =
x 1
xn 1
g  x 
x 1

Equality of Generating functions :


Two generating functions are said to be equal if a n = b n for every n 0,
 
where f  x   a nxn and g  x   bnxn
n0 n0

Addition and Multiplication :


 
Let f  x   anxn and g  x   b nxn
n0 n0
be two generating functions
   n  n
Then, f  x g  x    a n bn xn and f  x  g  x   ab i ni x
 .
n0 n0 i0 

Uses :
 To solve Linear Homogenous Recurrence Relations With Constant Coefficient
(LHRRWCC).
 To solve combinatorial problems.
 Abraham De Moivre, their inventor, used them to solve the Fibonacci recurrence
relation.

Shifting Properties

1. If G  x   anxn generates (a0 , a1 , a 2 ……)


n0
then x G(x) generates (0, a 0 , a1 ……), x 2 G(x)
k
generates (0, 0, a 0 , a1 , ……), in general x G(x) generates (0, 0, ….0, a 0 , a 1 , a 2 ….)
where there are K zeros before a 0 .

2. If G  x   a nxn generates (a0 , a1 , a2 ……)
n0

then G  x a0  a nxn generates (0, a1 , a2 ……)
n1

then G(x) a0 a1x =  a n xn
n2
generates (0, 0, ……0, ak, ak+1……), where there are k

zeros before ak.


3. Dividing by powers of x shifts require to left. For instance,


 G  x a0  x anxn1 generates sequence (a1 , a2 , a3 ……); in general for k 1,


n1
k k
(G(x) a0 a1 x ……ak1 x ) / x generates (ak, ak+1 , ak+2 ).

Solved Examples :

1. Find generating function for sequence 1, a, a2 …… where a is a fixed constant.

Soln. :
Let G(x) = 1 + ax + a2x2 + a3x3 + ……
So, G(x) 1 = ax + a2x2 + a3x3 + ……
G x1
 1ax a 2x2 ......
ax
G  x 1
 G  x 
ax
 G  x  1
1ax
1
required generating function is .
1ax

2. Use generating function a n = 3an1 + 2, a0 = 1.

Soln.:

Let G(x) = 
n0
a n xn where G(x) is general function for sequence {an}.

Multiply each term by xn, and summing from 1 to ,


  

 3 a n1x 2 xn


n n
an x
n1 n1 n1
  1    
x G  x   anx  a n1x 
n 1
G(x) a 0 = 3x G(x) + 2   1 n
 1x   n0 n1 
2x
 G(x) = 3x G(x) = 1 + (a 0 = 1)
1x
1x
 G x 
1x 13x
2 1 ……by partial fractions
= 
13x 1x

  
 an xn 2  3n xn  xn
n0 n0 n0

Hence a n = 2.3n 1


3. Find formula for sequences with following first five terms.
(a) 1, 1/2, 1/4, 1/8, 1/16
(b) 1, 3, 5, 7, 9
(c) 1, 1, 1, 1, 1

Soln. :
To find formula,
1 1 1 1 1 1 1 1 1 1
(a) , , , , = , , , ,
1 2 4 8 16
20 2 2 1 2
2 3
24
 n
4
= 1
n0 2

(b) 1, 3, 5, 7, 9
This is arithmetic progression,
Here a = 1, d = 2
Now, tn = a + (n 1)d
= 1 + (n 1) 2 = 2n 1
5
tn  2n 1
n1

(c) 1, 1, 1, 1, 1


alternate positive, negative term exist,
4
t   1 .
r

r0

4. Let G(x) be generating function for sequence {aK}. What is generating function for
following sequence ?
(i) 0, 0, 0, a 3 , a4 , a5 ,………. (ii) 0, 0, 0, 0, a 4 , a5 , a6 , ……….
(iii) a4 , a 5 , a6 , ………. (iv) 0, 0, 0, a0 , a1 , a2 ,……….
(v) 0, 0, 0, 0, a0 , a 1 , a2 , ……..

Soln.:

(i) G(x) = 
n0
a n xn generates the sequence,

a0 , a 1 , a2 ,………...
G(x) a0 generates the sequence
0, a, a2 , a3 , …………
Similarly
G(x) a0 a1x a2x 2 generates the sequence,
0,0,0, a 3 , a4 , a5 ,…………

(ii) G(x)  anxn generates the sequence a0,a1,a2,...........
n 0
Same as in (i) part
G(x) a 0 a 1x a 2x2 a 3x3 generates the sequence
0, 0, 0, 0, a 4 , a5 ,a6 ,…………..

(iii) G(x)  anxn generates the sequence, a 0 , a1 , a2 , a3 ,……….
n 0
G(x) a0
generates the sequence,
x
a1,a2,a3,..............
G(x) a0 a1x
generates the sequence,
x2
a 2 ,a 3 ,a4 ,........
Similarly
G(x) a 0 a1x .......... a KxK
…(1)
xK1
gives the generating function,

G(x)  a nK1xn
n 0
and it generates the sequence
aK1,aK2,aK3,.............
putting K = 3 in (1)
G(x) a 0  a1x a 2 x 2 a 3 x 3
generates the sequence
x4
a4,a5,a6,..........


(iv) G(x)  anxn generates the sequence
n 0

a0,a1,a2,.............

 x G(x)  anxn1 generates the sequence,
n 0

0,a0,a1,a2,............

x2 G(x)  anxn2 generates the sequence,
n 0
0,0,a0,a1,a2,...........
Similarly

xK G(x)  anxnk generates the sequence,
n 0

0,0
,
...
...
....
.
.0,a 0 ,a1,a 2 ,............... …(1)
 K times
putting K = 3 in (1)

x3 G(x)  anxn3 generates the sequence
n 0

0,0,0,a0,a1,a2,...........


(v) G(x)  anxn generates the sequence
n 0
a0,a1,a2,a3 ,............

x G(x)  anxn1 generates the sequence
n 0

0,a0,a1,a2,...........
Similarly

xK G(x)  anxnK generates the sequence,
n 0

0,0
,0
,
0,...
....
...
.
.0,a 0 ,a1,a 2 ,............... …(1)
 K times

Putting K = 4 in (1)

x4 G(x)  anxn4 generates the sequence
n 0

0,0,0,0,a0 ,a1,a2,...........

Graded Questions :
1. What are the generating functions for the following sequences ?
(i) 1, 1, 1, 1, 1, 1
(ii) 1, 1, 1, 1, . . . .
2. Conjecture a simple formula for a n if the first 10 terms of the sequence {a n} are
1, 7, 25, 79, 241, 727, 2185, 6559, 19687, 59047
3. Solve the recurrence relation a n + 2  5an + 1 + 6an = 2 with initial conditions a0 = 1,
a1 = 1. [D-09]
4. Find the generating function of the following sequences [D-09]
(i) 1, 0, 1, 0, 1, 01, 0, ........
(ii) 1, 1, 1, 1, 1, ........
5. Give the exponential generating functions for the sequences given below : [M-10]
(i) {1, 1, 1, …………….}
(ii) (0, 1, 0, 1, 0, 1, 0, 1, ………………}
6. Solve the recurrence relation a n = 4 (an 1 an 2 ) where a0 = 1, a1 = 1. [D-12]
7. Find the solution to the recurrence relation : [M-13]
a n = an 1 + 2 n 2
subject to initial condition a 1 = 3





You might also like