You are on page 1of 9

CS 205 Quiz #5B Oct 18, 2012

NAME: ___________________________SOLUTIONS_____________________________________

RUID:___________________________________________________________________________

Electronic Devices are not permitted during the quiz. These include but are not restricted to calculators, computers and cell phones. No communication between students or anyone outside of class is permitted during the quiz. Textbooks, notes and any other written materials are not permitted during the quiz.

DO NOT OPEN UNTIL INSTRUCTED TO DO SO

1. Do the following relations satisfy the definitions of the listed terms? For each blank, write True if the relation satisfies the definition, False if it does not satisfy the definition or Insufficient if there is not enough information to conclude if the relation satisfies the definition. a) f(x) = 1 / x , where f : Z+ R 1 point each blank

______True_________

Function

______True_________

Injective Function

______False_________ Surjective Function ______False_________ Invertible Function

______False_________ Bijective Function

______False_________ Partial Function (not a Total Function) Not a surjection. For example, 2 is never reached in the codomain. b) f(x) = 1 / x , where f : Z+ { a R | 0 < a 1 }

______True_________

Function

______True_________

Injective Function

______False_________ Surjective Function ______False_________ Invertible Function

______False_________ Bijective Function

______False_________ Partial Function (not a Total Function) Not a surjection because R contains the irrational numbers, which cannot be reached. c) f(x) = x!, where f : Z+ Z+

______True_________

Function

______True_________

Injective Function

______False_________ Surjective Function ______False_________ Invertible Function Not a surjection. For example, 3 is unreachable. d) f(x) = lg x, where f : Z R

______False_________ Bijective Function ______False_________ Partial Function (not a Total Function)

______False_________ Function ______False_________ Surjective Function ______False_________ Invertible Function

______ False________

Injective Function

______False_________ Bijective Function ______True_________

Partial Function (not a Total Function) lg is undefined for zero or negative numbers (unless imaginary numbers were in the codomain)

1. cont) e) f(x) = x / (x2 3), where f : Z Z

______True_________

Function

______False_________ Injective Function ______False_________ Bijective Function

______False_________ Surjective Function ______False_________ Invertible Function

f)

______False_________ Partial Function (not a Total Function) Since the domain is integers and 3 is not a perfect square, we do not have a divide by zero problem. The function is not injective because f(-1) = f(3). Since the denominator grows faster than the numerator, we know it converges to zero. The maximum value reached in the domain is 2, so we know it is not reaching values beyond 2, thus it not surjective. Note that a change in the domain and codomain to reals would change the answers. f(m, n) = m mod n, where f : Z+ Z+ Z+

______True_________ ______True_________

Function Surjective Function

______False_________ Injective Function ______False_________ Bijective Function ______False_________ Partial Function (not a Total Function)

______False_________ Invertible Function

f(m, m+1) = m mod m+1 = m, so every positive integer can be reached making it surjective The combination of Partial Function: True, Function: False, Surjective Function: False is also accepted because the codomain is not appropriate here. It should be N, not Z+. g) f(m, n) = m / n, where f : R R R

______True_________ ______ False________

Function Surjective Function

______False_________ Injective Function ______False_________ Bijective Function ______ True________ Partial Function (not a Total Function)

______False_________ Invertible Function

f(m, 0) = m / 0 = Undefined, so not a function

1. cont) h) f(m, n) = m + n, where f : R R Z

______True_________ ______True_________

Function Surjective Function

______False_________ Injective Function ______False_________ Bijective Function

______False_________ Invertible Function

______False_________ Partial Function (not a Total Function) f(m, 0) = m + 0 = m, so every integer can be reached making it surjective

