Chapter 2
Chapter 2
Chapter 2
Recurrence Relation
Fikre Bogale(PhD)
1/32
Outline
Introduction
Definitions on recurrence relation
Examples on recurrence relation
2/32
Introduction
There are many counting problems cannot be solved easily
using the methods discussed in the previous chapters.
To solve such problems we have to find relationships
between consecutive terms.
The rule for finding terms from those that precede them
is called a recurrence relation.
Example
1 The number of bacteria in a laboratory doubles every
hour. If a laboratory begins with five bacteria, how many
will be present in n hours?
2 Problem of Compound Interest in a bank.
3/32
Introduction
There are many counting problems cannot be solved easily
using the methods discussed in the previous chapters.
To solve such problems we have to find relationships
between consecutive terms.
The rule for finding terms from those that precede them
is called a recurrence relation.
Example
1 The number of bacteria in a laboratory doubles every
hour. If a laboratory begins with five bacteria, how many
will be present in n hours?
2 Problem of Compound Interest in a bank.
3/32
Introduction
There are many counting problems cannot be solved easily
using the methods discussed in the previous chapters.
To solve such problems we have to find relationships
between consecutive terms.
The rule for finding terms from those that precede them
is called a recurrence relation.
Example
1 The number of bacteria in a laboratory doubles every
hour. If a laboratory begins with five bacteria, how many
will be present in n hours?
2 Problem of Compound Interest in a bank.
3/32
Introduction
There are many counting problems cannot be solved easily
using the methods discussed in the previous chapters.
To solve such problems we have to find relationships
between consecutive terms.
The rule for finding terms from those that precede them
is called a recurrence relation.
Example
1 The number of bacteria in a laboratory doubles every
hour. If a laboratory begins with five bacteria, how many
will be present in n hours?
2 Problem of Compound Interest in a bank.
3/32
Definition
A recurrence relation for the sequence {an } is an equation that
expresses an in terms of one or more of the previous terms of
the sequence, namely, a0 , a1 , · · · , an−1 , for all integers n with
n ≥ n0 , where n0 is a non-negative integer.
Example
1 an = an−1 − an−2 , n ≥ 2 where a0 = 3, a1 = 5.
2 an − 2an−1 + 1 = 0
3 an + (n − 2)an−2 = n2 + 1
2
4 an+1 − an = 3, n ≥ 0, where a0 = 1.
4/32
Definition
A recurrence relation for the sequence {an } is an equation that
expresses an in terms of one or more of the previous terms of
the sequence, namely, a0 , a1 , · · · , an−1 , for all integers n with
n ≥ n0 , where n0 is a non-negative integer.
Example
1 an = an−1 − an−2 , n ≥ 2 where a0 = 3, a1 = 5.
2 an − 2an−1 + 1 = 0
3 an + (n − 2)an−2 = n2 + 1
2
4 an+1 − an = 3, n ≥ 0, where a0 = 1.
4/32
Example 1
Determine whether the sequence {an } is a solution of the
recurrence relation an = 2an−1 − an−2 , ∀n ≥ 2 where
(a) an = 3n (b) an = 2n (c) an = 5
Solution
(a) The sequence {an } with an = 3n is the solution.
(b) The sequence {an } with an = 2n is not the solution.
(c) The sequence {an } with an = 5 is the solution.
5/32
Example 1
Determine whether the sequence {an } is a solution of the
recurrence relation an = 2an−1 − an−2 , ∀n ≥ 2 where
(a) an = 3n (b) an = 2n (c) an = 5
Solution
(a) The sequence {an } with an = 3n is the solution.
(b) The sequence {an } with an = 2n is not the solution.
(c) The sequence {an } with an = 5 is the solution.
5/32
Example 1
Determine whether the sequence {an } is a solution of the
recurrence relation an = 2an−1 − an−2 , ∀n ≥ 2 where
(a) an = 3n (b) an = 2n (c) an = 5
Solution
(a) The sequence {an } with an = 3n is the solution.
(b) The sequence {an } with an = 2n is not the solution.
(c) The sequence {an } with an = 5 is the solution.
5/32
Solution
P1 = P0 + P0 I = P0 (1 + I )1 (1)
P2 = P1 + P1 I = P1 (1 + I ) = P0 (1 + I )2 (2)
P3 = P2 + P2 I = P2 (1 + I ) = P0 (1 + I )3 (3)
Solution
P1 = P0 + P0 I = P0 (1 + I )1 (1)
P2 = P1 + P1 I = P1 (1 + I ) = P0 (1 + I )2 (2)
P3 = P2 + P2 I = P2 (1 + I ) = P0 (1 + I )3 (3)
Solution
P1 = P0 + P0 I = P0 (1 + I )1 (1)
P2 = P1 + P1 I = P1 (1 + I ) = P0 (1 + I )2 (2)
P3 = P2 + P2 I = P2 (1 + I ) = P0 (1 + I )3 (3)
Example 3
The number of bacteria in a laboratory doubles every hour. If
a laboratory begins with five bacteria, then how many bacteria
will be present in n hours?
Solution
Let an be the no of bacteria at the end of n hours.
a0 = 5,
a1 = 2a0 , a2 = 2a1 = 22 a0 , a3 = 2a2 = 23 a0 , · · · , an = 2n a0
Hence, an = 2n a0 = 5(2)n , ∀n ≥ 0
7/32
Constant coefficients
If all Ck (n) are constant numbers, then the recurrence relation
(1) is constant coefficient recurrence relation.
Linear
If the exponent of an−k is 1, then the recurrence relation (1) is
called linear otherwise non-linear.
Homogeneous
The recurrence relation (1) is said to be homogeneous if
f (n) = 0 otherwise non-homogeneous.
8/32
Constant coefficients
If all Ck (n) are constant numbers, then the recurrence relation
(1) is constant coefficient recurrence relation.
Linear
If the exponent of an−k is 1, then the recurrence relation (1) is
called linear otherwise non-linear.
Homogeneous
The recurrence relation (1) is said to be homogeneous if
f (n) = 0 otherwise non-homogeneous.
8/32
Constant coefficients
If all Ck (n) are constant numbers, then the recurrence relation
(1) is constant coefficient recurrence relation.
Linear
If the exponent of an−k is 1, then the recurrence relation (1) is
called linear otherwise non-linear.
Homogeneous
The recurrence relation (1) is said to be homogeneous if
f (n) = 0 otherwise non-homogeneous.
8/32
2
4 an = an−1 − 2an−2
5 an − 2an−1 − 1 = 0
Solution
1 Constant coefficient, linear and homogeneous
2 Constant coefficient, non-linear and homogeneous
3 non-Constant coefficient, linear and non-homogeneous
4 Constant coefficient, non-linear and homogeneous
5 Constant coefficient, linear and non-homogeneous
9/32
2
4 an = an−1 − 2an−2
5 an − 2an−1 − 1 = 0
Solution
1 Constant coefficient, linear and homogeneous
2 Constant coefficient, non-linear and homogeneous
3 non-Constant coefficient, linear and non-homogeneous
4 Constant coefficient, non-linear and homogeneous
5 Constant coefficient, linear and non-homogeneous
9/32
if and only if
Step 2
Solve the characteristic (auxiliary) equation found in step 1
and determine all the characteristic roots of this equation.
Step 3
Write the general solution of the difference equation based on
any one of the following two cases.
Case 1
If there are k distinct characteristic roots, say r1 , r2 , r3 , · · · , rk
to the equation obtained in step 1, then the general solution is
of the form: an = α1 r1n + α2 r2n + α3 r3n + · · · + αk rkn
12/32
Step 2
Solve the characteristic (auxiliary) equation found in step 1
and determine all the characteristic roots of this equation.
Step 3
Write the general solution of the difference equation based on
any one of the following two cases.
Case 1
If there are k distinct characteristic roots, say r1 , r2 , r3 , · · · , rk
to the equation obtained in step 1, then the general solution is
of the form: an = α1 r1n + α2 r2n + α3 r3n + · · · + αk rkn
12/32
Step 2
Solve the characteristic (auxiliary) equation found in step 1
and determine all the characteristic roots of this equation.
Step 3
Write the general solution of the difference equation based on
any one of the following two cases.
Case 1
If there are k distinct characteristic roots, say r1 , r2 , r3 , · · · , rk
to the equation obtained in step 1, then the general solution is
of the form: an = α1 r1n + α2 r2n + α3 r3n + · · · + αk rkn
12/32
Case 2
If there is a root r of multiplicity m, 2 ≤ m ≤ k, for the
auxiliary equation obtained in step 1, then the part of the
general solution that involves the root r has the form:
α0 r n + α1 nr n + α2 n2 r n + · · · + αm−1 nm−1 r n
13/32
Case 2
If there is a root r of multiplicity m, 2 ≤ m ≤ k, for the
auxiliary equation obtained in step 1, then the part of the
general solution that involves the root r has the form:
α0 r n + α1 nr n + α2 n2 r n + · · · + αm−1 nm−1 r n
13/32
Step 4
Use the initial conditions to determine the constants
α0 , α1 , · · · , αm−1 , β1 , β2 , · · · , βk−m in the general solution.
Step 5
Replace the specific values of the arbitrary constant obtained
in step 4 and write the unique (particular) solution.
14/32
Step 4
Use the initial conditions to determine the constants
α0 , α1 , · · · , αm−1 , β1 , β2 , · · · , βk−m in the general solution.
Step 5
Replace the specific values of the arbitrary constant obtained
in step 4 and write the unique (particular) solution.
14/32
Example
Solve the recurrence relation
Example
Solve the recurrence relation
an = α1 r1n + α2 r2n
16/32
an = α1 r1n + α2 r2n
16/32
an = α1 r1n + α2 r2n
16/32
Solution
1 Let an = r n be a solution of the recurrence relation. Then
r n − 5r n−1 + 6r n−2 = 0
r 2 − 5r + 6 = 0, divided by r n−2
r1 = 3 and r2 = 2
Solution
1 Let an = r n be a solution of the recurrence relation. Then
r n − 5r n−1 + 6r n−2 = 0
r 2 − 5r + 6 = 0, divided by r n−2
r1 = 3 and r2 = 2
Example
Solve the following recurrence relation
1 an = −3an−1 + 10an−2 , n ≥ 2
2 an = 4an−1 − 4an−2 , n ≥ 2 with a0 = 6 and a1 = 8
Solutions
1 an = α1 (2)n + α2 (−5)n
2 an = 6(2)n − 2n(2)n = (3 − n)(2)n+1
18/32
Example
Solve the following recurrence relation
1 an = −3an−1 + 10an−2 , n ≥ 2
2 an = 4an−1 − 4an−2 , n ≥ 2 with a0 = 6 and a1 = 8
Solutions
1 an = α1 (2)n + α2 (−5)n
2 an = 6(2)n − 2n(2)n = (3 − n)(2)n+1
18/32
Example
Solve the following recurrence relation
1 an = −3an−1 + 10an−2 , n ≥ 2
2 an = 4an−1 − 4an−2 , n ≥ 2 with a0 = 6 and a1 = 8
Solutions
1 an = α1 (2)n + α2 (−5)n
2 an = 6(2)n − 2n(2)n = (3 − n)(2)n+1
18/32
Solving k nd order
Let cn an + cn−1 an−1 + cn−2 an−2 + · · · + cn−k an−k = 0 be k th
order recurrence relation.Then
Case 1
If the characteristic equation has k distinct roots r1 , r2 , · · · , rk ,
then
an = α1 r1n + α2 r2n + · · · + αk rkn
is the general solution of the given recurrence relation.
Where α1 , α2 , · · · , αk are arbitrary constants which are
determined by initial conditions.
19/32
Solving k nd order
Let cn an + cn−1 an−1 + cn−2 an−2 + · · · + cn−k an−k = 0 be k th
order recurrence relation.Then
Case 1
If the characteristic equation has k distinct roots r1 , r2 , · · · , rk ,
then
an = α1 r1n + α2 r2n + · · · + αk rkn
is the general solution of the given recurrence relation.
Where α1 , α2 , · · · , αk are arbitrary constants which are
determined by initial conditions.
19/32
Example
Solve the following recurrence relation
1 an+3 − an+2 − 4an+1 + 4an = 0, n ≥ 0
2 an = −3an−1 − 3an−2 − an−3
3 an+3 − 3an+1 + 2an = 0
Solution (1)an = α1 2n + α2 (−2)n + α3
(2)an = α1 (−1)n + α2 n(−1)n + α3 n2 (−1)n
(3)an = α1 + α2 n + α3 (−2)n 20/32
Example
Solve the following recurrence relation
1 an+3 − an+2 − 4an+1 + 4an = 0, n ≥ 0
2 an = −3an−1 − 3an−2 − an−3
3 an+3 − 3an+1 + 2an = 0
Solution (1)an = α1 2n + α2 (−2)n + α3
(2)an = α1 (−1)n + α2 n(−1)n + α3 n2 (−1)n
(3)an = α1 + α2 n + α3 (−2)n 20/32
Example
Solve the following recurrence relation
1 an+3 − an+2 − 4an+1 + 4an = 0, n ≥ 0
2 an = −3an−1 − 3an−2 − an−3
3 an+3 − 3an+1 + 2an = 0
Solution (1)an = α1 2n + α2 (−2)n + α3
(2)an = α1 (−1)n + α2 n(−1)n + α3 n2 (−1)n
(3)an = α1 + α2 n + α3 (−2)n 20/32
Definition
The k th order non-homogeneous recurrence relation has the
form
21/32
Definition
The k th order non-homogeneous recurrence relation has the
form
21/32
an = an(h) + an(p) ,
(h)
where an is the general solution of the associated
(p)
homogeneous recurrence relation and an is a particular
solution for the given non-homogeneous recurrence relation.
an = an(h) + an(p) ,
(h)
where an is the general solution of the associated
(p)
homogeneous recurrence relation and an is a particular
solution for the given non-homogeneous recurrence relation.
Step 2
(p)
Find the particular solution an of the non-homogeneous
recurrence relation.
(p)
To find the particular solution an
an(p) = β1 nk + β2 nk−1 + · · · + βk
23/32
Example
1 Solve the non-homogeneous recurrence relation
an = 3an−1 + 2n.
Solution
Since the given recurrence relation an − 3an−1 = 2n is
non-homogeneous with f (n) = 2n.
(h)
The sequence an = α(3)n is the general solution of the
associated homogeneous RR.
(p)
Let an = β1 n + β2 be a particular solution. Then
(p)
an = −n − 3/2 is particular solution.
3
Hence, an = α(3)n − n − is the solution of the given
2
recurrence relation.
24/32
an = an−1 + 2an−2 + n + 1
Solution
Since the given recurrence relation an − an−1 − 2an−2 = n + 1
is non-homogeneous with f (n) = n + 1.
(h)
The sequence an = α1 (−1)n + α2 (2)n is the general solution
of the associated homogeneous rec. r/n.
(p)
Let an = β1 n + β2 be a particular solution. Then
(p) 1 7
an = − n − is particular solution.
2 4
1 7
Hence, an = α1 (−1)n + α2 (2)n − n − is the solution of the
2 4
given recurrence relation. 25/32
Case 2
If r is a root of a characteristic equation of the associated
homogeneous recurrence relation, then the particular solution
has the form an(p) = βnr n , for some constant β.
26/32
Solution
(a) an = α1 (−7)n + α2 (3)n is the solution of associated
homogeneous recurrence relation.
(p)
Let an = β(4)n be a particular solution of the given
recurrence relation. Then
(p) 80
an = (4)n is a particular solution.
11
80
Hence, an = α1 (−7)n + α2 (3)n + (4)n is the general
11
solution of the recurrence relation.
27/32
28/32
32/32