The number of ways of writing an integer as a sum of two squares Given an integer $m=pq$, where $p,q$ are both primes such that $p\equiv 1 \pmod{4}, q\equiv 1 \pmod{4}$.
It is known that $p$ can be written as a sum of two squares (of positive integers) in a unique way, and the same for $q$. Prove that $m$ can be written as a sum of two squares (of positive integers) in exactly two distinct ways.
Attempt
Notice that for positive integers $u,v,A,B$, we have
\begin{align*}(u^2+v^2)(A^2+B^2)&=(uA+vB)^2+(vA-uB)^2=(vA+uB)^2+(uA-vB)^2\end{align*}
Therefore if $p=a^2+b^2,q=c^2+d^2$, then
\begin{align*}m&=(a^2+b^2)(c^2+d^2)=(ac+bd)^2+(bc-ad)^2=(bc+ad)^2+(ac-bd)^2\end{align*}
meaning that $m$ can be written as a sum of two squares (of positive integers) in at least two distinct ways.
How do I prove that there doesn't exist a third way of writing $m$ as a sum of two squares (of positive integers)?

@Elaqqad
This is my solution based on your idea and notations. Please point out wherever there is a mistake.
There exist coprime integers $x,y,z,t$ such that
\begin{align*}
&a-c=xy\\&
a+c=zt\\&
d-b=xz\\&
d+b=yt
\end{align*}
Therefore we have that
\begin{align*}
&a=\frac{1}{2}(xy+zt)\\&
c=\frac{1}{2}(zt-xy)\\&
d=\frac{1}{2}(xz+yt)\\&
b=\frac{1}{2}(yt-xz)
\end{align*}
Consequently, we obtain that
\begin{align*}
&a^2+c^2=\frac{1}{2}(x^2y^2+z^2t^2)\\&
b^2+d^2=\frac{1}{2}(x^2z^2+y^2t^2)
\end{align*}
which imply that
\begin{align*}
&2pq=(a^2+b^2)+(c^2+d^2)=(a^2+c^2)+(b^2+d^2)=\frac{1}{2}(x^2+t^2)(y^2+z^2)
\end{align*}
So we have that
\begin{align*}pq=\frac{1}{4}(x^2+t^2)(y^2+z^2)\end{align*}
meaning that there are three possible cases:
\begin{align*}
&\{p,q\}=\{\frac{1}{2}(x^2+t^2),\frac{1}{2}(y^2+z^2)\}\\&
\{p,q\}=\{\frac{1}{4}(x^2+t^2),(y^2+z^2)\}\\&
\{p,q\}=\{(x^2+t^2),\frac{1}{4}(y^2+z^2)\}
\end{align*}
Case 1.$\{p,q\}=\{\frac{1}{2}(x^2+t^2),\frac{1}{2}(y^2+z^2)\}$: 
If a prime $p_0$ satisfies that $p_0\equiv 1 \pmod 4$, then $p_0=m^2+n^2$ for some positive integers $m,n$ with different parity.
Using $(u^2+v^2)(A^2+B^2)=(uA+vB)^2+(vA-uB)^2=(vA+uB)^2+(uA-vB)^2$,
we obtain that $2p_0=(1^2+1^2)(m^2+n^2)=(m+n)^2+(m-n)^2$. The right-hand side is the unique way of writing $2p_0$ as a sum of two squares.
Up to permutation, we may assume that $p=\frac{1}{2}(x^2+t^2),q=\frac{1}{2}(y^2+z^2)$.
If $p=u^2+v^2,q=A^2+B^2$, where $u>v,A>B$,and $u>A)$, then we obtain that
$t>x,z>y$, so $t=u+v,x=u-v,z=A+B,y=A-B$.
\begin{align*}
&a=\frac{1}{2}(xy+zt)=uA+vB\\&
c=\frac{1}{2}(zt-xy)=vA+uB\\&
d=\frac{1}{2}(xz+yt)=uA-vB\\&
b=\frac{1}{2}(yt-xz)=vA-uB
\end{align*}
Case 2.$\{p,q\}=\{\frac{1}{4}(x^2+t^2),(y^2+z^2)\}$: 
If a prime $q_0$ satisfies that $q_0\equiv 1 \pmod 4$, then $q_0=m^2+n^2$ for some positive integers $m,n$ with different parity.
Likewise, we obtain that $4q_0=(0^2+2^2)(m^2+n^2)=(2m)^2+(2n)^2$. The right-hand side is the unique way of writing $4q_0$ as a sum of two squares.
Using the same notations, we have that $t=2u,x=2v,z=A,y=B$, then
\begin{align*}
&a=\frac{1}{2}(xy+zt)=vB+uA\\&
c=\frac{1}{2}(zt-xy)=uA-vB\\&
d=\frac{1}{2}(xz+yt)=vA+uB\\&
b=\frac{1}{2}(yt-xz)=uB-vA
\end{align*}
Case 3.$\{p,q\}=\{\frac{1}{4}(x^2+t^2),(y^2+z^2)\}$:
This is analogous to case 2.
Consequently, we know that $\{(a,b),(c,d)\}=\{(uA+vB,vA-uB),(vA+uB,uA-vB)\}$, so the product of two distinct primes can be written as a sum of two squares in exactly two ways. $\blacksquare$
