Fermat's Two Squares Theorem/Uniqueness Lemma/Proof 3

Proof
Let $a, b, c, d \in \Z_{>0}$ satisfy:
 * $p = a^2 + b^2 = c^2 + d^2$

Then we have:
 * $(ac+bd)(ad+bc)=(a^2+b^2)cd+(c^2+d^2)ab=p(ab+cd)$

Thus $p \divides ac+bd$ or $p \divides ad+bc$.

Swapping $c$ and $d$, if necessary, we may assume:
 * $p \divides ac+bd$

On the other hand:
 * $p^2=(ac+bd)^2+(ad-bc)^2\geq p^2+(ad-bc)^2$

Thus:
 * $ad-bc = 0$

Let:
 * $k := \dfrac a c = \dfrac b d$

Then:
 * $p = a^2 + b^2 = k^2 \paren {c^2 + d^2} = k^2 p$

Thus:
 * $k = 1$

That is:
 * $\tuple {a, b} = \tuple {c, d}$