Exercise 128 Here are two important denitions related to a f
 Exercise 1.2.8. Here are two important denitions related to a function f : A  B. The function f
 is one-to-one (1–1) if a1 I= a2 in A implies that f (a1) I= f (a2) in B. The function f is onto if,
 given any b  B, it is possible to nd an element a  A for which f (a) = b.
 Give an example of each or state that the request is impossible:
(a) f : N N that is 1–1 but not onto.
(b) f : N N that is onto but not 1–1.
(c) f : N Z that is 1–1 and onto.
Solution
a)
f(n)=n+1 is 1-1 but not onto
It is not onto because there no natural number n so that
f(n)=n+1=1
b)
f(1)=1
f(2)=1
f(n)=n-1 for n>2
This is onto but clearly not 1-1 as f(1)=f(2)=1
c)
f(n)=(n-1)/2 for n odd
f(n)=-n/2 for n even
Check for onto
Case 1. z<0
f(-2z)=z
Case 2.
z>=0
f(2z+1)=z
Hence, f is onto

