1. ## Denumerable Set

My book shows that the set of integers, $\mathbb{Z},$ is denumerable by expressing the elements of the set as infinite sequence

$\mathbb{Z}=\{0, 1,-1,2,-2,...\}$, and then shows that the function

$f: \mathbb{N}\rightarrow \mathbb{Z}$ is bijective, where

$f$ is defined as

$f(n)=\frac{1+(-1)^n(2n-1)}{4}$

The picture shows that there is one-one correspondence, such as this:

$1 \rightarrow 0$

$1 \rightarrow 1$

$2 \rightarrow -1$

$3 \rightarrow 2$

$4 \rightarrow -2$

.
.
.

Now I want to prove that $f(n)=\frac{1+(-1)^n(2n-1)}{4}$ bijective, but $(-1)^n$ in the expression is making it very clumsy.

To prove the one-to-one isn't too bad, since $f(a_1)=f(a_2)$ seems to look clean, but now when I get to the part where I need to prove it an onto function, I got a huge mess, so I am wondering whether it be alright to split the proof in two parts such that

$f(n) = g(s) \cup h(t)$ and define $g(s) \subset \mathbb{Z}^-$ and $h(t) \subset \mathbb{Z}^+$ and by so doing, I plan to prove that

there exists an odd positive integer $p\in \mathbb{N}$ such that $g(s)=\frac{1+(-1)^s(2s-1)}{4}$ where $s=2n-1, n \in \mathbb{N}$

and there also exists an even positive integer $q\in \mathbb{N}$ such that $h(t)=\frac{1+(-1)^t(2t-1)}{4}$ where $t=2n, n \in \mathbb{N}$

Questions:

1. Is there a simpler way than to prove the onto-function in two parts?

2. Is there a better way with handling $(-1)^n$ expression ?

2. If $x=0$ then $f(1)=0$.
If $x>0$ then $f(2x)=x$.
If $x<0$ then $f(2|x|+1)=x$.
So it is onto.