Is there a function $f : \mathbb Z \times \mathbb Z \to \mathbb Z$ that is one to one and onto? I know a function like this exists but I'm not able to find it.
It's not the same as g(x,y) = 2^{x-1} (2y-1) which is used to prove the same thing for naturals because here we want x to be a positive or negative integer. So that function can't be used.
 A: First, write a sequence with all the elements of $\Bbb Z\times \Bbb Z$:
$$(0,0),(1,0),(0,1),(-1,0),(0,-1),(2,0),(1,1),(0,2),(-2,0),(-1,-1),(0,-2),(1,-1),(-1,1),\ldots$$
Now do the same with $\Bbb Z$:
$$0,1,-1,2,-2,3,-3,\ldots$$
Finally just define a function that associates the first with the first, the second with the second, etc.
A: 
Have a look to the picture. From it you may be able to define the required map. Just need some computation. The map is very instructive to understand what happens.
A: There is a non-constructive proof from the Cantor-Schroder-Bernstein Theorem, because we can find one-to-one functions in both directions.
The hard direction is as follows.  Let $(m,n)\in\mathbb{Z}\times\mathbb{Z}$.  If $m,n\ge 0$, then map it to $2^m3^n$.  If $m<0,n\ge 0$, then map it to $5^m3^n$.  If $m\ge 0, n<0$, then map it to $2^m7^n$.  Lastly, if $m,n<0$, then map it to $5^m7^n$.
A: One way is to take $(a, b)$ to $$2^{\vert a \vert} 3^{\vert b \vert} 5^{\overline{\text{sgn}}(a)} 7^{\overline{\text{sgn}}(b)}$$ 
where $\overline{\text{sgn}}(a)$ is $1$ if $a>0$, $0$ if $a \leq 0$. Then biject those with the integers in alternating order, which we can now do easily because the image of the above map is well-ordered. $$1 \mapsto 0, 2 \mapsto 1, 3 \mapsto -1, 4 \mapsto 2, 5 \mapsto -2, \dots, 10 \mapsto f(10), 12 \mapsto f(12), \dots$$
