CS 381 Solutins to Homework 12


Textbook pp. 152 - 154

2 (a) It is not a function because it is not single valued.
   (c) It is not a function because f(-2) and f(2) are not defined.

4 (b) Domain: The set of positive integers     Range: The set of natural numbers greater than 1.
   (c) Doamin: The set of binary numbers     Range: The set of natural numbers

12 (b) Not one-to-one because for example, 2 is mapped to by 1 and -1.
     (d) Not one-to-one because for example f(1) = f(2) = 1.

20 (a) f(x) = x2
     (c) f(x) = x + 1 if x is even and f(x) = x - 1 if x is odd.

22 (b) Not a bijection
     (c) R is not defined at x = -2. So it is not a function over R.

40(a) To prove f(S U T) = f(S) U f(T)
Claim 1: f(S U T) is a subset of f(S) U f(T).
Proof: If y is in f(S U T), then there is x in S U T such that y = f(x).
Hence x is in S or x is in T.
If x is in S, then y is in f(S). Hence y is in f(S) U f(T).
If x is in T, then y is in f(T). Hence y is in f(S) U f(T).
Hence f(S U T) is a subset of f(S) U f(T).

Claim 2: f(S) U f(T) is a subset of f(S U T).
Proof: If y is in f(S) U f(T), then y is in f(S) or y is in f(T).
If y is in f(S), then there is x in S such that y = f(x).
Hence x is in S U T. Hence y is in f(S U T).
Similarly for when y is in f(T).
Hence f(S) U f(T) is a subset of f(S U T).

By Claims 1 and 2 f(S U T) = f(S) U f(T).


Textbook pp. 216 - 217

2 (a) It is O(x2).
   (c) It is O(x2).
   (e) It is not O(x2).

8 (b) n = 5.

14 (d) Yes, x3 is O(x2 + x4).
    (e) Yes, x3 is O(3x).
    (f) Yes, x3/3 is O(x3).

26 (b) 6n (= 2n3n)
     (c) nnn!