# Rational Numbers are Countably Infinite

## Theorem

The set $\Q$ of rational numbers is countably infinite.

## Proof 1

The rational numbers are arranged thus:

$\dfrac 0 1, \dfrac 1 1, \dfrac {-1} 1, \dfrac 1 2, \dfrac {-1} 2, \dfrac 2 1, \dfrac {-2} 1, \dfrac 1 3, \dfrac 2 3, \dfrac {-1} 3, \dfrac {-2} 3, \dfrac 3 1, \dfrac 3 2, \dfrac {-3} 1, \dfrac {-3} 2, \dfrac 1 4, \dfrac 3 4, \dfrac {-1} 4, \dfrac {-3} 4, \dfrac 4 1, \dfrac 4 3, \dfrac {-4} 1, \dfrac {-4} 3 \ldots$

It is clear that every rational number will appear somewhere in this list.

Thus it is possible to set up a bijection between each rational number and its position in the list, which is an element of $\N$.

$\blacksquare$

## Proof 2

Let us define the mapping $\phi: \Q \to \Z \times \N$ as follows:

$\forall \dfrac p q \in \Q: \phi \left({\dfrac p q}\right) = \left({p, q}\right)$

where $\dfrac p q$ is in canonical form.

Then $\phi$ is clearly injective.

From Cartesian Product of Countable Sets is Countable‎, we have that $\Z \times \N$ is countably infinite.

The result follows directly from Domain of Injection to Countable Set is Countable‎.

$\blacksquare$

## Proof 3

For each $n \in \N$, define $S_n$ to be the set:

$S_n := \left\{{\dfrac m n: m \in \Z}\right\}$

By Integers are Countably Infinite, each $S_n$ is countably infinite.

Because each rational number can be written down with a positive denominator, it follows that:

$\forall q \in \Q: \exists n \in \N: q \in S_n$

which is to say:

$\displaystyle \bigcup_{n \mathop \in \N} S_n = \Q$

By Countable Union of Countable Sets is Countable, it follows that $\Q$ is countable.

Since $\Q$ is manifestly infinite, it is countably infinite.

$\blacksquare$

## Proof 4

Let $Q_\pm = \set {q \in \Q: \pm q > 0}$.

For every $q \in Q_+$, there exists at least one pair $\tuple {m, n} \in \N \times \N$ such that $q = \dfrac m n$.

Therefore, we can find an injection $i: Q_+ \to \N \times \N$.

By Cartesian Product of Natural Numbers with Itself is Countable, $\N \times \N$ is countable.

Hence $Q_+$ is countable, by Domain of Injection to Countable Set is Countable.

The map $-: q \mapsto -q$ provides a bijection from $Q_-$ to $Q_+$, hence $Q_-$ is also countable.

Hence $\Q$ is countable.

$\blacksquare$