1. Determine whether f is a function from R to N if f (x) = x No, negative integers are possible. 2. Determine whether g is a function from R to N if g(x) = x Yes. 3. Give the value of g(−2.2) −2.2
2 2
= −22 = 4
The next two should have been g(x) instead of f (x). 4. Is g(x) one-to-one? No. g(2.2) = g(2.4) 5. Is g(x) onto? Yes.
1
Homework 6
2. Determine whether each of these function is O(x2 ). To do this type of problem, try to alter each function so that it is either in the Cx2 form or is clearly less than a function in Cx2 form while only making it larger. a) f (x) = 17x + 11. Yes. 17x + 11 ≤ 17x + x = 18x ≤ 18x2 when x > 11. Here, C = 18 and k = 11. b) f (x) = x2 + 1000. Yes. x2 + 1000 ≤ x2 + x2 = 2x2 when x2 > 1000 or x > sqrt1000. C = 2, k = √ 1000
c) f (x) = x log x x2 isx ∗ x. x is larger than logx for all x. So, x log x ≤ x ∗ x = x2 C = 1, k = 0
2
d) f (x) = x4 /2 No. x4 is not comparable to x2 . There is no C such that x4 /2 ≤ Cx2 for large x. e) f (x) = 2x No. 2x grows really fast for large x. It is certainly not comparable to x2 .
f) f (x) = x ∗ x Yes.
x ∗ x ≤ 2x2
3
6. Show that (x3 + 2x)/(2x + 1) is O(x2 ) If we can alter this function so that it is in the Cx2 form while only making it larger, we show that it is O(x2 ) a) Remove the 1 from the denominator. Making the denominator of a fraction smaller will make the fraction larger. b) Change the 2x to 2x3 . Now we have (x3 + 2x)/2x c) So divide through by 2x to get f rac32x2 . The witnesses are C = 3/2 and k = 1.
4
8. Find the least integer n such that f (x) is O(xn ) for each of these functions. a) f (x) = 2x2 +x3 log x logx grows at a lesser rate than x, but it still grows without bound. So, this is not O(x3 ). The answer is 4. b) f (x) = 3 x5 +(log x)4 5 c) f (x) = (x4 +x2 + 1)/(x4 +1) The x4 terms are dominant here, as x increases this becomes closer to x4 x4 , or 1. So, the answer is 0. d) f (x) = (x3 + 5logx)/(x4 +1) At large x, this is close to