SLIDE 1
cse 311: foundations of computing Spring 2015 Lecture 17: - - PowerPoint PPT Presentation
cse 311: foundations of computing Spring 2015 Lecture 17: - - PowerPoint PPT Presentation
cse 311: foundations of computing Spring 2015 Lecture 17: Recursively defined sets administrative Midterm review session tonight @ 6pm (EEB 105) MIDTERM FRIDAY (IN THIS ROOM, USUAL TIME) Closed book. One page (front and back) of hand-written
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
review: every integer at least 2 is the product of primes We argue by strong induction. P(n) = โn can be expressed as a product of primesโ for n โฅ 2. Base Case: Note that 2 is prime; so, we can express it as โ2โ which is a product of primes. Induction Hypothesis: Suppose P(2) โง P(3) โง ใปใปใป โง P(k) is true for some k โฅ 2. Induction Step: We go by cases. Suppose k+1 is prime. Then, โk+1โ is a product of primes. Suppose k+1 is composite. Then, k+1 = ab for some a and b such that 1 < a, b < k+1. By our IH, we know a = p1p2 โฏ pm and b = q1q2 โฏ qn. So, k+1 = ab = โp1p2 โฏ pmq1q2 โฏ qnโ, which is a product of primes. Thus, our claim is true for n โฅ 2 by strong induction.
SLIDE 6
review: recursive definition of functions
- ๐บ(0) = 0; ๐บ(๐ + 1) = ๐บ(๐) + 1 for all ๐ โฅ 0
- ๐ป 0 = 1; ๐ป ๐ + 1 = 2 ร ๐ป(๐) for all ๐ โฅ 0
- 0! = 1;
๐ + 1 ! = ๐ + 1 ร ๐! for all ๐ โฅ 0
- ๐ผ(0) = 1; ๐ผ(๐ + 1) = 2๐ผ ๐ for all ๐ โฅ 0
SLIDE 7
review: Fibonacci numbers
๐
0 = 0
๐
1 = 1
๐
๐ = ๐ ๐โ1 + ๐ ๐โ2 for all ๐ โฅ 2
SLIDE 8
review: bounding the Fibonacci numbers Theorem: ๐
๐ < 2๐ for all ๐ โฅ 2.
SLIDE 9
bounding the Fibonacci numbers
Theorem: 2
๐ 2โ1 โค ๐
๐ < 2๐ for all ๐ โฅ 2
SLIDE 10
running time of Euclidโs algorithm
SLIDE 11
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
โฎ