------------------------------------------------------------------------------ Mohamed G. Gouda CS 311 Summer 2014 Midterm 3 ------------------------------------------------------------------------------ 1. (5 points) Let both sets A and B be the set {0}. Show that PS(A-B) =! (PS(A) - PS(B)) ----------------------------------------------------------------------------- 2. (5 points) Let f:A-->B and g:B-->C be two functions. Use direct inference to prove the predicate ((f is surjective) and (g is surjective)) => ((g.f) is surjective) ----------------------------------------------------------------------------- 3. (5 points) Which of the following functions, if any, is one-to-one and which of them, if any is surjective: (a) f(x) = (x + 2) (b) g(x) = (x^2 + 2) (c) h(x) = (x^3 + 2) Assume that the domains of these functions be the set of all integers. ---------------------------------------------------------------------------- 4. (5 points) Use direct inference to prove that the function f(n) = (n^4 - 2n) is Omega(g(n)) where g(n) = (n^4) ---------------------------------------------------------------------------- Solutions: ---------------------------------------------------------------------------- 1. PS(A-B) = {A=B} PS({}) = {definition of PS} {{}} =!{definition of a set} {} = {PS(A) = PS(B)} PS(A) - PS(B) ------------------------------------------------------------------------------ 2. (z in C) => {g is surjective} (Exist y in B, g(y)=z) => {f is surjective} (Exist x in A, Exist y in B, f(x)=y and g(y)=z) => {definition of (g.f)} (Exist x in A, Exist y in B, (g.f)(x)=z) => {qunatification Exist y in B is not needed} (Exist x in A, (g.f)(x)=z) ------------------------------------------------------------------------------- 3. Function f(x) = x+2 is one-to-one and onto Function g(x) = (x^2)+2 is neither one-to-one nor onto Function h(x) = (x^3)+2 is one-to-one but not onto ------------------------------------------------------------------------------- 4. |f(n)| = |n^4 - 2n| = (n^4 - 2n) for n > 2 = (n^4/2 + n^4/2 - 2n) >= (n^4/2) = 1/2 * |n^4| = C * |n^4| for C = 1/2 = C * |g(n)| for K = 2 and C = 1/2 -------------------------------------------------------------------------------