Given a function $f: \mathbf{N}_0 \to \mathbf{N}_0$, defined $$ f(x) = \begin{cases} x+3 & \text{if } x \in \mathbf{N}_{\text{even}} \\ x-1 & \text{if } x \in \mathbf{N}_{\text{odd}} \end{cases} $$
I have to prove that the function is surjective.
My attempt:
Take any y ∈ N even
f(x)=y ⇒ x+3=y ⇒ x=y-3
Note x=y-3 ∈ N even and
f(x)=f(y-3)=y-3+3=y
Take any y ∈ N odd
f(x)=y ⇒ x-1=y ⇒ x=y+1
Note x=y+1 ∈ N odd and
f(x)=f(y+1)=y+1-1=y
This shows that f is surjective.
The function $f$ is not surjective: there is no $n\in\mathbb N_0$ such that $f(n)=1$.