Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
3 views41 pages

DM RecurrenceRelations New

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views41 pages

DM RecurrenceRelations New

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 41

BIT108 Discrete Mathematics

School of Information and


Communication Technology

Recurrence Relations

Lecturer : Mr Kok Chye Hock


([email protected])
Readings
 Johnsonbaugh
 Chapter 7: Recurrence Relations
7.1 Introduction
7.2 Solving Recurrence Relations
Definition
 A recurrence relation for the sequence a0, a1, …
is an equation that relates an to its
predecessors a0, a1, ……an-1. In order for
recurrence relation to define a sequence, a
“start-up” value or values must be given. These
start-up values are called initial conditions.
Examples
Example 1:
a0 , a1 , a2 , a3 , a4 , …
Sequence: 2, 6, 18, 54, 162, …
Recurrence relation: an = 3an-1 n  1
Initial Conditions: a0 = 2

Example 2:
a1 , a2 , a3 , a4 , a5 , …
Sequence: 2, 6, 18, 54, 162, …
Recurrence relation: an = 3an-1 n  2
Initial Conditions: a1 = 2
Examples
Example 3:
a1 , a2 , a3 , a4 , a5 , …
Sequence: 5, 8, 11, 14, 17, …
Recurrence relation: an = an-1 + 3 n  2
Initial Conditions: a1 = 5

Example 4:
f1, f2, f3, f4, f5, …
Sequence: 1, 2, 3, 5, 8, …
Recurrence relation: fn = fn-1 + fn-2 n 3
Initial Conditions: f1 = 1
f2 = 2
Recurrence Relations?
1. an = an-1 + 4 11. fn = (fn-1)2
2. an = 2•3n-1 12. fn = (fn-1)2 + 2
3. an = 5•2n-1 + 3•2n-2 13. fn = 2fn-1
4. an = 3an-1 + 4nan-2 14. fn = fn-3 + 2fn-2
5. an = 3an-1 15. fn = 2fn-1 + n
6. an = 3an-1 + 5 16. fn = 2nfn-1
7. xn = 2xn-1 – 3xn-2 17. fn = 4fn-4 + 8fn-3
8. xn = 3xn-1 + 7xn-2 18. an = an-1 + 2an-2
9. xn = 7xn-1 – 6xn-2 19. an = 3(-1)n + 5(2)n
10. xn = xn-4 20. an = 3an-1 – 2an-2
Linear Homogeneous Recurrence Relations with
Constant Coefficients
A linear homogeneous recurrence relations of degree k with
constant coefficients is a recurrence relation of the form:
an = c1an-1 + c2an-2 + c3an-3 + … + ckan-k
where c1, c2, c3, c4, …ck are real numbers
Examples
 The followings are examples of linear homogenous
recurrence relation with constant coefficients
pn = (1.11)pn-1 (degree one)
fn = fn-1 + fn-2 (degree two)
 The followings are examples of NOT being linear
homogenous recurrence relation with constant
coefficients
an = an-1 + (an-2)2 : not linear – quadratic recurrence
relation
hn = 2hn-1 + 1 : contains non-homogenous term
Bn = nBn-1 : coefficient is not constant
Linear Homogeneous Recurrence Relations with
Constant Coefficients
1. an = an-1 + 4 11. fn = (fn-1)2
2. 12. fn = (fn-1)2 + 2
3. 13.
4. an = 3an-1 + 4nan-2 14. fn = fn-3 + 2fn-2
5. an = 3an-1 15. fn = 2fn-1 + n
6. an = 3an-1 + 5 16. fn = 2nfn-1
7. xn = 2xn-1 – 3xn-2 17. fn = 4fn-4 + 8fn-3
8. 18. an = an-1 + 2an-2
9. xn = 7xn-1 – 6xn-2 19.
10. xn = 5xn-4 20. an = 3an-1 – 2an-2
Linear Homogeneous Recurrence Relations with
Constant Coefficients: Answer
1. an = an-1 + 4 11. fn = (fn-1)2
2. 12. fn = (fn-1)2 + 2
3. 13.
4. an = 3an-1 + 4nan-2 14. fn = fn-3 + 2fn-2
5. an = 3an-1 15. fn = 2fn-1 + n
6. an = 3an-1 + 5 16. fn = 2nfn-1
7. xn = 2xn-1 – 3xn-2 17. fn = 4fn-4 + 8fn-3
8. 18. an = an-1 + 2an-2
9. xn = 7xn-1 – 6xn-2 19.
10. xn = 5xn-4 20. an = 3an-1 – 2an-2
Solving Recurrence Relations
To solve a recurrence relation involving the sequence a0, a1,
a2, . . . is to find an explicit formula for the general term an.
Solving Recurrence Relation
Example 1:
a0 , a1 , a2 , a3 , a4 , …
Sequence: 2, 6, 18, 54, 162, …
Recurrence relation: an = 3an-1 n  1
Initial Conditions: a0 = 2

