The Cantorese pairing function

In addition to the diagonal arguments , Georg Cantor also developed the Cantor pairing function \(\mathbb{N}^2 \to \mathbb{W}, \quad c(x,y) = \binom{x+y+1}{2}+x = z\) , which encodes any two numbers \(x,y \in \mathbb{N}\) in a new number \(z \in \mathbb{N}\) . For example, \(c(3,4)=\binom{3+4+1}{2}+3 = \binom{8}{2}+3=\frac{8!}{6!\cdot 2!} +3 = 31 = z\) a unique coding of the numbers \(3\) and \(4\) in the number \(31\) . Show: The set of values \(\mathbb{W} = \mathbb{N}\) , ie \(z\) assumes all natural numbers.


We prove the special structure of the following table:

  0 1 2 3 ...
0 0 2 5 9 ...
1 1 4 8 13 ...
2 3 7 12 18 ...
3 6 11 17 24 ...
... ... ... ... ... ...

So for \(x > 0, y \geq 0\)
$$
c (x + 1, y) -c (x, y + 1) =
$$
$$
\ binom {x + 1 + y + 1} {2} + x + 1 - \ left (\ binom {x + y + 1 + 1} {2} + x \ right)) = \ binom {x + y + 2} {2} - \ binom {x + y + 2} {2} + x - x + 1 = 1
$$
as well as for \(x \geq 0\)
$$
c (0, x + 1) -c (x, 0) =
$$
$$
\ binom {0 + x + 1 + 1} {2} + 0 - \ binom {x + 0 + 1} {2} - x = \ binom {x + 2} {2} - \ binom {x + 1} {2} - x =
$$
$$
\ frac {(x + 2)!} {2! x!} - \ frac {(x + 1)!} {2! (x-1)!} - x =
$$
$$
\ frac {(x + 2) (x + 1)} {2} - \ frac {(x + 1) x} {2} - x = \ frac {(x + 1) \ left ((x + 2) - x \ right)} {2} - x = x + 1 - x = 1
$$
This means that all natural numbers are achieved.

Back