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 notes allowed. Exam includes induction and strong induction! Homework #5 is up now, but due on Friday, May 15 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
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 = p 1 p 2 โฏ p m and b = q 1 q 2 โฏ q n . So, k+1 = ab = โp 1 p 2 โฏ p m q 1 q 2 โฏ q n โ, which is a product of primes. Thus, our claim is true for n โฅ 2 by strong induction.
review: recursive definition of functions โข ๐บ(0) = 0; ๐บ(๐ + 1) = ๐บ(๐) + 1 for all ๐ โฅ 0 โข ๐ป 0 = 1; ๐ป ๐ + 1 = 2 ร ๐ป(๐) for all ๐ โฅ 0 ๐ + 1 ร ๐! for all ๐ โฅ 0 โข 0! = 1; ๐ + 1 ! = โข ๐ผ(0) = 1; ๐ผ(๐ + 1) = 2 ๐ผ ๐ for all ๐ โฅ 0
review: Fibonacci numbers ๐ 0 = 0 ๐ 1 = 1 ๐โ2 for all ๐ โฅ 2 ๐ ๐ = ๐ ๐โ1 + ๐
review: bounding the Fibonacci numbers ๐ < 2 ๐ for all ๐ โฅ 2. Theorem: ๐
bounding the Fibonacci numbers ๐ ๐ < 2 ๐ for all ๐ โฅ 2 2 โ1 โค ๐ Theorem: 2
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