Show that $ f(m, n) = 2^{m-1}(2n -1) $ is a bijection 
Let $f: \mathbb{N} \times \mathbb{N} \rightarrow  \mathbb{N},~~ f(m, n) = 2^{m-1}(2n -1). $ Show that $f$ is a bijection.

Thoughts:
I have already show that $f$ is an injection, but this 2 variable case is confusing when it comes to showing it's a surjection. Take a $k \in \mathbb{N}$. I have to show that $\forall ~ k \in \mathbb{N}$, there exists $(m, n)$ such that $f(m, n) = k$. It's not clear how to do that because, well, you need to find the inverse of $f$ but what is it?
 A: Despite the wording of putting this in terms of functions and bijections, this is asking nothing more or less than to prove: Every natural number can be uniquely written as a power of $2$ times an odd number.
So if $k\in \mathbb N$ then $k$ has a unique prime factorization.  
Either $k$ does, or does not have $2$ as a prime factor.  If it does then $k = 2^{a}p_1^{a_1}p_2^{a_2}...p_j^{a_j}$. And $p_i$ are the odd prime factors. And if it doesn't then $k = 2^0*p_1^{a_1}p_2^{a_2}....p_j^{a_j}$.  And $p_i$ are the odd prime factors.  Either way:
$k = 2^h*p_1^{a_1}p_2^{a_2}...p_j^{a_j}$ where $h \ge 0$ and $p_1^{a_1}p_2^{a_2}...p_j^{a_j}$ is the product of the remaining odd prime factors.  
So and that is an odd number.
so $p_1^{a_1}p_2^{a_2}...p_j^{a_j} \ge 1$ and $p_1^{a_1}p_2^{a_2}...p_j^{a_j}$ is odd so there is an $n\in \mathbb N$ so that $p_1^{a_1}p_2^{a_2}...p_j^{a_j} = 2n-1$.  And if $m = h + 1 $ then $m \ge 1$ and
$k = 2^{m-1}(2n-1) = 2^j*p_1^{a_1}p_2^{a_2}...p_j^{a_j}$.
And $k = f(m,n)$.  
So $f$ is surjective and because the prime factorization is unique the power of $2$ is unique as is the value $2n-1$, and therefore $n$.
So $f$ is injective.
A: *

*Take an example  to see why $f$ is surjective. Let's take $x=30\in\mathbb{N}$.  Note that you can write any number $k\in\mathbb{N}$ as $k=2^{a}\cdot b$ where $b%$ is the odd part of the number. Now $$30=2\times 15 = 2^{m-1}\cdot (2n-1)$$ Thus $2n-1=15$ and $2^{m-1}=2$ which gives $n=8$ and $m=2$. Generalize in this way.

A: ►$2^{m-1}(2n-1)=2^{m_1-1}(2n_1-1)$ implies that $2^{m-1}|2^{m_1-1}$ and reciprocally so 
$2^{m-1}=2^{m_1-1}$ then $m=m_1$. Hence, clearly $n=n_1$ and the function is injective.
►$2^{m-1}(2n-1)=k\in\mathbb N$. Since $k=2^n(P)$ where $n$ is integer non-negative (equal to $0$ when $k$ is odd) and $P$ is an odd integer.Puting $m-1=n$ and taking into account that $2n-1$ runs through all the odd integers, we have proven that the function is also surjective.
