
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
SC/MATH 1019B - HOMEWORK 2 Discrete Math for Computer Science with Verified Solutions
Typology: Exams
1 / 1
This page cannot be seen from the preview
Don't miss anything!

Solutions to the problems below must be brought to class on October,23 2018. Solu- tions may by typed or neatly hand written. You must clearly indicate which problem you are solving. All solutions must be fully justified. # 1. (a) Given an example of a function f : N → N which is injective but not surjective. (a) Given an example of a function g : N → N which is surjective but not injective. An example of an injective but not surjective function is f : N → N by f ( n ) = n +5. If f ( n 1 ) = f ( n 2 ), then n 1 + 5 = n 2 + 5 and so n 1 = n 2. Therefore f is injective. To see that f is not surjective consider 1 ∈ N (the codomain). If f ( n ) = 1, then n + 5 = 1 and n = −4. However, − 4 /∈ N (the domain) so f is not surjective. An example of a surjective but not injective function is g : N → N by g ( n ) = [ n/ 2 ♩. Indeed for any n ∈ N (the codomain) take 2 n ∈ N (the domain) and g (2 n ) = n. The function g is not injective since g (2) = 1 = g (3) but 2 /= 3. # 2. Let A, B , and C be nonempty sets. Let f : A → B and g : B → C be functions. Show that if g ◦ f is one-to-one, then f must be one-to-one. Is it true that g must also be one-to-one? Let us use proof by contrapositive. Assume that f is not one-to-one. Then there exists a 1 , a 2 ∈ A with a 1 /= a 2 such that f ( a 1 ) = f ( a 2 ). This means ( g ◦ f )( a 1 ) = g ( f ( a 1 )) = g ( f ( a 2 )) = ( g ◦ f )( a 2 ) and g ◦ f is not one-to-one. To see an example where g ◦ f is one-to-one, but that g is not one-to-one tkae A = { 0 } , B = Z, and C = { 0 } with f (0) = 0 and g ( n ) = 0 for n ∈ Z. Then g is not one-to-one since g (0) = 0 = g (1), but g ◦ f : { 0 } → { 0 } is one-to-one. # 3. Solve the recurrence relation given by a 1 = 2 and an = 2 nan− 1 for n > 1. We claim that an = 2 nn !. Indeed a 1 = 2 = 21 1!. Assume that an = 2 nn! for some n ≥ 1, then an +1 = 2( n + 1) an = 2 n (2 nn !) = 2 n +1( n + 1)!. 1