How to prove a function from $\mathbb N\times \mathbb N$ to $\mathbb N$ is bijective. I am having trouble with this problem:
$f\colon \mathbb N\times \mathbb N \rightarrow \mathbb N$ is defined by 

$f(i,j)=\dfrac{(i+j-1)(i+j-2)}{2}+i$. 

How do you prove that $f$ is a bijection from $\mathbb N\times \mathbb N$ to $\mathbb N$?

Work: I tried to set $f(i,j)=f(a,b)$. Assuming that $f(i,j)\neq f(a,b)$, then I assume $f(i,j)&lt; f(a,b)$and that $i+j=m$ and $a+b=m+r$ for some remainder $r$. I replaced these into my equation and try to obtain a contradiction thus proving that $i=a, j=b$. However, I get stuck after this part and I do not know of a better way of doing this. 

Please help.
Instead, let $a=i+m$ and $b=j+n$. Then $(i+j-1)(i+j-2)+2i=(i+j+m+n-1)(i+j+m+n-2)+2i+2m$. Try multiply this out and collecting terms. You want that $m,n=0$. 

You might ask why is this a more natural substitution. When you make a substitution, you usually don't want to substitute for only some instances of a variable. Notice that in your set up you still have an $a$ term on the end, despite substituting for some of the $a$s, and likewise for $i$
$$T(n)=\frac{n(n+1)}{2}$$
$$f(i,j)-T(i+j-2)=i &gt; 0$$
$$T(i+j-1)-f(i,j)=j-1≥0$$
$$T(i+j-2)&lt;f(i,j)≤T(i+j-1)$$
Suppose $f(i,j)=f(a,b)$. Now, $T(i+j-2)&lt;f(i,j)≤T(i+j-1)$ and $T(a+b-2)&lt;f(i,j)≤T(a+b-1)$. Again, $T(n)$ is a strictly increasing sequence, hence $a+b=i+j$. But then the relation $f(i,j)=f(a,b)$ gives $i=a$ and $j=b$, hence f is one to one. I leave the work of proving that $f$ is onto upto you.