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