SLIDE 1
cse 311: foundations of computing Fall 2015 Lecture 17: Strong - - PowerPoint PPT Presentation
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
SLIDE 2
SLIDE 3
review: strong induction
Follows from ordinary induction applied to 𝑅 𝑜 = 𝑄 0 𝑄 1 𝑄 2 ⋯ 𝑄(𝑜)
𝑄 0 ∀𝑙 𝑄 0 ∧ 𝑄 1 ∧ 𝑄 2 ∧ ⋯ ∧ 𝑄 𝑙 → 𝑄 𝑙 + 1 ∴ ∀𝑜 𝑄(𝑜)
SLIDE 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
SLIDE 5
Fibonacci numbers
𝑔
0 = 0
𝑔
1 = 1
𝑔
𝑜 = 𝑔 𝑜−1 + 𝑔 𝑜−2 for all 𝑜 ≥ 2
SLIDE 6
Fibonacci rabbits
SLIDE 7
bounding the Fibonacci numbers
Theorem: 𝑔
𝑜 < 2𝑜 for all 𝑜 ≥ 2
SLIDE 8
bounding the Fibonacci numbers
Theorem: 2
𝑜 2−1 ≤ 𝑔
𝑜 < 2𝑜 for all 𝑜 ≥ 2
SLIDE 9
f0 = 0; f1 = 1; fn = fn-1 + fn-2 for all 𝑜 ≥ 2
Theorem: 2n/2-1 fn < 2n for all 𝑜 ≥ 2
Proof:
- 1. Let P(n) be “2n/2-1 fn < 2n. By (strong) induction we prove P(n) for all n ≥ 2.
2. Base Case: P(2) is true: f2=1, 22/2-1=20=1 f2, 22=4>f2 3. Ind.Hyp: Assume 2j/2-1 fj < 2j for all integers j with 2 j k for for some arbitrary integer k ≥ 2. 4.
- Ind. Step: Goal: Show 2(k+1)/2-1 fk+1 < 2k+1
Case k=2: P(3) is true: f3=f2+f1=1+1=2, 23/2-1=21/2 2 = f3, 23=8 > f3 Case k≥3:
fk+1 = fk + fk-1 2k/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 fk+1 = fk + fk-1 < 2k + 2(k-1) by I.H. since k-1 ≥ 2 < 2k + 2k = 2∙2k = 2k+1
SLIDE 10
the divisibility theorem
Theorem: For any integers 𝑜 and 𝑒 ≥ 0, there are integers 𝑟 and 𝑠 such that 𝑜 = 𝑒𝑟 + 𝑠 and 0 ≤ 𝑠 ≤ 𝑒 − 1.
SLIDE 11
running time of Euclid’s algorithm
SLIDE 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
⋮