------------------------------------------------------------------------------ Mohamed G. Gouda CS 311 Fall 2015 Midterm 3 ------------------------------------------------------------------------------ 1. (5 points) Prove by contradiction that the graph K3,4 is nonplanar. ------------------------------------------------------------------------------- 2. (5 points) Let A and B be two sets and let v and ^ denote the set operators of union and intersection. Prove the following predicate using a single 2-sided inference proof: (A = B) => (AvB) = (A^B) ------------------------------------------------------------------------------ 3. (5 points) Let A be the set {1, 2, 3, 4} and f:A->A be a function where f(1)=1 and f(2)=3. What are all the possible values of the pair f(3) and f(4) such that function f has an inverse. ----------------------------------------------------------------------------- 4. (5 points) Show by direct inference that the function f(n) = (n^3 - n^2) is Omega(g(n)) where g(n) = n^3. ---------------------------------------------------------------------------- Solutions ---------------------------------------------------------------------------- 1. (K3,4 = (V, E) is planar => {definition of K3,4 and region degrees of K3,4} (|V|=7 and |E|=12 and for every region r in K3,4, rdeg(r) = 4) => {Euler's Formula} |R| = (|E| - |V| + 2) = 7 => {Region Handshake Theorem} 28 = 4*|R| =< (Sum of rdeg(r)) =< 2*|E| =24 => {(28 =< 24) is false} F ----------------------------------------------------------------------------- 2. x in (AvB) <=> {definition of v} (x in A) or (x in B) <=> {definition of A=B} (x in A) or (x in A) <=> {(P or P) <=> P} (x in A) <=> {P <=> (P and P)} (x in A) and (x in A) <=> {definition of A=B} (x in A) and (x in B) <=> {definition of ^} x in (A^B) ----------------------------------------------------------------------------- 3. First possible value is f(3)=2 and f(4)=4. Second possible value is f(3)=4 and f(4)=2. Explanation: f needs to be both injective and surjective. Since f is injective, f(3) can't be 1 and can't be 3. Thus, f(3)=2 or f(3)=4. Since f is surjective and f(3)=2, we have f(4)=4. Since f is surjective and f(3)=4, we have f(4)=2. ----------------------------------------------------------------------------- 4. |f(n)| = |n^3 - n^2| = n^3 - n^2 for n > 1 = n^3/2 + n^3/2 - n^2 >= n^3/2 for n > 2 = (1/2)*|n^3| = C*|n^3| for C = 1/2 = C*|g(n)| for K=2 and C=(1/2) ----------------------------------------------------------------------------- ------------------------------------------------------------------------------ Mohamed G. Gouda CS 311 Fall 2015 Midterm 3 ------------------------------------------------------------------------------ 1. (5 points) Prove by contradiction that the graph K3,5 is nonplanar. ------------------------------------------------------------------------------- 2. (5 points) Let A and B be two sets and let v and ^ denote the set operators of union and intersection. Prove the following predicate using a single 2-sided inference proof: (A = B) => (AvB) = (A^B) ------------------------------------------------------------------------------ 3. (5 points) Let A be the set {1, 2, 3, 4} and f:A->A be a function where f(1)=1 and f(2)=3. What are all the possible values of the pair f(3) and f(4) such that function f has an inverse. ----------------------------------------------------------------------------- 4. (5 points) Show by direct inference that the function f(n) = (n^3 - n^2) is Omega(g(n)) where g(n) = n^3. ---------------------------------------------------------------------------- Solutions ---------------------------------------------------------------------------- 1. (K3,5 = (V, E) is planar => {definition of K3,5 and region degrees of K3,5} (|V|=8 and |E|=15 and for every region r in K3,5, rdeg(r) = 4) => {Euler's Formula} |R| = (|E| - |V| + 2) = 9 => {Region Handshake Theorem} 36 = 4*|R| =< (Sum of rdeg(r)) =< 2*|E| =30 => {(36 =< 30) is false} F ----------------------------------------------------------------------------- 2. x in (AvB) <=> {definition of v} (x in A) or (x in B) <=> {definition of A=B} (x in A) or (x in A) <=> {(P or P) <=> P} (x in A) <=> {P <=> (P and P)} (x in A) and (x in A) <=> {definition of A=B} (x in A) and (x in B) <=> {definition of ^} x in (A^B) ----------------------------------------------------------------------------- 3. First possible value is f(3)=2 and f(4)=4. Second possible value is f(3)=4 and f(4)=2. Explanation: f needs to be both injective and surjective. Since f is injective, f(3) can't be 1 and can't be 3. Thus, f(3)=2 or f(3)=4. Since f is surjective and f(3)=2, we have f(4)=4. Since f is surjective and f(3)=4, we have f(4)=2. ----------------------------------------------------------------------------- 4. |f(n)| = |n^3 - n^2| = n^3 - n^2 for n > 1 = n^3/2 + n^3/2 - n^2 >= n^3/2 for n > 2 = (1/2)*|n^3| = C*|n^3| for C = 1/2 = C*|g(n)| for K=2 and C=(1/2) -----------------------------------------------------------------------------