Why is $f (p, q) = \frac{(p + q)(p + q + 1)}{2} + q$ bijective? How to show that the map $ f : \mathbb{N}^2 \to \mathbb{N} $ defined by:
$$ f (p, q) = \dfrac{(p + q)(p + q + 1)}{2} + q $$
is bijective, having already shown at the beginning the assertion which states that:
$$ \forall n \in \mathbb{N} \ \exists! k \in \mathbb{N} \ : \ N_k \leq n \leq N_{k + 1} $$
with : $ N_k = \dfrac{k (k + 1)}{2} $
?
Edit :
I've found several proofs here : Proving the Cantor Pairing Function Bijective . Neverthless, they don't use the assertion which says that : $$ \forall n \in \mathbb{N} \ \exists! k \in \mathbb{N} \ : \ N_k \leq n \leq N_{k + 1} $$
Thanks in advance for your help.
 A: Hint: $f(k,n-k) = n-k+\sum_{j=1}^n j $ for $0 \leq k \leq n$.
A: Take a deep breath.
Claim:  If $f(p,q) = f(a,b)$ then $p=a, q=b$ and so $f$ is one to one.
Pf: 
$f(p,q) = \frac {(p+q)(p+q+1)}2 + q = N_{p+q} + q$
And $N_{p+q} \le f(p,q) < \frac {(p+q)(p+q+1)}2 + (p+q+1)= \frac {(p+q)(p+q+1) + 2(p+q+1)}2=\frac {(p+q+1)(p+q+2)}2 = N_{(p+q)+1}$
Likewise $f(a,b) =f(p,q)$ so $N_{a+b} \le f(a,b)=f(p,q) <  N_{(a+b)+1}$
But you claim it has been shown that such $k$ so that $N_k \le f(p,q)=f(a,b) < N_{k+1}$ are unique.
So $k = p+q = a + b$.
So we have $f(p,q) =N_k + q$ so $q = f(p,q)-N_k$.  And $f(a,b) = N_k + b$ so $b = f(a,b)-N_k =  f(p,q)-N_k = q$ so $b=q$.  And $p+q = a+b$ and $b=q$ so $p = a$.
That's it.
$f$ is one to one.
......
Claim:  if $n \in \mathbb N$ then there are $p,q$ so that $f(p,q) =n$ and so $f$ is onto.
Pf:
You claim there is a unique $k$ so that $N_k \le n < N_{k+1}$.
Let $q = n - N_k$ and let $p =k-q$ and so $k = p+q$
So $f(p,q) = \frac {(p+q)(p+q+1)}2 + q = \frac {k(k+1)}2 + (n-N_k) = N_k + (n-N_k) = n$.
So $f$ is onto.
.....
So $f$ is one-to-one and onto.
A: Hint:  If you view it grapically.
$\begin{array}\\f(p,q)& q= 0 & 1 & 2 & 3 & 4 &5 \\p=0 & \color{green}{0=N_0} & \color{blue}{1=N_1} & \color{red}{3=N_2} & \color{orange}{6=N_3} & \color{purple}{10=N_4}& \color{gray}{15=N_5} \\ 1 & \color{blue}{2=N_{1}+1} & \color{red}{4=N_{2}+1} & \color{orange}{7=N_{3}+1} & \color{purple}{11=N_{4}+1}& \color{gray}{16=N_{5}+1}&...\\ 2&\color{red}{5=N_{2}+2} & \color{orange}{8=N_{3}+2} & \color{purple}{12=N_{4}+2} &  \color{gray}{17=N_{5}+2} &...&...  \\ 3&\color{orange}{9=N_{3}+3} & \color{purple}{13=N_{4}+3} & \color{gray}{ 18=N_{5}+3} & ... &...&...\\ 4&\color{purple}{14=N_{4}+4} &  \color{gray}{19=N_{5}+4} & ... & ... &...&...\\ 5& \color{gray}{20=N_{5}+5} & ... & ... & ... &...&...\end{array}$