2. For each of the following, you are given some amount of information regarding a relation. The task is to determine if the relation is invertible. In each blank write True if the corresponding relation is invertible, False if it is not invertible, or Insufficient if there is not enough information to determine whether or not it is invertible. 3 points each blank _____True_________ a) A bijective function from the domain of all integers to the codomain of all integers. The relation is also an injective function. If it is bijective, then we know it is invertible. _____False_________ b) A function from the domain of all natural numbers less than 1000 to the codomain of the positive integers less than 1000. The domain is one number larger than the codomain, so we know the function cannot be injective. _____Insufficient____ c) A partial function from the domain of all natural numbers less than 1000 to the codomain of the positive integers less than 1000. Since it is a partial function, it is conceivable to make the relation both injective and surjective. _____Insufficient____ d) An increasing function. We cannot tell if it is injective or surjective. _____False_________ e) A surjective function that is not injective. The functions domain and codomain are both the positive integers. It must be injective to be invertable. _____True_________ f) A relation g from A to B, where: a A, g(a) = b such that b B (a1, a2) A A, a1 a2 g(a1) g(a2) b B, a A such that g(a) = b The first bullet means it is a function. The second bullet means it is injective. The third bullet means it is surjective. _____False_________ g) A relation h from A to B, where A = { -2, -1, 0, 1, 2 } B = { -4, -1, 0, 1, 4 } h(x) = x2 This is not a surjection because -4 and -1 in the codomain have no preimage.

2. cont) _____Insufficient____ h) A function where every unique element in the domain has a unique image. This is injective, but we do not know if it is surjective. That is, we do not know if every element in the codomain has a preimage.

_____Insufficient____

i)

An injective function where both the domain and codomain are the positive integers. We also need to know if it is surjective.

_____False_________

j)

The relation, f, from the set of U.S. states to the number of nonwhitespace characters in its name. (i.e. f(New Jersey) = 9, f(Ohio) = 4, etc.). The codomain is the positive integers less than or equal to 50. f(Ohio) = f(Iowa), so it is not injective. It is also not surjective because there is no state with 50 characters in its name.

3. For each of the following sets of tuples, determine if there exists a functional dependency between the first and second elements. That is: i. If R = {(a1,b1), (a2,b2), ... }, does R = {(x, f(x)) | x {a1, a2, ...} } for some function f ?

We can also say there is an inverse functional dependency if there is a functional dependency between the first and second elements as well as an inverse for that same function. That is: ii. Using R and f from (i) above, does R = {(f-1(y), y) | y {b1, b2, ...} } ?

Answer True in blanks where the corresponding definition is met, otherwise answer False. 2 points each blank a) { (1,2), (2,3), (3,4), (4,1) }

______True______

Functional Dependency

Inverse Functional ______True_______ Dependency

b) { (1,1), (1,2), (2,2), (3,3) } Inverse Functional _____False_______ Dependency

_____False_______ Functional Dependency c) { (1,1) }

______True______

Functional Dependency

Inverse Functional ______True_______ Dependency

d) { (1,2), (2,2), (3,3), (4,3) } Inverse Functional _____False_______ Dependency

______True_______ Functional Dependency

4. Let f be a function from A to B. Let S be a subset of B. We define the inverse image as F-1(S) = { a A | f(a) S } 4 points possible for each Answer the following questions. Example: If f: R R and f(x) = x2, what is F-1({ y R | 0 < y < 1 }) ? Answer: { a R | -1 < a < 0 0 < a < 1 } a) If f : R R and f(x) = |x|, what is F-1( { 0, 1, 2 } ) ?

{ -2, -1, 0, 1, 2 }

b) If f : R R and f(x) = x4, what is F-1( { y R | y 16 } ) ?

{ a R | a -2 2 a }

c) If f : R Z and f(x) = x, what is F-1( { -3, -2, -1 } ) ?

{ a R | -4 < a -1 }

d) If f : Z+ N and f(x) = 3 mod x, what is F-1( { 0, 1, 3 } ) ?

Z+

( 3 mod 1 = 1, 3 mod 2 = 1, 3 mod 3 = 0, all others are 3 mod x = 3 )

e) If f : R R and f(x) = 1, what is F-1( { 1 } ) ?

( since every number goes to 1 )

5. Suppose we wish to define a function f: A B where A = { 1, 2, 3, 4, 5 } and B = { 6, 7, 8, 9, 10 }. (Note: If calculations are too difficult, you do not have to simplify to a single number.) 4 points each blank

________3125________ a) How many total functions are possible? 5 x 5 x 5 x 5 x 5 _________120________ b) How many injective functions are possible? 5 x 4 x 3 x 2 x 1 _________120________ c) How many surjective functions are possible? Since the domain and the codomain are the same size, this happens to be the same count as the number of injective functions

6. Provide a recursive function that will compute the total possible number of surjections when the domain is size m and the codomain is size n. 8 points possible (extra credit) ( ) {

( (

))

For a proof, see http://math.stackexchange.com/questions/138899/number-of-surjections-from-one-set-to-another

You might also like