0% found this document useful (0 votes)
166 views44 pages

7-Solving Recurrence Relations I and II

This document discusses solving recurrence relations by converting them to closed forms. It begins by reviewing summation notation and laws. It then discusses different types of recurrence relations like arithmetic and geometric progressions. Methods for solving recurrence relations are presented, including repeated substitution and solving linear homogeneous recurrence relations with constant coefficients. For the latter, it explains using the characteristic equation to find the roots, and that the solution will be a combination of terms involving the roots. Examples are provided to demonstrate these techniques.

Uploaded by

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

7-Solving Recurrence Relations I and II

This document discusses solving recurrence relations by converting them to closed forms. It begins by reviewing summation notation and laws. It then discusses different types of recurrence relations like arithmetic and geometric progressions. Methods for solving recurrence relations are presented, including repeated substitution and solving linear homogeneous recurrence relations with constant coefficients. For the latter, it explains using the characteristic equation to find the roots, and that the solution will be a combination of terms involving the roots. Examples are provided to demonstrate these techniques.

Uploaded by

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

Solving Recurrence

Relations

Dr. Safaa O. Al-mamory


Department of Software 1
Closed Form
 Often an expression involving a sum of terms
can be simplified into a form that can be easily
computed with familiar operations, without
using loops, and without using recursion. Such
a form is often called a closed form.

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, . . .

 an = 3(2n) is the solution.


Department of Software 16
Recurrence Relations
 The equation ak= 2ak−1 or, equivalently, ak+1 = 2ak, where one
term of the sequence is defined in terms of previous terms of
the sequence, is called a recurrence relation.
 The equation a0 = 3 is called an initial condition.
 The function an = 3(2n), is called a solution of the recurrence
relation.
 There may be many sequences which satisfy a given
recurrence relation. For example, each of the following is a
solution of the recurrence relation a k= 2ak−1.

1, 2, 4, 8, 16, . . . and 7, 14, 28, 56, 112, . . .


Department of Software 17
Arithmetic Progression
 An arithmetic progression is a sequence of the form
a, a + d, a + 2d, a + 3d, . . .
 the sequence begins with the number a and each successive
term is obtained from the previous term by adding d (the
common difference between any two terms). For example:
a = 2, d = 5: 2, 7, 12, 17, . . .
 We note that the general arithmetic progression may be
defined recursively by:
a1 = a and ak+1 = ak+ d for k ≥ 1

where the solution is an = a + (n − 1)d.


Department of Software 18
Geometric Progression
 A geometric progression is a sequence of the form
a, ar, ar2, ar3, . . .
 The sequence begins with the number a and each successive
term is obtained from the previous term by multiplying by r
(the common ratio between any two terms) for example:
a = 1, r = 3: 1, 3, 9, 27, 81, . . .
 The general geometric progression may be defined
recursively by:
a1 = a and ak+1 = rak for k≥1
where the solution is an+1 = arn.
Department of Software 19
Solving recurrence relations
Several methods for solving recurrence rel.:
 Change of Variables.
 Guess and Answer then Prove by Induction
 Linear Algebra
 Master Theorem
 Repeated Substitution
 Linear homogeneous recurrence relations with
constant coefficients
 We will focus on last two methods.
Department of Software 20
Recurrence Relation Form
 A recurrence relation is a recursive form of an
equation, for example:
T (1)  3
T (n)  T (n  1)  2

 A recurrence relation can be put into an


equivalent closed form without the recursion

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

 How many “+ 2” terms are there? Notice


we increase them with each substitution.

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

 So, the closed form of the equation is:


T (n)  3  2(n  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

An = C1an−1 + C2an−2 + ・ ・ ・ +Ckan−k + f (n)

 Linear: There are no powers or products of the aj ’s.


 Constant coefficients: The C1C2, . . . ,Ck are constants (do
not depend on n).
 If f (n) = 0, then the relation is also said to be homogeneous.

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

 The roots of the characteristic equation are r =


2 and s = -1.
 So the general form is an = C(2n) + D(-1)n.

 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

 The root of the characteristic equation is the


double root r = ½.
 So the general form is an = (C + Dn)(½)n.

 Solve a0 = C = 0 and a1 = (C + D)(½) = 4.


 We get C = 0 and D = 8.
 The sequence is
n
 1  8n n
an  8n   n  n 3 .
2 2 2
40
Department of Software
Example
 Find a nonrecursive formula for the recursive
sequence
 a0 =1
 a1 = 10
 an = 2an – 1 – an – 2, for all n  2.

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

You might also like