Example of a bijection from $\mathbb{N}$ to $\mathbb{N}$x$\mathbb{N}$

202 Views Asked by At

We know that the set of all ordered pairs of natural numbers, $\mathbb{N}$x$\mathbb{N}$ is countable. A very good example of a bijection $f$ from $\mathbb{N}$x$\mathbb{N}$ to $\mathbb{N}$ is $f(m,n) = 2^{m-1}(2n-1).$ I want a bijection in reverse direction $i.e$ from $\mathbb{N}$ to $\mathbb{N}$x$\mathbb{N},$ such that $\\$

$1 -> (1,1) \\$

$2 -> (1,2) \\$

$3 -> (2,1)\\$

$4 -> (3,1)$ etc.

1

There are 1 best solutions below

5
On

Generally, if $f:\mathbb N^2 \to \mathbb N$ is a bijection, it's inverse gives a bijection in the opposite direction : $f^{-1}:\mathbb N \to \mathbb N^{2}$.

Using your function $f(m,n) = 2^{m-1}(2n-1)$, we can write : $$f^{-1}(n) = \left(v_2(n)+1,\frac12\left(\frac{n}{2^{v_2(n)}}+1\right)\right)$$ with $v_2$ the $2$-adic valuation.

Another bijection is the Cantor pairing function, given by : $$g(n,m) = \frac{(n+m)(n+m+1)}2+m$$ It's inverse is given by : $\newcommand{\w}{\left\lfloor\frac{\sqrt{8n+1}-1}{2}\right\rfloor}\newcommand{\t}{\frac{\w^2 +\w}2}$ $$g^{-1}(n) = \left(\w + \t-n,n-\t\right)$$