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 Monday/Wednesday Closed book. One page (front and back) of notes allowed. Exam includes induction! Homework #5 is due on Friday, Nov 13 th .
review: strong induction 𝑄 0 ∀𝑙 𝑄 0 ∧ 𝑄 1 ∧ 𝑄 2 ∧ ⋯ ∧ 𝑄 𝑙 → 𝑄 𝑙 + 1 ∴ ∀𝑜 𝑄(𝑜) Follows from ordinary induction applied to 𝑅 𝑜 = 𝑄 0 𝑄 1 𝑄 2 ⋯ 𝑄(𝑜)
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
Fibonacci numbers 𝑔 0 = 0 𝑔 1 = 1 𝑜−2 for all 𝑜 ≥ 2 𝑔 𝑜 = 𝑔 𝑜−1 + 𝑔
Fibonacci rabbits
bounding the Fibonacci numbers 𝑜 < 2 𝑜 for all 𝑜 ≥ 2 Theorem: 𝑔
bounding the Fibonacci numbers 𝑜 𝑜 < 2 𝑜 for all 𝑜 ≥ 2 2 −1 ≤ 𝑔 Theorem: 2
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
the divisibility theorem Theorem: For any integers 𝑜 and 𝑒 ≥ 0 , there are integers 𝑟 and 𝑠 such that 𝑜 = 𝑒𝑟 + 𝑠 and 0 ≤ 𝑠 ≤ 𝑒 − 1.
running time of Euclid’s algorithm
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