UNIT2
UNIT2
1. Sequence
2. Recurrence Relation
3. Linear and Non-linear Recurrence Relation
4. Homogeneous and Non-homogeneous
Recurrence Relation
5. Solutions of Recurrence Relations
6. Generating Functions
Sequence: Any function which has the domain
natural number N that is called Sequence, that is
a: N →X.
The image of any element n in N is denoted by an
Recurrence Relation: Recurrence relation is the
relation between the sequence and its some
previous or some next terms.
Example 1: an = an-1 + 2an-3
Example 2: Fibonacci Numbers are defined by
an = an-1 + an-2 such that a0=0, a1,=1, n≥2.
Example 2: Recurrence Relation of Rabbit production is given by
an = an-1 + an-2 such that a1=1 = a2, n≥3.
Example 3: The puzzle Tower of Hanoi can be represented
in terms of recurrence relation: Hn =2 Hn-1+1, H1=1.
The solution of Hanoi tower is given by Hn =2n -1.
Linear Recurrence relation
A linear homogeneous recurrence relation of degree k with
constant coefficient is of the form
an = c1 an-1+ c2 an-2 +… ck an-k
Where c1, c2, … ck are real constants and ck ≠0.
A linear non-homogeneous recurrence relation of
degree k with constant coefficient is of the form
an = c1 an-1+ c2 an-2 +… ck an-k + F(n)
Where c1, c2, … ck are real constants with ck ≠0.
and F(n) denotes the function of variable n.
The degree in both cases= {Greatest value –Lowest value}=n-(n-k)=k
Note: Some times it is also taken as order by different
authors.
Examples
1. The degree of an =2 an-1 is 1.
2. The degree of an = an-3 is 3.
3. an =2 an-2 + n2 is non-homogeneous relation.
4. an =2 an-1 +1 is non-homogeneous relation.
5. an =2 (an-1)2 non-linear but homogeneous
relation.
6. an =2 (an-1)2+1 non-linear and non-
homogeneous relation.
Solution of Recurrence Relation
Any sequence an that satisfy the given recurrence
relation, is called solution of recurrence relation.
For solving the recurrence relation we put
an =rn and find the new equation called as characteristic
equation of the linear recurrence relation and given by
rk-ck-1 rk-1-…..-ck=0.
After solving above characteristics equation we get
the characteristics roots and with the help of
characteristics roots we can write the solution of
recurrence relation by using differential equation
methods.
Methods to write the solutions
1. Let r1 and r2 be two roots and r1 ≠ r2 then
solution of recurrence relation is given by
an=b1(r1)n+b2(r2)n,
b1 and b2 are arbitrary constants.
2. If roots are repeated r1= r2=r then solution is
an=(b1+b2n)(r)n
b1 and b2 are arbitrary constants.
Question: Solve the recurrence relation
an =-3 an-1 -3 an-2 – an-3 , a0 =1, a1 =-2, a2 =-1.
Solution: Let the recurrence relation is
an =-3 an-1 -3 an-2 – an-3
Putting an =rn we get
rn =-3 rn-1 -3 rn-2 – rn-3
Which implies by dividing rn-3
r3+3 r2+3r+1=0
Or we get (r+1)3 =0
Which gives the roots r=-1, r=-1, r=-1
Solution Continued…
Now the solution of recurrence relation is given by
an =(c1 + c2 n+ c3 n2)(-1)n …………………………………..(1)
where c1, c2 and c3 are arbitrary constants.
ck E k ( an ) ck 1 E k 1 ( an ) ck 2 E k 2 ( an ) .... c1 E ( an ) c0 ( an ) H ( n)
(ck E k ck 1 E k 1 ck 2 E k 2 .... c1 E c0 ) an H ( n)
f ( E ) an H ( n)
Continued…
1 1 1 1
(eia ) n (e ia ) n
2i f ( E ) 2i f ( E )
a
Question: Find the PI for an+2-6an+1+5an=2n
by using the method of inverse operator.
Solution: Since the given recurrence relation can
be written in terms of shift operator
2 2 n
E (an ) 6 E (an ) 5an ( E 6 E 5)an 2
Now, F ( E ) E 2 6 E 5, H ( n) 2 n
Hence 1 n 1 n 1 n
PI (2 ) 2 (2 ) 2
f (E) ( E 6 E 5) 3
Question: Find the PI: F(E)=(E-4)3 and H(n)=4n
Solution: F ( E ) ( E 4) 3 , H (n) 4 n
1 1 n(n 1)(n 2) n 3
PI (4n ) 3
( 4 n
) (4 )
f (E) ( E 4) 3!
1 1 1 1
2 ( E 2 4)
e 3in
2 ( E 2 4)
e
3in
1 1 1 1
2 ( E 2 4)
e 3i n
2 ( E 2 4)
e
3i n
Continued…
1 1 1 1
We get 6i
2 (e 4)
e
3i n
6i
2 (e 4)
e
3i n
1 1 1 1
2 ( e 6 i 4)
e 3in
2 ( e 6 i 4)
e3in
Question: Find the PI: F ( E ) ( E 4), H (n) 3n n 2
1 n 2 1 n 2 n 1
PI 3 n 3 n 3 n2
f (E) ( E 4) (3E 4)
Replacing E 1 ∆
1
PI 3n n2
(3E 4)
Continued…
We get 3n (3(1+ ∆)+4)-1 ( n2 )=3n (3∆+7)-1 ( n2 )
1 n
= 7 3 (1+ 73 ∆)-1 ( n2 )
= 7 3n (1- ∆+ ∆2 - ∆3 +…) ( n2 )
1 3
7
3
7
3
7
= 1 n 2 3 3
3 n 2n 2 0 0.....
7 7 7
1 n 2 6n 6
3 n
7 7 7
1
49
3n 7 n 2 6 n 6
Rough Work
Solution:
Generating Functions
Let an be a sequence then generating function of an is a
power series whose coefficients are an. The
generating function of an is defined by
G ( x) k
a
k 0
x k
1
(1 bx ) 1
1 bx
ak x , g ( x )
k
k
b x k
k 0 k 0
k k
(ii ) f ( x ) g ( x ) a j bk j
x
k 0 j 0
1
Question: Let h( x ) then find
(1 x) 2
the
Then f ( x) g ( x) 1 x x 2 x 3 ....
and we get ak bk 1
Therefore f ( x) g ( x) 1 1
1
(1 x ) (1 x) (1 x) 2
k
k
ak bk j
x
k 0 j 0
k k
1x
( k 1)x k
k 0 j 0 k 0
Question: Solve the recurrence relation by using
generating function ak=3ak-1 such that a0=2
a
k 1
k
k x k
3a
k 1
k 1 x
Solution Continued…
Or we can write
a0 ak x k a0 3ak 1 x k
k 1 k 1
Which implies G ( x) a0 3ak 1 x k
Or
k 1
G ( x ) 2 3 x ak 1 x k 1
k 1
G ( x ) 2 3 x ak x k G ( x) 2 3 xG ( x )
k 0 or
Solution Continued….
We get
2
G ( x) 2(1 3 x) 1 2 (3 x) k 2.3k x k
(1 3 x) k 0 k 0
Or we get ak 2.3k
Which is the solution of recurrence relation.
Question: Using generating function solve the recurrence
relation ak=3ak-1 +2, k=1, 2, 3…….., and a0=1.
ak 3ak 1 2
Since
ak x k 3ak 1 x k 2 x k
Or
or
a x
k 1
k
k
3ak 1 x 2 x
k 1
k
k 1
k
Solution continued…
. ( x ) 1 3 x ak 1 x 2x
k 1 k
G
k 1 k 1
2x
G ( x ) 1 3 xG ( x )
1 x
2x 1 x
G ( x )(1 3 x ) 1
1 x 1 x
(1 x) 1 2
G ( x)
(1 x)(1 3 x) (1 x ) (1 3 x)
G ( x) 1 x 2 3 x
k k k
k 0 k 0
Solution continued…
G ( x ) ( 1) x 2.3 x k k k
k 0 k 0
G ( x) (1 2.3
k 0
k
)x k
k
ak ( 1 2.3 )
This is the solution of recurrence relation.
Question: Using generating function solve
the recurrence relation ak=5ak-1 -6ak-2 such
that a0=6, a1=30.
Solution: Let the generating function is given by
G ( x)
k 0
ak x k
a
k 2
k x 5 ak 1 x 6 ak 2 x
k
k 2
k
k 2
k
G ( x) a0 a1 x 5 x ak 1 x k 1
6x 2
a k 2 x k 2
k 2 k 2
G ( x) 6 30 x 5 x ak x 6 x k 2
a x k
k
k 1 k 0
Solution continued…
Or
G ( x ) 6 30 x 5 xG ( x ) 6 6 x G ( x )
2
6 12 18
G ( x)
(1 2 x )(1 3 x ) (1 2 x ) (1 3 x )
G ( x ) 12 2 x k k
18 3 x k k
k 0 k 0
G ( x) (12.2
k 0
k k
18.3 ) x k