2

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.

YoYo12
  • 331

4 Answers4

2

I believe this is the most intuitive "proof":

[ 0,  2,  5,  9, 14, 20, 27, 35, 44, 54]
[ 1,  4,  8, 13, 19, 26, 34, 43, 53, 64]
[ 3,  7, 12, 18, 25, 33, 42, 52, 63, 75]
[ 6, 11, 17, 24, 32, 41, 51, 62, 74, 87]
[10, 16, 23, 31, 40, 50, 61, 73, 86, 100]
[15, 22, 30, 39, 49, 60, 72, 85, 99, 114]
[21, 29, 38, 48, 59, 71, 84, 98, 113, 129]
[28, 37, 47, 58, 70, 83, 97, 112, 128, 145]
[36, 46, 57, 69, 82, 96, 111, 127, 144, 162]
[45, 56, 68, 81, 95, 110, 126, 143, 161, 180]

The $p$-th row, $q$-th column is $f(p, q)$.

Can you figure out how the numbers are arranged?

WhatsUp
  • 22,201
  • 19
  • 48
1

Hint: $f(k,n-k) = n-k+\sum_{j=1}^n j $ for $0 \leq k \leq n$.

Nicolas
  • 845
  • Thank you. But, how to use your formula to prove that $ f $ is bijective ? :) – YoYo12 Oct 22 '19 at 21:29
  • Okay, here's another hint: show that for every $n \in \mathbb{N}$ there exist unique $a,b \in \mathbb{N}$ such that $0 \leq a \leq b$ and $n = a + \sum_{k=1}^b k$. You should be able to figure the rest out from here. – Nicolas Oct 22 '19 at 21:39
  • Thank you !. :-) – YoYo12 Oct 22 '19 at 21:55
1

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.

fleablood
  • 124,253
1

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}$

fleablood
  • 124,253