an = 3an-1
= 3(3an-2) = 3kan-k
= 32an-2 :

= 32(3an-3) = 3nan-n (Let k = n, to get the last term)


= 33an-3 = 3na0
: = 2(3n) n0
Solving Recurrence Relation
Example 1:
a0 , a1 , a2 , a3 , a4 , …
Sequence: 2, 6, 18, 54, 162, …
Recurrence relation: an = 3an-1 n  1
Initial Conditions: a0 = 2
Let an = rn, an-1 = rn-1, an = A(r)n
an = 3an-1 an = A(3)n
rn = 3(rn-1) Using initial condition, a0 = 2.
Divide both side by rn -1 a0 = A(3)0 = 2
rn = 3(rn-1)  A=2
rn-1 rn-1
r1 = 3 an = 2(3n) n0
Solving Recurrence Relation
Example 2:
a1 , a2 , a3 , a4 , a5 , …
Sequence: 2, 6, 18, 54, 162, …
Recurrence relation: an = 3an-1 n  2
Initial Conditions: a1 = 2

an = 3an-1
= 3(3an-2) = 3kan-k
= 32an-2 :

= 32(3an-3) = 3n-1an-(n-1) (Let k = n-1, to get the last term)


= 33an-3 = 3n-1a1
: = 2(3n-1) n1
Solving Recurrence Relation
Example 2:
a1 , a2 , a3 , a4 , a5 , …
Sequence: 2, 6, 18, 54, 162, …
Recurrence relation: an = 3an-1 n  2
Initial Conditions: a1 = 2
Let an = rn, an-1 = rn-1, an = A(r)n
an = 3an-1 an = A(3)n
rn = 3(rn-1) Using initial condition, a1 = 2.
Divide both side by rn -1 a1 = A(3)1 = 2
rn = 3(rn-1)  A=
rn-1 rn-1 an = (3n)
r1 = 3 an = 2(3n-1) n1
Solving Linear Homogeneous Recurrence Relations with
Constant Coefficients (Degree 2)

Theorem 1:
Let c1 and c2 be real numbers. Suppose
r2 – c1r – c2 = 0 has 2 distinct roots r1 and r2
then the solution is
an = A(r1)n + B(r2)n
where A and B are constants.
Example
Find the solution of the recurrence relation
an = an-1 + 2an-2 with a0 = 2 and a1 = 7, n ≥ 2
Solution:
Step 1:
Substitute rn = an, rn-1 = an-1, rn-2 = an-2 in
an = an-1+2an-2
rn = rn-1 + 2rn-2
 rn – rn-1 – 2rn-2 = 0
Example (cont’d)
Step 2:
Divide by rn-2 and solve for r.
 r2 – r – 2 = 0
(r +1)(r-2)=0
r = -1, r = 2
Step 3:
Using the formula an = A(r1)n + B(r2)n
 an = A (-1)n + B (2)n
Example (cont’d)
Step 4:
Find A and B with the given initial conditions
a0 = 2 and a1 = 7:
a0 = 2= A(-1)0 + B(2)0
2 = A+B
a1 = 7 = A(-1)1 + B(2)1
7 = -A + 2B
 A = -1, B=3
