Answer
a) $f(n)= n^2$
b) $f(n)= \lceil {n/2}\rceil$
c) $
f(n) = \left\{ {\begin{array}{*{20}{c}}
{\begin{array}{*{20}{c}}
{n - 1}&{\text{n is odd}}
\end{array}}\\
{\begin{array}{*{20}{c}}
{n + 1}&{\text{n is even}}
\end{array}}
\end{array}} \right.$
d) $f(n)= 0$
Work Step by Step
(a) For example: $f(n)= n^2$
The function f is one-to-one, because the squares of two different natural
numbers are never equal.
If $a \in {N}$ and $b \in N$: $f(a)= f(b)$
$\Rightarrow a^2 =b^2$
$\Rightarrow a= b$
The function f is not onto, because not every natural number is the square
of a natural number. For example, 2 is not a perfect square and 2 is not the image of any natural number.
b) For example: $f(n)= \lceil {n/2}\rceil$
The function f is not one-to-one, because there are different natural numbers that have the same image
$n =1$:$ \lceil{1/2}\rceil=\lceil{0.5}\rceil= 1$
$n =2$:$ \lceil{2/2}\rceil=\lceil{1}\rceil= 1$
The function f is onto, because every natural number $n \in N$ is the image
of $2n$
$f(2n)= \lceil{(2n)/2}\rceil= \lceil n\rceil =n$
(c) For example: $
f(n) = \left\{ {\begin{array}{*{20}{c}}
{\begin{array}{*{20}{c}}
{n - 1}&{\text{n is odd}}
\end{array}}\\
{\begin{array}{*{20}{c}}
{n + 1}&{\text{n is even}}
\end{array}}
\end{array}} \right.$
The function f is one-to-one, because $f(a)= f(b)$ implies $a+ 1= b+1$ when a and b are odd, and thus also $a=b$
while $f(a)=f(b)$ implies $a-1=b-1$ when a and b are even and thus also $a= b$.
(Note: $f(a)= f(b)$ is impossible when a is odd and b is even (or when b is odd and a is even)
$\forall a in N, \forall b \in N ;f(a) = f(b) \rightarrow a= b$
The function f is onto, because if m is even, then $f(m - 1)=m$is odd, and if m is odd, then $f(m+1)=m$
(d) For example: $f(n)= 0$
The function f is not one-to-one, because every integer has the same image.
The function f is not onto, because every positive integer is not the image
of any natural number