TITLE: Zagier's one-sentence proof of a theorem of Fermat
QUESTION [109 upvotes]: Zagier has a very short proof (MR1041893, JSTOR) for the fact that every prime number $p$ of the form $4k+1$ is the sum of two squares. 
The proof defines an involution of the set $S= \lbrace (x,y,z) \in N^3: x^2+4yz=p \rbrace $ which is easily seen to have exactly one fixed point. This shows that the involution that swaps $y$ and $z$ has a fixed point too, implying the theorem.
This simple proof has always been quite mysterious to me. Looking at a precursor of this proof by Heath-Brown did not make it easier to see what, if anything, is going behind the scenes. 
There are similar proofs for the representation of primes using some other quadratic forms, with much more involved involutions.
Now, my question is: is there any way to see where these involutions come from and to what extent they can be used to prove similar statements?

REPLY [7 votes]: A recent article gives another very elegant proof of the two-square theorem in the Zagier style, but is easier.  See

Stan Dolan, A very simple proof of the two-squares theorem,
The Mathematical Gazette, Volume 105, Issue 564 (2021) p. 511. doi:10.1017/mag.2021.120 (the whole article is visible in the free preview)

The proof is not one sentence but it is still well worth reading.  One starts with the set $S = \{(x,y,z) \mid (x+y+z)^2 = p + 4xz, \text{ and } 
x,y,z \in \mathbb{Z}_{>0} \}$.  Short, clever arguments show that $S$ is finite,
$|S|$ is odd, and that there is a positive integer solution with $y=z$.