Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• Readings:
Recurrence Relations Rosen section 7.1-7.2
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• A recurrence relation for the sequence {a n } is an equation that expresses a n in terms of one or more of the previous terms, a 0 ,a 1 ,…,a n-1 .
• A sequence is called a solution of a recurrence relation if its terms satisfy the recurrence relation.
a n = 5a n-1
b n = b n-1 -2 b n-2 +100 c n = c n-3 + c n-4 +log(n)+e n
• Example (Rosen p.402):
Determine whether a n =3n, for every nonnegative integer n, is a solution of
a n = 2a n-1 -a n-2 ; n = 2, 3, …
The initial conditions specify the terms that precede the first term where the recurrence relation takes effect.
a n = 2a n-1 -a n-2 ; n = 2, 3, …
0 3 6 9 12 ……
1 2 3 4 5 ……
n = 0 1 2 3 4 …… a
n=3n
for non-negative int.
a
0= 0, a
1= 3
a
n=n+1
for non-negative int.
a
0= 1, a
1= 2
defined by the recurrence relation
initial conditions Solution # 1
Solution # 2
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
In order to find a unique solution for every non-negative integers to:
b n = b n-2 +b n-4 ; n = 4, 5, …
how many terms of b
nneeded to be given in the initial conditions?
b 2 b 3 b 4 b 5 b 6
n = 2 3 4 5 6
……
defined by the recurrence relation
initial conditions
b 7
7
b 0 b 1
0 1
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
To find solutions for doing a task of a size n Find a way to:
Construct the solution at the size n from the solution of the same tasks at smaller sizes.
⌧
⌧
Rules:
Move a disk at a time from one peg to another.
Never place a disk on a smaller disk.
The goal is to have all disk on the 2 nd peg in order of size.
Find H n , the number of moves needed to solve the problem with n disks.
Example:
A man running up a staircase of n stairs. Each step
he takes can cover either 1 or 2 stairs. How
many different ways for him to ascend this
staircase?
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• A linear homogeneous recurrence relation can be solved in a systematic way.
Linear homogeneous recurrence relation of degree k with constant coefficients
a n = c 1 a n-1 + c 2 a n-2 + …+c k a n-k where c 1 , c 2 , …, c k are real numbers
and c k ≠ 0
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• a n =a n-1 +a 2 n-2
• H n = 2H n-1 +1
• B n = nB n-1
• f n = f n-1 + f n-2
Recurrence Relation Characteristic Equation
General Solution Unique Solution
solve equation polynomial=0
initial conditions
follow a specific method
solve linear equations for arbitrary variables
• Recurrence Relation:
• Characteristic equation:
a n - c 1 a n-1 - c 2 a n-2 - … - c k a n-k = 0
r k - c 1 r k-1 - c 2 r k-2 … - c k = 0
Example:
a n = a n-1 +3a n-2
b n = 2b n-1 -b n-2 +5b n-3
d n = d n-2 +d n-5
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• Let c 1 , c 2 , …, c k be real numbers. Suppose the characteristic equation:
r k - c 1 r k-1 - c 2 r k-2 … - c k = 0
has k distinct roots r 1 , r 2 , …, r k . Then a sequence {a n } is a solution of the recurrence relation:
a n - c 1 a n-1 - c 2 a n-2 - … - c k a n-k = 0
if and only if:
a n = α 1 r 1 n + α 2 r 2 n + … + α k r k n
for n = 0, 1, 2, …. Where α 1 , α 2 ,…, α k are constants.
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• Example :
What is the solution of the recurrence relation:
a n = a n-1 + 2a n-2 with a 0 = 2 and a 1 = 7?
• Example:
What is the solution of the recurrence relation:
a n = 6a n-1 - 11a n-2 + 6a n-3 with a 0 = 2, a 1 = 5 and a 2 = 15 ?
• Suppose the characteristic equation has t distinct roots r 1 , r 2 , …, r t with multiplicities m 1 , m 2 , …, m t .
• Solution:
a n = ( α 1,0 + α 1,1 n + … + α 1,m1-1 n m1-1 )r 1 n +( α 2,0 + α 2,1 n + … + α 2,m2-1 n m2-1 )r 2 n + ………..
+( α t,0 + α t,1 n + … + α t,mt-1 n mt-1 )r t n
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• Example :
What is the solution of the recurrence relation:
a n = -3a n-1 - 3a n-2 - a n-3 with a 0 = 1, a 1 = -2 and a 2 = -1 ?
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
a n = c 1 a n-1 + c 2 a n-2 + … + c k a n-k + F(n)
Associated homogeneous recurrence relation
{a n h } {a n p } {a n } = {a n h } + {a n p }
{a n } = {a n h } + {a n p }
• Key:
1 – Solve for a solution of the associated homogeneous part.
2 – Find a particular solution.
3 – Sum the solutions in 1 and 2
• There is no general method for finding the particular solution for every F(n)
• There are general techniques for some F(n) such as polynomials and powers of constants.
• Example:
Find the solutions of a n = 3a n-1 +2n with a 1 = 3
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
• Example:
Find the solutions of a n = 5a n-1 - 6a n-2 +7 n
Atiwong Suchato
Department of Computer Engineering, Chulalongkorn University Discrete Mathematics
F(n) = ( b t n t + b t-1 n t-1 + … + b 1 n + b 0 ) s n where b 0 , b 1 , …, b t and s are real numbers.
When s is not a root of the characteristic equation:
The particular solution is of the form:
( p t n t + p t-1 n t-1 + … + p 1 n + p 0 ) s n When s is a root of multiplicity m:
The particular solution is of the form:
n m ( p t n t + p t-1 n t-1 + … + p 1 n + p 0 ) s n
• Example:
What form does a particular solution of a n = 6a n-1 – 9a n-2 + F(n) have when:
F(n)= 3n, F(n)= n3 n , F(n)= n 2 2 n , F(n)= (n 2 +1)3 n ?
• Example :
Find the solution of ∑
=
= n
k
n k
a
1