------------------------------------------------------------------------------ Mohamed G. Gouda CS 311 Spring 2015 Homework 3 ------------------------------------------------------------------------------ 1. (2.5 points) Use a by-contradiction proof to prove the predicate: (A sub c(B)) => ((A^B) = { }) ------------------------------------------------------------------------------- 2. (2.5 points) Let A and B be two finite and nonempty sets and let f:A->B be a function. (a) Given that f is injective, which of the two integers |A| and |B| is larger. Explain your answer. (b) Given that f is surjective, which of the two integers |A| and |B| is larger. Explain your answer. (c) Given that f is bijective, which of the two integers |A| and |B| is larger. Explain your answer. ------------------------------------------------------------------------------- 3. (2.5 points) Derive the closed equation for the following recurrence equation: R(0) = 3 R(1) = 5 R(n+2) = -R(n+1) + 6R(n) ------------------------------------------------------------------------------- 4. (2.5 points) Show by direct inference that (f(n) = n^3 - 5((n)^2)) is Omega(g(n)) where (g(n) = n^3). ------------------------------------------------------------------------------- Solutions ------------------------------------------------------------------------------- 1. (not((A^B) = { })) => {definition of { }} (Exist x, x in (A^B)) => {definition of ^} (Exist x, (x in A) and (x in B)) => {(A sub c(B))} (Exist x, (x in c(B)) and (x in B)) => {definition of c} (Exist x, not(x in B) and (x in B)) => {(not(P) and P => F} F --------------------------------------------------------------------------------- 2. (a) |A| =< |B|. Each element in A has a unique and distinct image in B (b) |A| >= |B|. Each element in A has a unique image in B and each element in B has at least one pre-image in A. (c) |A| = |B|. This case follows from (a) and (b). ----------------------------------------------------------------------------------- 3. The recurrence equation is R(0) = 3 (1) R(1) = 5 (2) R(n+2) = -R(n+1) + 6R(n) (3) From (3), the characteristic polynomial is r^2 = -r + 6 (r-2)(r+3) = 0 (4) From (4), the characteristic polynomial has two roots: r1 = 2 (5) r2 = -3 (6) The closed equation is R(n) = x*(r1)^n + y*(r2)^n (7) From (1), (2), (5), (6), and (7), we get x = 14/5 and y =1/5 (8) Thus, the closed equation is R(n) = (14/5)*(2^n) + (1/5)*((-3)^n) (9) ------------------------------------------------------------------------------------ 4. |f(n)| = |n^3 - 5*(n^2)| = (n^3 - 5*(n^2)) for n > 5 = (n^3)/2 + (n^3)/2 - 5*(n^2) >= (n^3)/2 for n >10 = (1/2) * (n^3) = C * |g(n)| for K=10 and C=(1/2) -