cse 311 foundations of computing spring 2015 lecture 17
play

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


  1. cse 311: foundations of computing Spring 2015 Lecture 17: Recursively defined sets

  2. 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 .

  3. review: strong induction ๐‘„ 0 โˆ€๐‘™ ๐‘„ 0 โˆง ๐‘„ 1 โˆง ๐‘„ 2 โˆง โ‹ฏ โˆง ๐‘„ ๐‘™ โ†’ ๐‘„ ๐‘™ + 1 โˆด โˆ€๐‘œ ๐‘„(๐‘œ) Follows from ordinary induction applied to ๐‘… ๐‘œ = ๐‘„ 0 ๏ƒ™ ๐‘„ 1 ๏ƒ™ ๐‘„ 2 ๏ƒ™ โ‹ฏ ๏ƒ™ ๐‘„(๐‘œ)

  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

  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 = 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.

  6. 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

  7. review: Fibonacci numbers ๐‘” 0 = 0 ๐‘” 1 = 1 ๐‘œโˆ’2 for all ๐‘œ โ‰ฅ 2 ๐‘” ๐‘œ = ๐‘” ๐‘œโˆ’1 + ๐‘”

  8. review: bounding the Fibonacci numbers ๐‘œ < 2 ๐‘œ for all ๐‘œ โ‰ฅ 2. Theorem: ๐‘”

  9. bounding the Fibonacci numbers ๐‘œ ๐‘œ < 2 ๐‘œ for all ๐‘œ โ‰ฅ 2 2 โˆ’1 โ‰ค ๐‘” Theorem: 2

  10. running time of Euclidโ€™s algorithm

  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 each quotient ๐‘Ÿ ๐‘— โ‰ฅ 1 ๐‘  1 โ‰ฅ 1 โ‹ฎ ๐‘  3 = ๐‘Ÿ 2 ๐‘  2 + ๐‘  1 ๐‘  2 = ๐‘Ÿ 1 ๐‘  1

Recommend


More recommend