Theory of numbers: Why does $ Pair (x, y) = frac {(x + y) (x + y + 1)} {2} + x $ show a bijection with the pairs (x, y)?

To consider

$$ Par (x, y) = frac {(x + y) (x + y + 1)} {2} + x $$

I discovered that it essentially zigzags along the grid with $ mathbf N $ vs $ mathbf N $ (natural numbers). Intuitively, given any P (x, y) we follow the path of the grid to get a bijection. But I wanted a rigorous way of doing this. How do you find what explicit bijection is? Do we need some fact of elementary number theory that escapes me?

(keep in mind that all this is in the natural numbers which makes it more complicated for me … in fact, even if I had square roots available, I would have no idea how to do it).


Note that the pair only allocates the pair to 1 unique number, so it is obviously an injective function of x, and natural numbers. What is important, now only the other direction is needed.


context: emerges in the development of Godel's numbering: https://faculty.math.illinois.edu/~vddries/main.pdf

page 85.