Let f : N → N be defined by

Question:

Let $f: \mathbf{N} \rightarrow \mathbf{N}$ be defined by

$f(n)=\left\{\begin{array}{l}n+1, \text { if } n \text { is odd } \\ n-1, \text { if } n \text { is even }\end{array}\right.$

Show that f is a bijection.                                [CBSE 2012, NCERT]

Solution:

We have,

$f(n)= \begin{cases}n+1, & \text { if } n \text { is odd } \\ n-1, & \text { if } n \text { is even }\end{cases}$

Injection test:

Case I: If $n$ is odd,

Let $x, y \in \mathbf{N}$ such that $f(x)=f(y)$

As, $f(x)=f(y)$

$\Rightarrow x+1=y+1$

$\Rightarrow x=y$

Case II : If $n$ is even,

Let $x, y \in \mathbf{N}$ such that $f(x)=f(y)$

As, $f(x)=f(y)$

$\Rightarrow x-1=y-1$

$\Rightarrow x=y$

So, $f$ is injective.

Surjection test :

Case I: If $n$ is odd,

As, for every $n \in \mathbf{N}$, there exists $y=n-1$ in $\mathbf{N}$ such that

$\mathrm{f}(y)=f(n-1)=n-1+1=n$

Case II : If $n$ is even,

As, for every $n \in \mathbf{N}$, there exists $y=n+1$ in $\mathbf{N}$ such that

$\mathrm{f}(y)=f(n+1)=n+1-1=n$

So, $f$ is surjective.

So, $f$ is a bijection.