I'm in a class on proofs and problem-solving, and my final paper is on Zagier's "one sentence" proof regarding primes and their relations to the sum of two squares. One portion of the explanation of Zagier's proof requires me to prove that $S = A\cup B\cup C$ Definitions can be found here, to sum up the sets: $S = \{ (x,y,z) \in \mathbb N^3 : x^2 + 4yz = p \}$ $(x,y,z) \mapsto \begin{cases} (x+2z, z, y-x-z) & \text{ if } x < y-z \\ (2y-x, y, x-y+z) & \text{ if } y-z < x < 2y \\ (x-2y, x-y+z, y) & \text{ if } x > 2y. \end{cases}$
Once again, I'd just like to know how to prove $S = A\cup B\cup C$. Thanks in advance.