[Math] Explicit Bijection from $\mathbb{N}$ to $\mathbb{Q}^+$.

elementary-set-theoryreal-analysis

Reading Bartle and Sherbert's intro to Real Analysis and going over denumerable sets. I know because of a diagonal procedure that this bijection exists, but I've been trying to find an explicit function $f:\mathbb{N}\rightarrow \mathbb{Q}^+$ and having difficulty. My thoughts were to incorporate triangular numbers somehow since each successive diagonal has one more term in it. Hints would be great here as I'm coming up empty…

Best Answer

One of the tries is a bijection $f:\mathbb N\to(0,1]\cap\mathbb Q$ where $f(0)=1$ and then if $f(n)=\frac{p_k}q$ for $\gcd(p_k,q)=1$ with $p_k<q-1$ then $f(n+1)=\frac{p_{k+1}}q$ for $\gcd(p_{k+1},q)=0$ and $p_{k+1}>p_k$ over the set of proper coprimes of $q$: $\{p_k\in\mathbb N: 0<p_k<q, \gcd(p_k,q)=1\}$, and if $f(n)=\frac{q-1}{q}$ then $f(n+1)=\frac{1}{q+1}$.

I don't quite remember but this injection of $\mathbb N\to(0,1]\cap\mathbb Q$ had a few direct formulas. And it was also surjective.

This injection can be extended for $g:\mathbb N\to\mathbb Q^+$ by $g(2k)=f(k)$ and $g(2k+1)=1/f(k)$.