# [Math] Representing a given number as the sum of two squares.

number theorysums-of-squares

There are four essentially different representations of $1885$ as the sum of squares of two positive integers. Find all of them.

I am guessing the must be some nice way of solving $z= x^2 + y^2$ where x and y are integers in general that i don't know.

Is there some general way to know how many solution exists or bound it without computing it?

Let $N=1885$ which can be factorised to give 3 different primes, each of which can be written as the sum of two squares in one way only (i.e. $5=1^2+2^2$,$13=2^2+3^2$ and $29=2^2+5^2$. Notice that 5, 13 and 29 are all of the form $(4n+1)$ ). Therefore $N=xyz$ where $x=\left(r^2+s^2\right)$, $y=\left(t^2+u^2\right)$ and $z=\left(v^2+w^2\right)$
First multiplying x and y we can show that the product equals the sum of two squares in at least two algebraically distinct ways. $$xy=\left(r^2+s^2\right)\left(t^2+u^2\right)=\left(rt+su\right)^2+\left(ru-st\right)^2=\left(rt-su\right)^2+\left(ru+st\right)^2$$ I am not sure how to prove that this represents the maximum number of ways the product can be written distinctly as the sum of two squares. I suppose you need to convince yourself of this before continuing.
In a similar way we can demonstrate that multiplying the product $xy$ by $z=\left(v^2+w^2\right)$ doubles the previous number of algebraic solutions. Therefore we provisionally find that $N$ equals the sum of two square in four algebraically distinct ways.