The set Q of rational numbers is countable: that is, there is a bijection between Q and the set N of natural numbers.
Proof
By the Schröder-Bernstein theorem, it is enough to find an injection N→Q and an injection Q→N.
The former is easy, because N is a subset of Q so the identity injection n↦n1 works.
For the latter, we may define a function Q→N as follows. Take any rational in its lowest terms, as pq, say. %%note:That is, the GCD of the numerator p and denominator q is 1.%% At most one of p and q is negative (if both are negative, we may just cancel −1 from the top and bottom of the fraction); by multiplying by −1−1 if necessary, assume without loss of generality that q is positive. If p=0 then take q=1.
Define s to be 1 if p is positive, and 2 if p is negative.
Then produce the natural number 2p3q5s.
The function f:pq↦2p3q5s is injective, because prime factorisations are unique so if f(pq)=f(ab) (with both fractions in their lowest terms, and q positive) then |p|=|a|,q=b and the sign of p is equal to the sign of a. Hence the two fractions were the same after all.