0% found this document useful (0 votes)
219 views

Recurrence Relation Notes

The document discusses recurrence relations and their solutions. It introduces recursively defined sequences and recurrence relations. It explains that closed form solutions define the nth term of a sequence as a function of n. It states that linear homogeneous recurrence relations with constant coefficients have a characteristic polynomial whose roots can be used to find a closed form solution. The document provides examples of characteristic equations and roots for different recurrence relations. It presents a theorem for finding the closed form solution when the characteristic roots are distinct.

Uploaded by

Vikash Dubey
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
219 views

Recurrence Relation Notes

The document discusses recurrence relations and their solutions. It introduces recursively defined sequences and recurrence relations. It explains that closed form solutions define the nth term of a sequence as a function of n. It states that linear homogeneous recurrence relations with constant coefficients have a characteristic polynomial whose roots can be used to find a closed form solution. The document provides examples of characteristic equations and roots for different recurrence relations. It presents a theorem for finding the closed form solution when the characteristic roots are distinct.

Uploaded by

Vikash Dubey
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

CS311H: Discrete Mathematics Recall: Recursively Defined Sequences

Recurrence Relations

Instructor: I¸sıl Dillig I In previous lectures, we looked at recursively-defined sequences

I Example: What sequence is this?

a0 = 1 a1 = 1
an = an − 1+an−2

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 1/23 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 2/23

Recurrence Relations Closed Form Solutions

I Often, we need to find a closed form solution for a given recurrence


I Recurively defined sequences are often referred to as recurrence
relations
I Recall: Closed form solution defines n’th number in the sequence as
a function of n
I The base cases in the recursive definition are called initial values of
the recurrence relation
I What is closed form solution to the following recurrence?

I Example: Write recurrence relation representing number of bacteria a0 = 0


in n’th hour if colony starts with 5 bacteria and doubles every an = an−1 +n
hour?

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 3/23 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 4/23

Closed Form Solutions of Recurrence Relations Examples and Non-Examples

I Given an arbitrary recurrence relation, is there a mechanical way to I Which of these are linear homogenous recurrence relations with
obtain the closed form solution? constant coefficients?

I Not for arbitrary, but for a subclass of recurrence relations


I an = an−1+2an−5 I an

I A linear homogeneous recurrence relation with constant coefficients is


=2an−2+5 I an = an−1+ n
a recurrence relation of the form:

an = c1an−1 +c2an−2 + ... +ckan−k I an = an−1 · an−2

where each ci is a constant and ck is non-zero I an = n · an−1

I The value of k is called the degree of the recurrence relation

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 5/23 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 6/23

1
Characteristic Polynomial Characteristic Equation Examples

I Cook-book recipe for solving linear homogenous recurrence relations


I What are the characteristic equations for the following recurrence
with constant coefficients relations?

I Definition: The characteristic equation of a recurrence relation of the


I fn = fn−1+ fn−2
form an = c1an−1 +c2an−2 + ...ckan−k is
I an =2an−1
rk = c1rk−1 +c2rk−2 + ... +ck

I an =2an−1+5an−3
I i.e., replace ai with ri−(n−k)

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 7/23 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 8/23

Characteristic Roots Theorem I for Solving Linear Homogenous Recurrence


Relations

Let an = c1an−1 +c2an−2 + ... +ckan−k be a recurrence relation with k distinct


I The characteristic roots of a linear homogeneous recurrence relation are
characteristic roots r1,...,rk.
the roots of its characteristic equation.

I What are the characteristic roots of the following recurrence relations? I Then the closed form solution for an is of the form:

krkn
I an =2an−1+3an−2

I Furthermore, given k initial conditions, the constants α1,...,αk are


I fn = fn−1+ fn−2
uniquely determined

I Note: Won’t do the proof because requires a good amount of linear


algebra

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 9/23 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 10/23

Example +2an−2 Generalized Theorem

Find a closed form solution for the recurrence an = an−1 I So far, we assume all characteristic roots are distinct – what happens if
this is not the case?
with initial conditions a0 = 2 and a1 = 7 I Characteristic

equation: I Theorem: Let an = c1an−1 +c2an−2 + ... +ckan−k be a recurrence


relation with t distinct characteristic roots r1,...,rk with
I Characteristic roots: multiplicities m1,...,mk. Then solutions are of the form:
t

I Coefficients:
an = X(αi,0 + αi,1 · n + ... + αi,mi−1 · nmi−1)rin

I Closed-form solution: i=0

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 11/23 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 12/23

2
Why is this theorem useful? How do we find a particular solution?
Theorem: Consider an = c1an−1 + ... +ckan−k +F(n) where:
I If we can find a particular solution, then we can also mechanically find
a solution that satisfies initial conditions. F(n) = (btnt +bt−1nt−1 + ... +b1n +b0)sn

I Example: Solve the recurrence relation an = 3an−1 +2n with initial


condition a1 = 3 I Case 1: If s is not a root of the associated characteristic equation, then
there exists a particular solution of the form:
I A particular solution: (Why?)
(ptnt +pt−1nt−1 + ... +p1n +p0)sn
I Solutions for homogeneous recurrence:

I Case 2: If s is a root with multiplicity m of the characteristic equation,


I Solutions for recurrence:
then there exists a solution of the form:

I Solve for α: nm(ptnt +pt−1nt−1 + ... +p1n +p0)sn

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 17/23 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 18/23

Example I Example II
I Consider again the recurrence an = 3an−1 +2n
I Find a particular solution for an = 6an−1 − 9an−2 +2n I
I Here, s = 1 and characteristic root is 3

Characteristic root:
I Hence, there exists a particular solution of the form p1n +p0

I Now, solve for p0,p1: I Particular solution of the form:

p1n +p0 = 3(p1(n − 1)+p0)+2n I Find p0 such that p0 · 2n = 6(p0 · 2n−1) − 9(p0 · 2n−2)+2n

I Rearrange: 2n(p1 +1)+(2p0 − 3p1) = 0 I Solve for p0:

I A solution p I Particular solution:

I A particular solution:
Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 19/23 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 20/23

Towers of Hanoi A Recursive Solution

I Solve recursively – Tn is number of steps to move n disks

I Base case: n = 1, move disk from first peg to second: T1 = 1

I Given 3 pegs where first peg contains n disks


I Induction: Suppose we can move n − 1 disks in Tn−1 steps; how

I Goal: Move all the disks to a different peg (e.g., second one) many steps does it take to move Tn disks?

I Rule 1: Larger disks cannot rest on top of smaller disks I Idea: First move the topmost n − 1 disks to peg 3; can be done in

Tn−1 steps
I Rule 2: Can only move the top-most disk at a time

I Question: How many steps does it take to move all n disks? I Now, move bottom-most disk to peg 2 – takes just 1 step

I Finally, recursively move n − 1 disks in peg 3 to peg 2 – can be


done in Tn−1 steps
Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 21/23 Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 22/23

3
Towers of Hanoi, cont.

I Recurrence relation:

I Initial condition:

I Now find closed form for Tn

I What is a particular solution?

I Solution for homogeneous recurrence:

I Solve for α:

I Solution for recurrence:

Instructor: I¸sıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 23/


23

You might also like