Final Answer : an = (-1) (-1)n + (3)(2)n
= (-1)n+1 + (3)(2)n
,n ≥ 0
Theorem 2:
Let c1 and c2 be real numbers.
Suppose r2 – c1r – c2 = 0 has only one root r,
then the solution is
an = A(r)n + Bn(r)n
where A and B are constants
Example
Find the solution of the recurrence relation
xn – 6xn-1 + 9xn-2 = 0 with x0 =1 and x1 = -9, n ≥ 2.
Solution:
Step 1:
Substitute rn = xn, rn-1 = xn-1, rn-2 = xn-2 in
xn – 6xn-1 + 9xn-2 = 0
 rn – 6rn-1 + 9rn-2 = 0
Example (cont’d)
Step 2:
Divide by rn-2 and solve for r.
 r2 – 6r + 9 = 0
(r – 3)(r – 3) = 0
r=3
Step 3:
Using the formula an = A(r)n + Bn(r)n
 an = A(3)n + Bn(3)n
Example (cont’d)
Step 4:
Find A and B with the given initial conditions
x0 = 1 and x1 = -9:
x0 = 1 = A(3)0 + B(0)(3)0
1=A
a1 = -9 = 1(3)1 + B(1)(3)1
-9 = 3 + 3B
 A= 1, B = -4
Final Answer : an = (1)(3)n + (-4)n(3)n

= (3)n – 4n(3)n ,n
≥0
Linear Non Homogeneous Recurrence Relations
with Constant Coefficients

A linear non homogeneous recurrence relations of degree k


with constant coefficients is a recurrence relation of the form:
an = c1an-1 + c2an-2 + c3an-3 + … + ckan-k + F(n)
where c1, c2, c3, c4, …ck are real numbers and F(n) is a function
not identically zero depending only on n.
Examples:
an = an-1 + 2n
an = 5an-2 + 7
an = 3an-1 + n3n
Solving Linear Non Homogeneous Recurrence Relations with Constant
Coefficients

Theorem 3:
If the recurrence relation is
an = c1an-1 + c2an-2 + c3an-3 + ………….ckan-k + F(n)
then the solution is
an(p) + an(h) where
an(p) - is the solution for the non-homogeneous (F(n))
an(h) - is the solution for the homogeneous

In this course we will look into two different types of F(n), namely
(a)polynomial in n of degree one; (b) constant value
Linear Non Homogeneous Recurrence
Relations
Given the recurrence relation:
an = c1an-1 + c2an-2 + c3an-3 + ………….ckan-k + F(n)

a) Polynomial in n of degree one


If F(n) = xn + y where x and y are real numbers
then the solution is an+d
b) Constant value
If F(n) = b where b is a real number then the
solution is a constant C
Case (a)
Find all the solution of the recurrence relation of
an = 3an-1 + 2n with n  2,
and the initial condition a1 = 3

1.Find an(h)
an = 3an-1
Substitute rn = an, rn-1 = an-1 in an = 3an-1
 rn – 3rn-1 =0
Divide by rn-1
r–3=0
r=3
an(h) = A(3)n
Case (a)
2. Find an(p)
F(n) = 2n which is polynomial in n of
degree one
Solution is to use cn+d (linear function)
an(p) = cn + d --------------- (1)
an-1(p) = c(n-1) + d --------------- (2)
Substitute (1) and (2) in an = 3an-1 + 2n
 cn + d = 3[c(n-1) + d] + 2n
cn + d = 3c(n-1) + 3d + 2n
cn + d = 3cn – 3c + 3d + 2n
cn + d = (3c + 2)n – 3c + 3d
Case (a)
Comparing coefficient of n and the constant
on both sides, we obtained:
c = 3c + 2 d = -3c + 3d
-2c = 2 -2d = -3c
c = -1 -2d = -3(-1)
-2d = 3
d = -3/2
an(p) = -n + (-3/2)
3 3
Thus an = A(3) + -n
n
+ 2= A(3) – n –
n
2
Case (a)

3 3
Thus an = A(3) + -n +
n 
2
= A(3) – n –
n
2

3. Find A with the given initial conditions a1 =


3
3 2
3

11
a n = A(3) n
– n – 2

