Beruflich Dokumente
Kultur Dokumente
a0 = 1
Instructor: Işıl Dillig
a1 = 1
an = an − 1 + an−2
Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 1/23 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 2/23
Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 3/23 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 4/23
I Given an arbitrary recurrence relation, is there a mechanical I Which of these are linear homogenous recurrence relations
way to obtain the closed form solution? with constant coefficients?
I Not for arbitrary, but for a subclass of recurrence relations I an = an−1 + 2an−5
Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 5/23 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 6/23
1
Characteristic Polynomial Characteristic Equation Examples
Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 7/23 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 8/23
I What are the characteristic roots of the following recurrence I Then the closed form solution for an is of the form:
relations?
α1 r1n + α2 r2n + . . . + αk rkn
I an = 2an−1 + 3an−2
I Furthermore, given k initial conditions, the constants
I fn = fn−1 + fn−2 α1 , . . . , αk are uniquely determined
Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 9/23 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 10/23
Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 11/23 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 12/23
2
An Example Solving Linear Non-Homogeneous Recurrence Relations
Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 13/23 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 14/23
Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 15/23 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 16/23
Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 17/23 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 18/23
3
Example I Example II
I Consider again the recurrence an = 3an−1 + 2n
I Here, s = 1 and characteristic root is 3 I Find a particular solution for an = 6an−1 − 9an−2 + 2n
I A particular solution: −n − 3
2
Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 19/23 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 20/23
I Goal: Move all the disks to a different peg (e.g., second one) I Idea: First move the topmost n − 1 disks to peg 3; can be
done in Tn−1 steps
I Rule 1: Larger disks cannot rest on top of smaller disks
I Now, move bottom-most disk to peg 2 – takes just 1 step
I Rule 2: Can only move the top-most disk at a time
I Finally, recursively move n − 1 disks in peg 3 to peg 2 – can
I Question: How many steps does it take to move all n disks? be done in Tn−1 steps
Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 21/23 Instructor: Işıl Dillig, CS311H: Discrete Mathematics Recurrence Relations 22/23
I Recurrence relation:
I Initial condition:
I Solve for α: