Alternative to showing that $J(m,n)=\frac{1}{2}[(m+n)^2+3m+n], \ J:\mathbb{N}^2\to \mathbb{N}$ is bijective

53 Views Asked by At

I came up with the following proof, but it seems too complicated so I was wondering if anyone else has a simpler idea.

Proof. The idea is to notice that $J(m,n)$ can also be expressed equivalently as

$$ J(m,n)=\left(\sum_{i=1}^{m+n}i\right)+m \tag{1} $$

To prove injectivity, suppose $J(m_1,n_1)=J(m_2,n_2)$. We'll prove $m_1=m_2$ (the fact that $n_1=n_2$ should follow immediately after). For this, suppose that $m_1+n_1<m_2+n_2$, then using the (1) formulation of $J$, we have

$$\sum_{i=1}^{m_1+n_1}i+ \ m_1=\sum_{i=1}^{m_2+n_2}i+ \ m_2 \quad \Longrightarrow \quad m_1=\sum_{i=m_1+n_1+1}^{m_2+n_2}i+ \ m_2$$

which is a contradiction (to see why, subtract $m_1$ from both sides). With similar reasoning we can prove that $m_1+n_1>m_2+n_2$ is impossible as well. Thus we conclude that $m_1+n_1=m_2+n_2$.

Using the original formulation of $J$ we get:

$$ [(m_1+n_1)^2+3m_1+n_1]=[(m_2+n_2)^2+3m_2+n_2]. $$

With the fact that $m_1+n_1=m_2+n_2$, this reduces to $2m_1=2m_2$ , thus $m_1=m_2$. This is injectivity proved.

For surjectivity, let us choose some $z\in \mathbb{N}$. We need to show that there exists $m,n\in \mathbb{N}$ such that $J(m,n)=z$. Let $k$ be the largest element in $\mathbb{N}$ such that $\sum_{i=1}^ki\leq z$. Then we can define

$$ m=z-\sum_{i=1}^ki \quad \text{and} \quad n=k-m. $$

It is obvious that $m\in \mathbb{N}$. To check that $n\in \mathbb{N}$, notice that

$$ \sum_{i=1}^ki\leq z<\sum_{i=1}^{k+1}i \quad \Longrightarrow \quad 0\leq m<k+1 \quad \Longrightarrow \quad m\leq k.$$

Defining $n,m$ this way gives us

$$J(m,n)=\sum_{i=1}^{m+n}i+m=\sum_{i=1}^ki+m=z$$

as needed. $\Box$