Example Exercise

Example 12
Show that \(f : \mathbb{N} \to \mathbb{N}\), given by
\[ f(x) = \begin{cases} x + 1, & \text{if } x \text{ is odd} \\ x - 1, & \text{if } x \text{ is even} \end{cases} \]
is both one-one and onto.