Prove that a positive integer is composite Let $ n $ be a positive integer that can be written as a sum of two relatively prime squares in two distinct ways, that is $ n = a^2 + b^2 = c^2 + d^2 $ so that $ gcd(a, b) = gcd(c, d) = 1, $ then $ n $ is composite.
So I have successfully factored $ n $ into $ \displaystyle \frac{ac + bd}{a - d}.\frac{ac - bd}{a + d} $ and have proved that $ \displaystyle (a - d) | (ac + bd) $ and $ \displaystyle (a + d) | (ac - bd). $ So each of the $ \displaystyle \frac{ac + bd}{a - d} $ and $ \displaystyle \frac{ac - bd}{a + d} $ is an integer, but I am currently stuck on proving that $ n $ is composite. My intention is to prove that both factors of $ n $ are greater than $ 1, $ but no success at this point. Any hint or suggestion? I have tried to use the fact that $ gcd(a, b) = gcd(c, d) = 1, $ but still no progress.
Thanks.  

What you ask is equivalent to showing that if $n$ is not composite then $n$ is the sum of two co-prime squares in just one way, or in no way.
The cases $n=1$ is trivial. 
If $n$ is prime, suppose $n=a^2+b^2=c^2+d^2.$ with  each of $a,b,c,d$  positive and less than $n.$ We will take all congruences  modulo $n.$
We have $b\equiv a i$ and $c \equiv \pm d i$ where $i\in Z$  and $i^2\equiv -1.$
Case (1):  $d\equiv i c .$ Then  $$n^2=(a^2+b^2)(c^2+d^2)=(a c+b d)^2+(a d-b c)^2$$ and $$a c+b d\equiv a c +i^2 a c\equiv 0\equiv a c i-a ic\equiv a d- bc.$$ So $a c+b d=n x$ and $a d-b c=n y$ with $x,y\in Z.$ We have now $$n^2=(x^2+y^2)n^2$$ while $x=a c +b d>0,$ so $x=1$ and $y=0.$ Therefore $$0=y n=a d-bc.$$ With $z=a/b,$ we have also $z=c/d,$ and $$(1+z^2)b^2 =a^2+b^2=n=c^2+d^2=(1+z^2)d^2$$ so $b=d.$ And then (of course) $a=c.$
Case (2):  $d\equiv - i c.$ We have $$p^2=(a^2+b^2)(c^2+d^2)=(a c-b d)^2+(a d+b c)^2,$$ and similarly to the methods of Case (1), we obtain $a=d$ and $b=c$. So if $n$ is not composite then $n$ is the sum of two squares in at most one way.
