week5 - S. Tanny Recurrence Relations Tower of Hanoi Let Tn...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
S. Tanny MAT 344 Spring 1999 72 Recurrence Relations Tower of Hanoi Let T n be the minimum number of moves required. T 0 = 0, T 1 = 1 7 Initial Conditions * T n = 2 T n - 1 + 1 n $ 2 T n is a sequence (fn. on integers). Solve for T n ? * is a recurrence , difference equation (linear, non-homogeneous, constant coefficient) Set U 0 = T 0 + 1 , U n = T n + 1 n $ 1 Then U n = T n + 1 = 2T n - 1 + 1 + 1 = 2(T n - 1 + 1) so U n = 2U n - 1 = 2 2 U n - 2 = = 2 n - 1 U 1 = 2 n ± T n = 2 n - 1 Suppose a n + 1 = 2a n + n , a 0 = 1 Let U n = a n + n , U 0 = 1 Then U n + 1 = a n + 1 + (n + 1) = 2a n + n + (n + 1) = 2(a n + n) + 1 = 2 U n + 1 Thus, U n is like the T n in the preceding example, except U 0 = 1 while T 0 = 0. In fact, since T 1 = 1, the {U n } is just {T n } “advanced one step”, i.e. U n = T n + 1 = 2 n + 1 - 1 ± a n = 2 n + 1 - 1 - n = 2 n + 1 - (n + 1) Notice how the solution of one recurrence often can be reduced to the solution of a simpler one.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
S. Tanny MAT 344 Spring 1999 73 Suppose the recursion were L n = L n - 1 + n , L 0 = 1 Then we can “expand out ” as follows: L n = L n - 2 + (n - 1) + n = L n - 3 + (n - 2) + (n - 1) + n = = L 0 + 1 + 2 + + n = 1 + n(n % 1) 2 This describes the number of regions formed by n intersecting lines in the plane, no 2 parallel and no 3 intersect in a point (PIZZA CUTTING PROBLEM). General Problem (*) F(Y n + k ,Y n + k - 1 , , Y n ) = 0 Difference equation of order k(DFE) Assume F linear , constant coefficients (**) Y n + k + a 1 Y n + k - 1 + + a k Y n - n (n) = 0 If n (n) = 0, Homogeneous; otherwise non-Homo. Note the strong analogy with D.E.! Suppose that Y n = S 1 (n) is a “solution”. Then S 1 (n + k) + a 1 S 1 (n + k - 1) + + a k S 1 (n) - n (n)=0 If S 2 (n) is any other solution, then [S 1 (n + k) - S 2 (n + k)] + a 1 [S 1 ( n + k - 1) - S 2 (n+ k - 1)] + ± + a k [S 1 (n) - S 2 (n)] = 0 It follows that S 1 (n) - S 2 (n) is a solution of the Homogeneous equation related to (**) (obtained by (ignoring n (n)). What is the “General Solution” of a DFE? It’s a family of functions, usually characterized by a parameter(s) which can take on different values.
Background image of page 2
S. Tanny MAT 344 Spring 1999 74 From the above, the general solution for (**) is just the general solution to the related HOMO equation plus any particular solution to the NON-HOMO equation (**), i.e. S NH (n) = S H (n) + S p (n) where S p (n) is any solution of (**), S H (n) is general solution of related HOMO and S NH (n) is general solution of (**) Solving HOMO (i) First Order DFE Suppose Y n + 1 + a 1 Y n = 0 (k = 1) Then Y n + 1 = -a 1 Y n = (-1) 2 a 1 2 Y n - 1 = = (-1) n a 1 n Y 1 = (-a 1 ) n + 1 Y 0 where Y
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 11

week5 - S. Tanny Recurrence Relations Tower of Hanoi Let Tn...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online