Chapter 3
Chapter 3
Department of Mathematics
Discrete mathematics-I
CHAPTER-3: Recurrence relation
TALK OUTLINES
3.1 Definition and Examples of recurrence relation
2
INTRODUCTION
• The initial condition specify the terms that precede the first term where
the recurrence relation takes effect.
3.1 RECURRENCE RELATION
Example 3.1
Let {an} be a sequence that satisfies the recurrence relation
an = an-1 – an-2 for n = 2, 3,4, and suppose that a0 =3 and a1 = 5.
a0 = 3
a1 = 5
a2 = a1 – a0 = ___________________
a3 = __________________________
What is a5?
a5 = __________________________
3.1 RECURRENCE RELATION
Example 3.2
Determine whether {an} where an = 3n for every nonnegative
integer n, is a solution of recurrence relation an = 2an-1 – an-2
for n = 2, 3, 4, …
Suppose that an = 3n for every nonnegative integer n,
Then for n ≥ 2;
2an-1 – an-2 = ___________________
Therefore,
1
B a0 128, an an 1 for n 1
4
C b1 5, bn 7 2bn1 for n 2
RULES OF PUZZLE:
Let Hn :
n disks the numbers of
moves with n disks
A B C
Initial Position in the Tower of Hanoi
A B C Hn-1 moves
Intermediate Position in the Tower of Hanoi
3.2 MODELING WITH RECURRENCE
Example 3.5: Tower of Hanoi
ILLUSTRATION: SOLUTION
A B C
Intermediate Position in the Tower of Hanoi
n disks
transfer the top of
n-1 disks to peg B
A B C Hn-1 moves
Last Position in the Tower of Hanoi
3.2 RECURRENCE RELATION
Example 3.5: Tower of Hanoi
Solution (continue):
H n 2H n1 1 ; H1 1
Where:
transfer the top of Moves the largest transfer the top of
n-1 disks to peg B disk to peg C n-1 disks to peg C
Thus;
Sn 2Sn1 ; S0 1
Solution: (FORWARD) Solution: (BACKWARD)
S0 1 Sn 2 Sn 1
S1 2S0
22 Sn 2
S2 2S1 2 2 S0 22 S0
23 S n 3
S 3 2 S 2 2 2 2 S 0 23 S 0
2n S0 2n
Sn 2Sn 1 2 2n 1 S0 2n S0 2n ; n 1
3.3 SOLVING RECURRENCE RELATION
Example 3.3.2: Compound interest
Suppose that a person deposits Birr10,000 in a savings account
at a CBE yielding 11% per year with interest compounded
annually. How much will be in the account after 30 years?
Solution:
a3 1.11 a2 1.11 a0
3
=Birr 228,923
Example 3.3: Tower of Hanoi
The number of moves is given by:
PROVE BY
H n 2H n1 1 ; H1 1 INDUCTION !
By iterative approach:
H n 2 H n 1 1
2 2 H n 2 1 1 22 H n 2 2 1
22 2 H n 3 1 2 1 23 H n 3 22 2 1
2n 1 H1 2n 2 2n 3 2 1
2n 1 2n 2 2n 3 2 1
2n 1
3.3 SOLVING RECURRENCE RELATION
EXERCISE 3.3.1
1. Using iterative method, predict a solution to each of the
following recurrence relation. Verify the solutions using
induction
• an an1 4n ; a0 0 ; n 1
• bn bn 1 n 2 ; a1 1 ; n 2
Linear : The RHS is the sum of previous terms of the sequence each
multiplied by a function of n.
Homogeneous : No terms occur that are not multiplies of the aj s.
Degree k : an is expressed in terms of the previous k terms of the sequence
Constant coefficients : c1, c2,…, ck
Recurrence relation : with k initial condition
a0 = C0, a1 = C1, … ak-1= Ck-1
3.3 SOLVING RECURRENCE RELATION
Example 3.3.4: Linear Homogeneous RR
Linear Homogeneous Recurrence Relation
Hn = 2Hn-1 + 1
Bn = nBn-1
an = an-1 + a²n-2
3.3 SOLVING RECURRENCE RELATION
Solving Linear Homogeneous Recurrence
Relations with constant coefficients
• OUR AIM – look for the solutions of the form an r n , where r
is constant.
an 5to
3) Thus the solution 2nthe
3recurrence
n
,n0 relation and initial
conditions is .
3.3 SOLVING RECURRENCE RELATION
Example 3.3.6: Higher-Order LHRRWCCs
Solve the recurrence relation an = 6an-1 - 11an-2 + 6an-3 where
a0 = 2, a1 =5, and a2 = 15.
Solution:
1) Find the general solution of the recurrence relation
• the characteristic equation is given by r 3 6r 2 11r 6 0
• the characteristic roots are 1, 2 and 3
• thus, the general solution is an A 1 B 2 C 3
n n n
Solution:
• an an1 2an2 ; a0 2, a1 7
• an 6an1 9an2 ; a0 1, a1 3
Let
an h be the general solution of c1an-1 + c2an-2 + … + ckan-k
And
an p be the particular solution of LNHRRWCCs,
an = c1an-1 + c2an-2 + … + ckan-k + F (n)
an an h an p
• an 5an 1 6an 2 8n 2 ; a0 4, a1 7
• an 5an 1 6an 2 7 n ; a0 4, a1 7