# Inversion of a pairing function

I was reading this question on this site and I saw that the following pairing function was mentioned (a modified version of Cantor function):

$$\langle x, y\rangle = x * y + \operatorname{trunc}\left(\frac{(|x - y| - 1)^2}{4}\right) = \langle y, x\rangle$$

(also expanded here)

I was wondering if, given the result, one can get back $x$ and $y$ (inversion), as normally one can do with similar functions (e.g., Cantor pairing function).

If, say, $f(x,y) = u$, where $f$ is the above function, given $u$ what would $x$ and $y$ (order unimportant) be ?

• Please not proper MathJax usage: I changed $<x,y>=x*y+trunc(\frac{(|x−y|−1)^2}{4})=<y,x>$ to $\displaystyle\langle x, y\rangle = x * y + \operatorname{trunc}\left(\frac{(|x - y| - 1)^2}{4}\right) = \langle y, x\rangle$. ${}\qquad{}$ – Michael Hardy Apr 23 '15 at 22:55
• Thank you for the edit Michael. I can attempt a justification ;-) by saying that I just copied and pasted the original code without modifying it. Thanks again: it looks much better now. – Pam Apr 23 '15 at 22:59