I am reading a book about Number Theory as a new learner.
The book has proved that all primes of the form $4k+1$ can be represented by the sum of two squares.
This question is given as exercise and I truly have no idea for the solution.
The only thing that I found may be helpful is that one of the squares is even and one is odd.
Thanks for any help ^_^
Edit: About duplication, I suppose that question is about the process in a specified proof.
Will Jagy has given a complete proof.
Thanks so much for the answer!
Let us have positive integers with $$ n = a^2 + b^2 = c^2 + d^2 $$ with $a,c$ odd, then $b,d$ even, also $b < d$ and $a > c.$ So these are two genuinely distinct ways of writing $n.$
$$ (a-c)(a+c) = (d-b)(d+b). $$ Define $$ r = \gcd(a-c, d-b) $$ Note that $r$ is even. Next we define $$ a-c = rs \; , \; \; \; d-b = r t \; , $$ so that $$ \gcd(s,t) = 1. $$ Note that at least one of $s,t$ is odd. This gives us $$ (a+c)s = (d+b)t. $$ The gcd property tells us that $t | (a+c).$ We define $u$ with $$ a+c = t u. $$ We immediately conclude $d+b = s u.$ As $a+c, d+b$ are even, but at least one of $s,t$ is odd, we find $u$ is even.
In one line, $$ \color{magenta}{ a-c = rs \; , \; \; a+c = tu \; , \; \; d-b = rt \; , \; \; d+b = su \; }. $$ If we now solve for $a$ and $b$ and square and combine, we get $$ a = \frac{1}{2}(rs+tu) \; , \; \; \; b = \frac{1}{2}(su-rt) \; , $$ $$ a^2 + b^2 = \frac{1}{4}\left( r^2 s^2 + r^2 t^2 + u^2 s^2 + u^2 t^2\right) = \frac{1}{4}\left( r^2 + u^2 \right) \left( s^2 + t^2 \right)\; , $$
$$ \color{magenta}{ n = a^2 + b^2 = c^2 + d^2 = \left( \left(\frac{r}{2}\right)^2 +\left(\frac{u}{2}\right)^2 \right) \left(s^2 + t^2 \right) } . $$ That is to say, because $n$ had two distinct representations as the sum of two squares, it is composite.
The contrapositive is that a number $4k+1$ with just one expression as the sum of two nonzero squares is prime. It is probably worth pointing out that this is the contrapositive in the setting of having at least one representation. We are not making any conclusions about numbers that have no representation as the sum of two squares.