Since the last post no one gave the solution, so i reopen one and use other approach searched in this forumn. https://math.stackexchange.com/a/91323/620871
Show that the polynomial function $$f(m,n)=(m+n−2)(m+n−1)/2+m $$ is one-to-one and onto. Both domain is $\Bbb Z^+\times \Bbb Z^+$, codomain are $\Bbb Z^+$.
I want to prove $f(m,n)=f(p,q) \longrightarrow (m=p \text{ and }n=q)$.
$$\frac12(m+n-2)(m+n-1)+m=\frac12(p+q-2)(p+q-1)+p\;.\tag{1}$$ The first step is to show that $m+n=p+q$, so suppose not. We may as well assume that $m+n<p+q$. For convenience let $a=m+n$ and $d=(p+q)-a$, so that it becomes $$\frac{(a-2)(a-1)}2+m=\frac{(a+d-2)(a+d-1)}2+p\;.$$
Then $$\begin{align*} m-p&=\frac{(a+d-2)(a+d-1)}2-\frac{(a-2)(a-1)}2\\ &=ad+\frac{d(d-3)}2\\ & \end{align*}$$
Since $a\ge 2$,$d\ge1$, we dicovered that $m-p>a$ when $a\ge 2$,$d>1$,$m-p>m+n,$which is absurd.
However,if $d=1$,$a\ge 2$,then $m-p>a$ is not hold. How to duel with the case that $d=1$,$a\ge 2$ or we can just ignore it?
Thanks.
There’s at least one problem with what you’ve done. You assume that $m+n>p+q$, let $a=m+n$ and $d=p+q-a$; clearly this implies that $d<0$, so the later assertion that $d\ge 1$ cannot be right. I suggest a slightly different approach.
We know that
$$\frac{(m+n-2)(m+n-1)}2=\sum_{k=1}^{m+n-2}k$$
and
$$\frac{(p+q-2)(p+q-1)}2=\sum_{k=1}^{p+q-2}k\;.$$
Without loss of generality assume that $m+n\ge p+q$. Then
$$0=f(m,n)-f(p,q)=\sum_{k=p+q-1}^{m+n-2}k+m-p\;.\tag{1}$$
(If $p+q-1>m+n-2$, the summation evaluates to $0$.) If $m+n>p+q$, then $m+n-2\ge p+q-1$, and $(1)$ implies that
$$0=\sum_{k=p+q-1}^{m+n-2}k+m-p\ge p+q-1+m-p=m+q-1\ge 1\;,$$
which is absurd, so $m+n=p+q$, and $(1)$ implies that $0=m-p$, i.e., that $m=p$, which in turn implies that $n=q$. Thus, $f$ is one-to-one.
When you try to prove that $f$ maps $\Bbb Z^+\times\Bbb Z^+$ onto $\Bbb Z^+$, you may find the following diagram helpful; each point $\langle m,n\rangle$ is labelled with the number $f(m,n)$.
$$\begin{array}{ccc} n&\begin{array}{c|cc} 4&7&12&18&25\\ 3&4&8&13&19\\ 2&2&5&9&14\\ 1&1&3&6&10\\\hline &1&2&3&4 \end{array}\\ &m \end{array}$$
Notice that the points are numbered along consecutive diagonals from upper left to lower right, and that each diagonal has one more point on it than the previous one.