Regard 0 (zero) as an even number and define f : N → N by
f(n) = \begin{cases} n + 1, & \text{if $n$ is even} \\ n -1, & \text{if $n$ is odd} \end{cases}
Prove that f is bijective
My solution:
(1) show that the function is injective:
f(n1)= f(y1)
n + 1 = y + 1
n = y
f(n2) = f(f2)
n - 1 = y - 1
n = y
Both functions n1 and n2 are injective
(2)Show that f is surjective:
function 1:
y = n1 + 1
y -1 = n1
function 2:
y = n2 -1
y -1 = n2
Is it correct till now? I am not sure about the next step Thank you.