Give an example of a function
Question:

Give an example of a function
(i) which is one-one but not onto
(ii) which is not one-one but onto
(iii) which is neither one-one nor onto

Solution:

(i) which is one-one but not onto.

$f: Z \rightarrow Z$ given by $f(x)=3 x+2$

Injectivity:

Let $x$ and $y$ be any two elements in the domain $(Z)$, such that $f(x)=f(y)$.

$f(x)=f(y)$

$\Rightarrow 3 x+2=3 y+2$

$\Rightarrow 3 x=3 y$

$\Rightarrow x=y$

$\Rightarrow f(x)=f(y) \Rightarrow x=y$

So, f is one-one.

Surjectivity:

Let $y$ be any element in the co-domain $(Z)$, such that $f(x)=y$ for some element $x$ in $Z$ (domain).

$f(x)=y$

$\Rightarrow 3 x+2=y$

$\Rightarrow 3 x=y-2$

$\Rightarrow x=\frac{y-2}{3} .$ It may not be in the domain $(Z)$

because if we take $\mathrm{y}=3$,

$x=\frac{y-2}{3}=\frac{3-2}{3}=\frac{1}{3} \notin$ domain $Z$.

So, for every element in the co domain there need not be any element in the domain such that f(x) = y.
Thus, f is not onto.

(ii) which is not one-one but onto.

$f: Z \rightarrow N \cup\{0\}$ given by $f(x)=|x|$

Injectivity:

Let and y be any two elements in the domain (Z), such that f(x) = f(y).

$\Rightarrow|x|=|y|$

$\Rightarrow x=\pm y$

So, different elements of domain f may give the same image.
So, f is not one-one.

Surjectivity:

Let y be any element in the co domain (Z), such that f(x) = y for some element x in Z (domain).

$f(x)=y$

$\Rightarrow|x|=y$

$\Rightarrow x=\pm y$, which is an element in $Z$ (domain).

So, for every element in the co-domain, there exists a pre-image in the domain.
Thus, f is onto.

(iii) which is neither one-one nor onto.

$f: Z \rightarrow Z$ given by $f(x)=2 x^{2}+1$

Injectivity:

Let $x$ and $y$ be any two elements in the domain $(Z)$, such that $f(x)=f(y)$.

$f(x)=f(y)$

$\Rightarrow 2 x^{2}+1=2 y^{2}+1$

$\Rightarrow 2 x^{2}=2 y^{2}$

$\Rightarrow x^{2}=y^{2}$

$\Rightarrow x=\pm y$

So, different elements of domain f may give the same image.
Thus, f is not one-one.

Surjectivity:
Let y be any element in the co-domain (Z), such that f(x) = y for some element x in Z (domain).

$f(x)=y$

$\Rightarrow 2 x^{2}+1=y$

$\Rightarrow 2 x^{2}=y-1$

$\Rightarrow x^{2}=\frac{y-1}{2}$

$\Rightarrow x=\pm \sqrt{\frac{y-1}{2}}, \notin Z$ always

For example, if we take, $y=4$

$x=\pm \sqrt{\frac{y-1}{2}}=\pm \sqrt{\frac{4-1}{2}}=\pm \sqrt{\frac{3}{2}}, \notin \mathrm{Z}$

So, $x$ may not be in $Z$ (domain).

Thus, $f$ is not onto.