6a1 = 3 = A(3)(1) – 1 –
11 3
A= 6 2

Final Answer : an = (3)n – n – ,n1


Case (b)
Find all the solutions for an = 5an-1 + 7 with n  1
and the initial condition a0 = 1

1. Find an(h)
an = 5an-1 --------------------- (1)
Substitute rn = an, rn-1 = an-1 in (1)
 rn – 5rn-1 =0
Divide by rn-1
r–5=0
r=5
an(h) = A(5)n
Case (b)
2. Find an(p)
F(n) = 7
Solution is to use C
an(p) = C --------------- (1)
an-1(p) = C --------------- (2)
Substitute (1) and (2) in an = 5an-1 + 7
C = 5C + 7
7 -4C =7

4C =
7
an(p)4 = 7 7

Thus an = A(5) + ( 4) = A(5)n –
n 4
Case (b)
7 7
Thus an = A(5) +n
( 4) = A(5) –
n
4

3. Find A with the given initial conditions a0=1


7
an = A(5)n4–
7
a0 = 11
1= A(5)0 4–
 A =4 7
11
Final Answer: an = 4 (5)n – 4 ,n0
Application
Jill is saving for her retirement. In the month of
January every year she deposits RM500 in a
superannuation fund. If the fund grows at the
rate of 10% per annum, how much will Jill have
in the month of December of the 30th year.
Solution:
(Let the amount be denoted in terms RM1000)
a1 = 0.5
a2 = 1.1a1 + 0.5
a3 = 1.1a2 + 0.5
:
:
an = 1.1an-1+ 0.5
Application (cont’d)
1. Find the recurrence relation.
an = 1.1an-1+ 0.5

2. Find an(h)
an (h) = 1.1an-1 ----- (1)
Substitute rn = an, rn-1 = an-1 in (1)
 rn – 1.1rn-1 =0
Divide by rn-1
 r – 1.1 = 0
r = 1.1
an(h) = A(1.1)n
Application (cont’d)
3. Find an(p)
F(n) = 0.5
Solution is to use C
an(p) = C --------------- (1)
an-1(p) = C --------------- (2)
Substitute (1) and (2) in an = 1.1an-1 + 0.5
C = 1.1C + 0.5
-0.1C = 0.5
C = -5
an(p) = -5
Application (cont’d)

Thus an = an(h) + an(p) = A(1.1)n - 5


4. Find A with the given initial conditions
a1 = 0.5
an = A(1.1)n - 5
a1 = 0.5 = A(1.1)1 – 5
A=5
Final Answer: an = 5 (1.1)n – 5
Application (cont’d)
5. To calculate the amount in the month of
December of the 30 year
In the beginning of the 31st year Jill will
have
a31 = 5(1.1)31 – 5
= 90.972
This means Jill will have 90.972 * 1000 =
RM90972.
Subtracting her last deposit of RM500 Jill
will
have RM90472 at the end of the 30th year.
 Solve the following recurrence relation
a =4an-1-4an-2 for n ≥ 2, a0=0, a1=1
n

 Find all the solutions of the recurrence relations


a =2an-1+3n+1
n
 Findall the solutions of the recurrence relation of the
above with initial condition a0=5
Exercise
 Exercise: Assume that the population of the
world in 2002 is 6.2 billion and is growing at the
rate of 1.3% a year.
 Set up a recurrence relation for the population of
the world n years after 2002.
 Find an explicit formula for the population of the
world n years after 2002.
 What will the population of the world be in 2014?
Recurrence Relations: Answer
1. an = an-1 + 4 11. fn = (fn-1)2
2. 12. fn = (fn-1)2 + 2
3. 13.
4. an = 3an-1 + 4nan-2 14. fn = fn-3 + 2fn-2
5. an = 3an-1 15. fn = 2fn-1 + n
6. an = 3an-1 + 5 16. fn = 2nfn-1
7. xn = 2xn-1 – 3xn-2 17. fn = 4fn-4 + 8fn-3
8. 18. an = an-1 + 2an-2
9. xn = 7xn-1 – 6xn-2 19.
10. xn = 5xn-4 20. an = 3an-1 – 2an-2

You might also like