csc165 week 9
play

CSC165 Week 9 Larry Zhang, November 4, 2014 todays outline - PowerPoint PPT Presentation

CSC165 Week 9 Larry Zhang, November 4, 2014 todays outline exercises of big-Oh proofs prove big-Oh using limit techniques Recap definition of O(n) Beyond breakpoint B , cn f(n) is upper-bounded by cn , where c is some f(n)


  1. CSC165 Week 9 Larry Zhang, November 4, 2014

  2. today’s outline ➔ exercises of big-Oh proofs ➔ prove big-Oh using limit techniques

  3. Recap definition of O(n²) Beyond breakpoint B , cn² f(n) is upper-bounded by cn² , where c is some f(n) wisely chosen constant multiplier. B

  4. Notation of O(n²) being a set of functions functions that take in a natural number and return a non-negative real number beyond breakpoint B, f(n) is upper-bounded by cn² set of all red functions which satisfy the green.

  5. Prove thoughts: it’s all about picking c and B ➔ tip 1: c should probably be larger than 3 (the constant factor of the highest-order term) ➔ tip 2 : see what happens when n = 1 ➔ if n = 1 ◆ 3n² + 2n = 3 + 2 = 5 = 5n² ◆ so pick c = 5 , with B = 1 is probably good ◆ double check for n=2,3,4…, yeah it’s all good

  6. Proof # 3n²+2n ≥ 0 when n is natural number # 5 is a positive real # 1 is a natural number # generic natural number # the antecedent # 2n x 1 ≤ 2n x n since 1 ≤ n # c = 5 # transitivity of ≤ # introduce antecedent # introduce ∀ # introduce ∃ # by definition

  7. what if we add a constant? Prove thoughts: it’s all about picking c and B ➔ tip 1: c should probably be larger than 3 (the constant factor of the highest-order term) ➔ tip 2 : see what happens when n = 1 ➔ if n = 1 ◆ 3n² + 2n + 5 = 3 + 2 + 5 = 10 = 10n² ◆ so pick c = 10 , with B = 1 is probably good ◆ double check for n=2,3,4…, yeah it’s all good

  8. Prove large thoughts: ➔ assume n ≥ 1 ➔ upper-bound the left side by overestimating ➔ lower-bound the right side by underestimating ➔ choose a c that connects the two bounds small

  9. Proof # non-negative for n ≥ 0 # n ≥ B, the antecedent # -5n⁴ ≤ 0 # n³ ≤ n⁶ since n ≥ 1 # c = 9/2 # -n⁸ ≤ -n⁵ # 0 ≤ n²

  10. how about disproving?

  11. Prove ➔ first, negate it ➔ then, prove the negation

  12. Prove thoughts

  13. Proof: # definition of max # definition of max and ceiling # multiply both sides by n² > 0 # conjunction introduction # introduce ∃ # intro ∀ # definition of big-Oh

  14. summary ➔ the ways we talked about of picking c and B , the main point of them is that we know how to show the bounding relation when picking in these ways. ➔ these are not the only ways, you can be more flexible when you are more familiar with these types of proofs. ➔ In general, larger c or larger B don’t hurt.

  15. so far all functions we talked about are polynomials ➔ between polynomials, it is fairly easy to figure out who is big-Oh of whom ➔ simply look at the highest-degree term ➔ f(n) is in O(g(n)) exactly when the high- degree of f(n) is no larger than that of g(n)

  16. polynomials

  17. how about non-polynomials?

  18. but how do we prove it? ➔ we need to use a math tool, which we didn’t like a lot but studied anyway

  19. f(n) g(n) Intuition: ➔ if the ratio approaches infinity when n becomes larger and larger, that means f(n) grows faster than g(n)

  20. This is sort-of related more precisely to the definition of big-Oh… the ratio is give me I can find a beyond bigger than any big breakpoint which that big number number

  21. How to use limit to prove big-Oh General procedure 1. prove using “some calculus” 2. translate the limit into its definition with c and n’, i.e., 3. relate this definition to the definition of big-Oh, i.e., means

  22. http://mathworld.wolfram.com/LHospitalsRule.html Step 1. prove using “some calculus” “some calculus”: L’Hopital’s rule derivatives l’hopital l’hopital again!

  23. Step 2. translate the limit into its definition we have proven then by definition of limit the ratio is give me I can find a beyond bigger than any big breakpoint which that big number number

  24. Step 3. relate it to the definition of big-Oh what we have we have this awesome n’, all n ≥ n’ satisfy 2^n > cn² pick n = max(n’, B) wanna pick a wise n to satisfy both

  25. Proof: # generic c and B # applying L’hopital’s rule twice, (show the steps, omitted here) # definition of limit # definition of max # definition of max # definition the limit # conjunction introduction # intro ∃ # intro ∀ # negation of definition of big-Oh

  26. next week ➔ more proofs on O, Ω, Θ ➔ (maybe) computability

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend