cse 311 foundations of computing fall 2015 lecture 17

cse 311: foundations of computing Fall 2015 Lecture 17: Strong - PowerPoint PPT Presentation

cse 311: foundations of computing Fall 2015 Lecture 17: Strong induction & Recursive definitions administrative Midterm review session Sunday @ 1:00 pm (EEB 105) MIDTERM MONDAY (IN THIS ROOM, USUAL TIME) No office hours on


  1. cse 311: foundations of computing Fall 2015 Lecture 17: Strong induction & Recursive definitions

  2. administrative Midterm review session Sunday @ 1:00 pm (EEB 105) MIDTERM MONDAY (IN THIS ROOM, USUAL TIME) No office hours on Monday/Wednesday Closed book. One page (front and back) of notes allowed. Exam includes induction! Homework #5 is due on Friday, Nov 13 th .

  3. review: strong induction ๐‘„ 0 โˆ€๐‘™ ๐‘„ 0 โˆง ๐‘„ 1 โˆง ๐‘„ 2 โˆง โ‹ฏ โˆง ๐‘„ ๐‘™ โ†’ ๐‘„ ๐‘™ + 1 โˆด โˆ€๐‘œ ๐‘„(๐‘œ) Follows from ordinary induction applied to ๐‘… ๐‘œ = ๐‘„ 0 ๏ƒ™ ๐‘„ 1 ๏ƒ™ ๐‘„ 2 ๏ƒ™ โ‹ฏ ๏ƒ™ ๐‘„(๐‘œ)

  4. review: strong induction English proof 1. By induction we will show that ๐‘„(๐‘œ) is true for every ๐‘œ โ‰ฅ 0 2. Base Case: Prove ๐‘„(0) 3. Inductive Hypothesis: Assume that for some arbitrary integer ๐‘™ โ‰ฅ 0 , ๐‘„(๐‘˜) is true for every ๐‘˜ from 0 to ๐‘™ 4. Inductive Step: Prove that ๐‘„(๐‘™ + 1) is true using the Inductive Hypothesis (that ๐‘„(๐‘˜) is true for all values ๏‚ฃ ๐‘™ ) 5. Conclusion: Result follows by induction

  5. Fibonacci numbers ๐‘” 0 = 0 ๐‘” 1 = 1 ๐‘œโˆ’2 for all ๐‘œ โ‰ฅ 2 ๐‘” ๐‘œ = ๐‘” ๐‘œโˆ’1 + ๐‘”

  6. Fibonacci rabbits

  7. bounding the Fibonacci numbers ๐‘œ < 2 ๐‘œ for all ๐‘œ โ‰ฅ 2 Theorem: ๐‘”

  8. bounding the Fibonacci numbers ๐‘œ ๐‘œ < 2 ๐‘œ for all ๐‘œ โ‰ฅ 2 2 โˆ’1 โ‰ค ๐‘” Theorem: 2

  9. f 0 = 0; f 1 = 1; f n = f n-1 + f n-2 for all ๐‘œ โ‰ฅ 2 Theorem: 2 n/2-1 ๏‚ฃ f n < 2 n for all ๐‘œ โ‰ฅ 2 Proof : 1. Let P(n) be โ€œ2 n/2-1 ๏‚ฃ f n < 2 n . By (strong) induction we prove P(n) for all n โ‰ฅ 2. Base Case: P(2) is true: f 2 =1, 2 2/2-1 =2 0 =1 ๏‚ฃ f 2 , 2 2 =4>f 2 2. Ind.Hyp: Assume 2 j/2-1 ๏‚ฃ f j < 2 j for all integers j with 2 ๏‚ฃ j ๏‚ฃ k for for some 3. arbitrary integer k โ‰ฅ 2. Ind. Step: Goal: Show 2 (k+1)/2-1 ๏‚ฃ f k+1 < 2 k+1 4. Case k=2: P(3) is true: f 3 =f 2 +f 1 =1+1=2, 2 3/2-1 =2 1/2 ๏‚ฃ 2 = f 3 , 2 3 =8 > f 3 Case kโ‰ฅ3: f k+1 = f k + f k-1 ๏‚ณ 2 k/2-1 + 2 (k-1)/2 โ€“ 1 by I.H. since k- 1 โ‰ฅ 2 > 2 (k-1)/2-1 + 2 (k-1)/2 โ€“ 1 = 2 โˆ™ 2 (k-1)/2-1 = 2 (k+1)/2 โ€“ 1 f k+1 = f k + f k-1 < 2 k + 2 (k-1) by I.H. since k- 1 โ‰ฅ 2 < 2 k + 2 k = 2 โˆ™ 2 k = 2 k+1

  10. the divisibility theorem Theorem: For any integers ๐‘œ and ๐‘’ โ‰ฅ 0 , there are integers ๐‘Ÿ and ๐‘  such that ๐‘œ = ๐‘’๐‘Ÿ + ๐‘  and 0 โ‰ค ๐‘  โ‰ค ๐‘’ โˆ’ 1.

  11. running time of Euclidโ€™s algorithm

  12. running time of Euclidโ€™s algorithm Theorem : Suppose that Euclidโ€™s algorithm takes ๐‘œ steps for gcd(๐‘, ๐‘) with ๐‘ > ๐‘ , then ๐‘ โ‰ฅ ๐‘” ๐‘œ+1 . Proof: Set ๐‘  ๐‘œ+1 = ๐‘, ๐‘  ๐‘œ = ๐‘ then Euclidโ€™s algorithm computes ๐‘  ๐‘œ+1 = ๐‘Ÿ ๐‘œ ๐‘  ๐‘œ + ๐‘  ๐‘œโˆ’1 ๐‘  = ๐‘Ÿ ๐‘œโˆ’1 ๐‘  ๐‘œโˆ’1 + ๐‘  ๐‘œ ๐‘œโˆ’2 each quotient ๐‘Ÿ ๐‘— โ‰ฅ 1 ๐‘  1 โ‰ฅ 1 โ‹ฎ ๐‘  3 = ๐‘Ÿ 2 ๐‘  2 + ๐‘  1 ๐‘  2 = ๐‘Ÿ 1 ๐‘  1

Recommend


More recommend