CMPSC360hw3soln - Homework 3 Solutions Note: These...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Homework 3 Solutions Note: These solutions are not necessarily model answers. Rather, they are designed to be tutorial in nature, and sometimes contain a little more explanation than an ideal solution. Also, bear in mind that there may be more than one correct solution. 1. A formula for the Fibonacci Numbers Base cases : For n = 0 the formula evaluates to zero, which is the correct value of F (0) . check . For n = 1 , the value of the formula is - (1- ) 5 = 2 - 1 5 = 2 1+ 5 2- 1 5 = 2 + 2 5- 2 2 5 = 1 = F (1) . check So both base cases are verified. Inductive hypothesis : Assume that the formula is valid for k n , where n 1 is arbitrary. (Note that we are using strong induction.) Induction step : We want to show that the formula is valid for n + 1 . To do this, we first notice two facts that follow from the definition of and that will be useful to us in the algebra below: (a) 1 + = 2 ; (b) (1- ) 2 = 1- 2 + 2 = 2- . Now, using the recursive definition of the Fibonacci sequence we have F ( n + 1) = F ( n ) + F ( n- 1) = n- (1- ) n 5 + n- 1- (1- ) n- 1 5 [by the inductive hypothesis] = 1 5 bracketleftbig n- 1 ( + 1)- (1- ) n- 1 (1- + 1) bracketrightbig = 1 5 bracketleftbig n- 1 ( + 1)- (1- ) n- 1 (2- ) bracketrightbig = 1 5 bracketleftbig n- 1 2- (1- ) n- 1 (1- ) 2 bracketrightbig [using (a) and (b) above] = 1 5 bracketleftbig n +1- (1- ) n +1 bracketrightbig . This completes the induction step, and thus we can conclude that the formula is valid for all n . 2. Strengthening the Induction Hypothesis First note that parenleftbigg a b c d parenrightbiggparenleftbigg 1 0 1 1 parenrightbigg = parenleftbigg a + b b c + d d parenrightbigg , so if we just try to use the inductive hypothesis that all the entries of the...
View Full Document

This note was uploaded on 10/08/2008 for the course CMPSC 360 taught by Professor Haullgren during the Fall '08 term at Pennsylvania State University, University Park.

Page1 / 4

CMPSC360hw3soln - Homework 3 Solutions Note: These...

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

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