# Sum of two squares and prime factorizations

If $m$ is a positive integer such that every prime factor of $m$ that is congruent to $3$ modulo $4$ appears with an even power, then $m$ can be written as a sum of two squares.

I wrote $m=2^{a_0}p_1^{a_1}\dots p_k^{a_k}q_1^{b_1}\dots q_l^{b_l}$ where each $p_i \equiv 1 \pmod 4$ and each $q_j \equiv 3 \pmod 4$ and $b_j$ are even. I am not sure what to do next... I know that each $2$ factor $=(1^2+1^2)$ which is a sum of squares and that if m equals the product of many sums of squares then m is a sum of squares but I am not sure how to show that the $p_i^{a_i}$ factors and $q_j^{b_j}$ factors are all sums of squares...

• Unless m is a power of 4. – DanielWainfleet Apr 16 '17 at 4:27

Note that for $a,b,c,d \in \mathbb{R}$ we have \begin{align} (a^2 + b^2)(c^2 + d^2) = (ac + bd)^2 + (ad - bc)^2 \end{align} This means if two numbers can be written as the sum of squares, then their product can also be written as the sum of squares. Consider the $q_j$. Each $b_j$ is even so write $b_j = 2b'_j$. We then have $q_j^{b_j} = (q_j^{b'_j})^2 + 0^2$ so each of them can be written as the sum of sqaures. Thus $q_1^{b_1} \cdots q_l^{b_l}$ can be written as the sum of squares. Similarly be Fermat's theorem on the sum of squares each $p_i$ can be written as the sum of squares, and thus $p_i^{a_i}$ can be written as the sum of squares. Also $2 = 1^2 + 1^2$. Thus the product $m = 2p_1^{a_1} \cdots p_k^{a_k} q_1^{b_1} \cdots q_l^{b_l}$ can be written as the sum of squares.

• thank you very much for your time. – MathIsHard Apr 16 '17 at 0:08
• It must be possible that $ad-bc\ne 0.$This is not possible if $a^2+b^2$ and $c^2+d^2$are odd powers of $2$. A power of $4$ is not the sum of two squares. – DanielWainfleet Apr 16 '17 at 4:31
• @user254665 I think the case of $0^2 + a^2$ still counts since sum of squares usually refers to sum of integer squares. Even on OEIS(sequence A001481) the sequence of sums of squares includes powers of 4, such as 16. – Jeevan Devaranjan Apr 16 '17 at 5:55

Hint

Step 1: Prove that $2$ and every prime $p$ satisfying $p \equiv 1\pmod 4$ can be represented as sum of two squares.

Step 2: Prove that if $a$ and $b$ can be represented as sum of two squares, $ab$ can be also written as sum of two squares.

Step 3: Now you get $m=(x^2+y^2)\prod_qq_i^{b_i}=(x^2+y^2)z^2$ because all of the $b_i$s are even.