Professional Documents
Culture Documents
Recurrence Relations: Mathematical Models, Analysis Techniques
Recurrence Relations: Mathematical Models, Analysis Techniques
8
MATHEMATICAL MODELS, ANALYSIS TECHNIQUES
What is Recursion?
• Some times problems are too difficult or too
complex to solve because these are too big.
• A problem can be broken down into sub-
problems and find a way to solve these sub-
problems
• Then build up to a solution to the entire
problem.
• This is the idea behind recursion
• Recursive algorithms break down problem in
pieces which you either already know the
answer, or can be solved applying same
algorithm to each piece
• And finally combine the results of these sub-
problems to find the final solution
What is Recursion?
Example
• Finding factorial of a number is an easiest
example one can think using recursion
Recursive Mathematical Model
• Since n! can be computed as: 5! = 5*4*3*2*1.
• If we have a close look at this, we notice that
5! = 5*4!. 5! = 5*4*3*2*1 = 5*4! = 5*4*3! = 5*4*3*2!
F (n) = 5! = n.F (n − 1) = n.(n − 1).F (n − 2) = n.(n − 1).(n − 2).F (n − 3)
• Now if denote F(n) = n! then it can be written as
0! = 1
F(n) = n.F(n-1) F (0) = 1
ak = 2.ak −2 No
b k = 5bk −1 YES
1
ck = k ck −1 No
2
ak = ak −1 ak −1
No
Solving First Order Recurrences
Solve the recurrence: b k = a.bk −1 if b0 = c
Solution:
bk = a.bk-1
bk = a.(a. bk-2) = a2. bk-2
bk = a2.(a. bk-3) = a3. bk-3
...
bk = ak. bk-k = ak. b0
bk = ak.c
Now the explicit formula is c.ak which is a geometric
sequence.
Hence first order recurrence is nothing but G.S.
Solving First Order Recurrences
Example
Solve the recurrence: b k = 5bk −1 if b0 = 3
Solution
bk = 5.bk-1
bk = 5.(5. bk-2) = 52. bk-2
bk = 52.(5. bk-3) = 53. bk-3
...
bk = 5k. bk-k = 5k. b0 = 5k.3
Now the solution sequence becomes
3.50, 3.51, 3.52, 3.53, 3.54, . . , 3.5k, . . .
3, 15, 75, 375, . . .geometric sequence
SECOND ORDER LINEAR HOMOGENOUS
RECURRENCE RELATIONS WITH CONSTANT
COEFFICIENTS
Definition and Examples of SOLHRRCC
Definition
ak = A ak −1 + B ak −2 k 2
where A and B are real numbers with B 0
b k = bk −1 + bk −2 + bk −3 NO
1 3
c k = ck −1 − ck −2
2 7 YES
Some More Examples
dk = d 2
k −1 + d k −1 d k − 2 NO
e k = 2ek −2 YES
f k= 2 f k −1 + 1 NO
g k = g k −1 + g k -2 YES
h k = (−1)hk −1 + (k − 1)hk −2 NO
Theorem
Theorem: Let A and B are real numbers. A recurrence of the form
ak = Aa k −1 + Ba k −2
is satisfied by the sequence
1, t , t ,....t ,....t 0
2 n
(t − 2)(t + 1) = 0 t = 2,−1
Hence
0 2 3 n
2 ,2,2 ,2 ,...,2 ,... and
(− 1) , (− 1) , (− 1) , (− 1) ,...
0 1 2 3
Theorem
Let A and B be real numbers, and suppose that the
characteristic equation
t − At − B = 0
2
2 n 2 3 n
1, r , r ,..., r and 0, r ,2r ,3r ,..., nr ...
Both satisfy the recurrence relation
ak = Aa k −1 + Ba k −2
Repeated Roots
Proof
if t 2 − At − B = 0
has a single repeated root ‘r’ than
t − At − B = ( t − r )
2 2
t 2 − At − B = t 2 − 2rt + r 2
A = 2r and B = −r 2
We know that rn is a solution. Now we prove that S n = nr n
is also a solution, i.e.
k −1 k −2
= 2r (k − 1) r − r (k − 2) r
2
= 2(k − 1) r − (k − 2)r
k k
= (2k − 2 − k + 2)r k
= k.r = RHS,
k
hence proved
Repeated Roots
Example 1: Single root case
Suppose sequence, b0, b1, b2,. . . satisfies recurrence relation
bk = 4bk −1 − 4bk −2 k 2
with initial condition : b 0 = 1 and b1 = 3
then find the explicit formula for b0, b1, b2, . . .
For n = 1, b1 = C 21 + D 1 21
3− 2 1
2C + 2 D = 3 2 1 + 2 D = 3 D = =
2 2
1 n n
Hence, bn = 1 2 + n 2 = 2 1 +
n n
2 2
n n
= 1 + 2 is the required solution for repeated roots.
2
Checking Explicit Formula
bn = (1 + n/2).2n
First term
b0 = (1 + 0/2).20 = 1.1 = 1
Second term
b1 = (1 + 1/2).21 = 3/2.2 = 3
Third term
b2 = (1 + 2/2).22 = 2.4 = 8
Fourth term
b3 = (1 + 3/2).23 = 5/2.8 = 20, and so on
Theorem (Linear Combination is also a Solution)
Theorem: if r0 , r1 , r2 ,... and s0 , s1 , s2 ,...
are sequences that satisfy the some second order linear
homogeneous recurrence relation with constant
coefficients, and if C and D are any numbers then the
sequence
a0 , a1 , a2 ,...defined by the formula
an = Crn + Dsn n 0
also satisfies the same recurrence relation
Consider R. H. S
Aak −1 + Bak − 2 = A ( C rk −1 + D sk −1 ) + B ( Crk − 2 + Dsk − 2 )
= C ( Ark −1 + Brk −2 ) + D( As k −1 + Bs k −2 )
= C (rk ) + D( sk ) = a k
ak = Aa k −1 + Ba k −2
It proves that an = Crn + Dsn satisfies same recurrence
Solution as Linear Combination
t 2 − At − B = 0
Example 1: ak = ak −1 + 2 ak − 2
t2 − t − 2 = 0
Find a sequence that satisfies the recurrence relation
t 2 − At − B = 0
ak = ak −1 + 2 ak −2 k 2
t 2 − t − 2 = 0 (t − 2)(t + 1) = 0
t = −1,2
Contd..
rn = 2 0 ,21 ,2 2 ,... and sn = (− 1) , (− 1) , (− 1) ,...
0 1 2
Are both sequence which satisfy above relation but neither one is having
a0 = 1 and a1 = 8
Now since an = Crn + Dsn also satisfies the same recurrence relation and
an = 3 ( 2 )
n
an = 3 (2 ) − 2(− 1)
n n
Now an = Crn + Dsn
is the required sequence which satisfies the given conditions
General Homogenous Recurrence
Relations
(Constant Coefficients)
K order: General Homogenous Recurrence
• First order: linear combination of two cons.
terms,
• Second order: linear combination of three
consecutive terms,
• We extend technique of recurrence equation
with resolution of homogeneous linear
recurrence with constant coefficient, that is
recurrence of the form
a0 tn + a1 tn-1 +a2tn-2 …..+ak tn-k =
0 (1)
where ti are value we are looking for
• In equation (1), values of ti such that (1 < i < k)
are need to determine a sequence.
• Equation 1 typically has infinite many solutions,
because linear combination is also a solution.
K = 1: General Homogenous Recurrence
a0 tn + a1 tn-1 + …..+ak tn-k = 0
(1)
If we put k = 1 then above equation
becomes
a0 tn + a1 tn-1 = 0
tn = -(a1 / a0 )tn-1
• The resultant equation becomes a recurrence
relation which is
– first order
– linear
– homogenous
– with constant coefficients.
K = 2: General Homogenous Recurrence
a0 tn + a1 tn-1 + …..+ak tn-k = 0
(1)
If we put k = 2 then above equation
becomes
a0 tn + a1 tn-1 + a2 tn-2 = 0
tn = -(a1 / a0 )tn-1 - (a2/ a0 )tn-2 = c1tn-1 + c0
tn-2
• This time we have a recurrence relation which is
– second order
– linear
– homogenous
– with constant coefficients.
K = 3: General Homogenous Recurrence
a0 tn + a1 tn-1 + …..+ak tn-k = 0
(1)
If we put k = 3 then above equation
becomes
a0 tn + a1 tn-1 + a2 tn-2 + a3 tn-3 = 0
tn = -(a1 / a0 )tn-1 - (a2/ a0 )tn-2 - (a3/ a0 )tn-3
fn - fn-1 - fn-2 = 0
The Fibonacci sequence corresponds to a second
homogeneous linear recurrence relation with constant
coefficient, where
k = 2,
a0 =1,
a1 = -1
a2 = -1
Before we even start to look for solutions to Equation 1, it
would be interesting to note that any linear combination of
solutions is itself a solution.
Theorem
Statement: Prove that any linear combination of solutions of
equation given below is also a solution.
a0 tn + a1 tn-1 + …..+ak tn-k = 0
Proof: Assume that fn and gn are solutions of above
equation and hence satisfy it, i.e.
k k
a f
i =0
i n −i = 0 and ai g n −i = 0
i =0
Note :
It is to be noted that this rule can be generalized to linear
combinations of any number of solutions.
More Generalized Results
Statement:
If fn, gn and hn are solutions to recurrence below then their
linear combination is also a solution a0 tn + a1 tn-1
+ …..+ak tn-k = 0
Proof: As fn , gn and hn are solutions of above, hence
k k k
a f
i =0
i n −i = 0, a g
i =0
i n −i = 0, and ai hn −i = 0
i =0
Why recurrence?
Type of recurrences
Techniques solving recurrences
Generalized form of recurrence
Linear combination of solutions itself solution
Reusability of models when initial conditions are
changed but pattern remains same
It empowers the recursive models to be used in more
general phenomena
Easy implementation