Can a prime of form $4m+1$ be expressed as sum of 2 squares in more than one way

elementary-number-theoryprime numbers

It is easy to find dozens of proofs (some of which are elementary or easy to follow) that every prime of the form $4m+1$ can be expressed as the sum of two squares.

How can one prove that every prime of the form $4m+1$ can be expressed as the sum of two squares $p = a^2 + b^2 | a,b \in \Bbb Z^+, a>b$ in only one way?

This is easy to verify for primes up to quite a large value but I can't find a proof.

Best Answer

Denote by $p$ a prime number of the form $4m+1$. Thus $$p\equiv 1\pmod 4$$ Assume that $p={a^2}+{b^2}={c^2}+{d^2}$ for some $a,b,c,d\in\mathbb {N}$ such that, w.l.o.g. $a>b$ and $c>d$. Our aim is now to show by contradiction, that this follows to $a=c$ and $b=d$:

We now have $$(ad-bc)(ad+bc)={a^2}{d^2}-{b^2}{c^2}=\bigl(p-{b^2\bigr)}{d^2}-{b^2}\bigl(p-{d^2\bigr)}=p\bigl({d^2}-{b^2}\bigr)\equiv 0\pmod p$$ This implies (see Euclid's lemma) that either $$p|(ad-bc)$$ or $$p|(ad+bc)$$

Let's suppose $p\mid(ad+bc)$. Hence ${a^2},{b^2},{c^2},{d^2}<p$. Thus $a,b,c,d<\sqrt{p}$, which implies that $$0<ad+bc<2p$$ That leads to $ad+bc=p$. However $${p^2}=\Bigl({a^2}+{b^2}\Bigr)\Bigl({c^2}+{d^2}\Bigr)={(ad+bc)^2}+{(ac-bd)^2}={p^2}+{(ac-bd)^2}$$ $$\Rightarrow ac-bd=0$$ which, nevertheless, contradicts the assumption that $a>b$ and $c>d$. This shows, that $p\nmid ({ad+bc})$.

This implies $p\mid ({ad-bc})$. Analugously $$a,b,c,d<\sqrt{p}$$ which implies that $$-p<ad-bc<p \Rightarrow ad=bc$$ Hence $a\mid {bc}$. Note however, that since $p={a^2}+{b^2}$, $a$ and $b$ have to be coprime, so $$a\mid{c}$$ Let $c=xa$. Since $ad=bc$, it follows that $d=xb$

We finally have $$p={a^2}+{b^2}={c^2}+{d^2}={x^2}\bigl({a^2}+{b^2}\bigr)\Rightarrow x=1$$ $$\Rightarrow c=a\quad d=b$$

Related Question