Mohamed G. Gouda CS 313K Summer 2013 Midterm 3 One Hour 1) Let A and B be two sets. Prove by direct inference the following 2 predicates: (A^B = A) => (A sub B) (AvB = B) => (A sub B) Sol: Proving the first predicate: (x in A) => {A^B = A} (x in A^B) => {definition of "^"} (x in A) and (x in B) => {definition of "and"} (x in B) Proving the second predicate: (x in A) => {definition of "or"} (x in A) or (x in B) => {definition of "v"} (x in AvB) => {AvB = B} (x in B) 2) Let A and B be two sets. Prove by indirect inference the following predicate: (AvB = A^B) => A=B Sol: A != B => {definition of "!="} Exist x, (x in A) and (not (x in B)) => {definition of "v" and "^"} Exist x, (x in AvB) and (not (x in A^B)) => {definition of "!="} AvB != A^B 3) Let f(x) = x^3-5 be a function whose domain is the set of all integers, and whose codomain is the set range(f). Prove that function f has an inverse function f'. Define function f' and define its domain codomain, and range. Sol: Function f has an inverse function f' because f is both surjective (since the codomain of f is range(f)) and injective (according to the following proof): f(x1) = f(x2) => {definition of f} (x1)^3-5 = (x2)^3-5 => {arithmetics} (x1)^3 = (x2)^3 => {arithmetics} x1 = x2 The inverse function f' is defined as follows: f'(x) = cube root of (x + 5) The Domain of f' is the set range(f). The codomain of f' is the set of all integers. The range of f' is the set of all integers. 4) Let f1, f2, f3 be the following 3 functions whose domains and codomains are the set of all real numbers whose values are at least 1. f1(x) = sqrt(x+1) f2(x) = max(x-1, 1) f3(x) = x^2 Derive the composite function (f1.(f2.f3))(x) and simplify it as much as possible. Sol: (f1.(f2.f3))(x) = f1(f2(f3(x))) = f1(f2(x^2)) = f1(max(x^2-1, 1)) = sqrt((max(x^2-1, 1))+1) = sqrt((max(x^2, 2))) = max(sqrt(x^2), sqrt(2)) = max(x, sqrt(2))