7-Solving Recurrence Relations I and II
7-Solving Recurrence Relations I and II
Relations
Department of Software 2
Summation Notation Facts
Let's start by reviewing a few important facts about
summation notation and the indexes used for
summing things. We can use summation notation to
represent a sum like a1+ a2 + … + an as follows:
Department of Software 3
Summation Notation (Review)
Department of Software 4
Summation Notation (Cont.)
Department of Software 5
Summation Notation (Cont.)
Department of Software 6
Summation’s Laws
Department of Software 7
Summation’s Laws (Cont.)
Department of Software 8
Summation’s Laws (Cont.)
Department of Software 9
Example
Department of Software 10
Example (Re-indexing)
To compute such a sum, we should first reindex it so that
the indexing starts at 1. After that we could apply the above
theorems. Let j = i − 14. So i = j + 14. Since j = 1 when i =
15, and j = 70 when i = 84, we have
OR
Department of Software 11
Example (Re-indexing)
a
Department of Software 12
Example
Department of Software 13
Example
Department of Software 14
Quiz
Represent the following series using
summation notation and then find its value
using summation laws?
Department of Software 15
Recurrence Relations
Previously, we discussed recursively defined functions
such as Factorial function(n! = n*(n –1)! ), Fibonacci
sequence (Fn=Fn-2+Fn-1).
Consider the following sequence which begins with the
number 3 and for which each of the following terms is
found by multiplying the previous term * 2:
3, 6, 12, 24, 48, . . .
Department of Software 21
Converting Recurrence Relations
Begin by looking at a series of equations
with decreasing values of n:
T (n) T (n 1) 2
T (n 1) T (n 2) 2
T (n 2) T (n 3) 2
T (n 3) T (n 4) 2
T (n 4) T (n 5) 2
Department of Software 22
Converting Recurrence Relations
Now, we substitute back into the first
equation:
T (n) T (n 1) 2
T (n) (T (n 2) 2) 2
T (n) ((T (n 3) 2) 2) 2
T (n) (((T (n 4) 2) 2) 2) 2
T (n) ((((T (n 5) 2) 2) 2) 2) 2
Department of Software 23
Converting Recurrence Relations
We stop when we get to T(1):
T (n) T (n 1) 2
T ( n ) ( T ( n 2) 2) 2
T (n) ( ((T (1) 2) 2) 2) 2
Department of Software 24
Converting Recurrence Relations
We must have n – 1 of the “+ 2” terms
because there was one at the start and we
did n – 2 substitutions:
n 1
T (n) T (1) 2
i 1
Department of Software 25
Repeated Substitution Method
Example
Department of Software 26
Repeated Substitution Method
Example
Department of Software 27
Repeated Substitution Method
Example
Department of Software 28
Repeated Substitution Method
Example
Department of Software 29
Linear Recurrence Relations With Constant
Coefficients
A linear kth-order recurrence relation with constant
coefficients is a recurrence relation of the form
Department of Software 30
Linear Recurrence Relations With
Constant Coefficients (Examples)
Recurrence Relation Properties Homogeneous?
an = nan−1 − 4an−2 + n2 Linear, second-order, no No
constant coefficients.
an= 2an−1an−2 + 1 Not linear No
an = 7an−1 + 3an−2 Linear, second-order, Yes
constant coefficients
an= 2an−1 + 5an−2 − 6an−3 Linear, third-order, Yes
constant coefficients
an = an-5 Linear, five-order, Yes
constant coefficients
We will investigate the solutions of homogeneous linear
recurrence relations with constant coefficients.
Department of Software 31
The Characteristic Equation
The characteristic equation of
an = Aan – 1 + Ban – 2
is
t2 – At – B = 0.
For the Fibonacci sequence, the characteristic
equation is t2 – t – 1 = 0.
Department of Software 32
The Characteristic Equation
Let r be a root of the characteristic equation.
Then the sequence an = rn satisfies the
recurrence relation.
Department of Software 33
Solving Such Recurrence Relations
– Case I
Theorem: If the characteristic equation has
roots r and s which are distinct real numbers,
then the recursive sequence is given by
an = Crn + Dsn,
where C and D are constants, determined by
the values of a0 and a1.
Department of Software 34
Example
Solve the recurrence relation
a0 = 2,
a1 = 3,
an = an – 1 + 2an – 2, for all n 2.
The first few terms are 2, 3, 7, 13, 27, 53, 107,
213, …
Department of Software 35
Example
Solve a0 = C + D = 2 and a1 = 2C – D = 3.
We get C = 5/3 and D = 1/3.
The sequence is
n
5 1 n
5 2 ( 1) n
an 2 (1) n .
3 3 3
Department of Software 36
Solving Fibonacci Sequence
a
c1 1 and c2 1
5 5
Department of Software 37
Solving Such Recurrence Relations
– Case II
Theorem: If the characteristic equation has
double root r, then the recursive sequence is
given by
an = Crn + Dnrn = (C + Dn)rn,
where C and D are constants determined by
the values of a0 and a1.
Department of Software 38
Example
Solve the recurrence relation
a0 = 0,
a1 = 4,
an = an – 1 – (¼)an – 2, for all n 2.
The first few terms are 0, 4, 4, 3, 2, …
Department of Software 39
Example
Department of Software 41
Case III – Complex Roots
The sequences become more interesting when
the roots of the characteristic equation are
complex numbers. However, this case is out
the scope of this lecture.
Department of Software 42
References
1. Seymour Lipschutz, and Marc Lipson, “Schaum’s
Outlines: Discrete Mathematics,” 3rd edition, McGraw-
Hill, 2007.
2. Rosen, Discrete Mathematics and Its Applications, 6th
edition, 2007.
3. Kevin Ferland, Discrete Mathematics, An Introduction
To Proofs And Combinatorics, Richard Stratton, 2009.
4. Thomas Koshy, Discrete Mathematics with Applications,
Elsevier Press, 2004.
Department of Software 43
Thank You for
Listening.
Department of Software 44