# Math Help - Z and Q are countable

1. ## Z and Q are countable

I'm reading the text about the proof of Z and Q are countable.

The proof reads:

$\mathbb {Z}$ is the union of the countable sets $\mathbb {N} \ , \ \{ -n : n \in \mathbb {N} \} \ , \ \{ 0 \}$, and one can define a surjection $f: \mathbb {Z} ^2 \rightarrow \mathbb {Q}$ by $f(m,n) = \frac {m}{n}$ if $n \neq 0$ and $f(m,0) = 0$

End of proof.

I understand that basically the system of Z and Q are equivalent, so if Z is countable so is Q, but where in the proof did it show that there exist an injection from Z to the set of natural numbers? Thanks.

2. Originally Posted by tttcomrader
I understand that basically the system of Z and Q are equivalent, so if Z is countable so is Q, but where in the proof did it show that there exist an injection from Z to the set of natural numbers? Thanks.
$f:\mathbb{Z} \mapsto \mathbb{N}\;,\,f(n) = \left\{ {\begin{array}{rl}
{2n,} & {n \geqslant 0} \\
{2\left| n \right| + 1,} & {n < 0} \\

\end{array} } \right.$

3. There's a theorem to the effect that the union of a countable number of countable sets is itself countable:

Union of Countable Sets - ProofWiki