# Non-negative rational integer composed of primes may be written as the sum of two squares

Show that any non-negative rational integer of the form

-- where the $p_1,p_2,...,p_m$ are all primes congruent to 1 mod 4, the $q_1,q_2,...,q_n$ are all primes congruent to 3 mod 4 and $i,k_1,k_2,...,k_m,j_1,j_2,...,j_n$ are all non-negative integers --
may be written as the sum of two squares.

My Work So Far:

• I showed that if x and y may both be written as the sum of the squares of two integers then their product may also be written as the sum of two integers squared
• I showed that if p is an integer prime congruent to 1 mod 4 then p is not a prime in Q[$\sqrt{-1}$]
• I showed that if p is an integer prime congruent to 1 mod 4 then there are rational integers a and b for which $p=a^2+b^2$

I'm just not sure how to combine these results. Any help would be welcome, thank you!

Since:

• $2$ is a sum of squares;
• every $p_i$ is a sum of two squares;
• every ${q_i}^2$ is a sum of two squares;
• if several numbers are sums of two squares, their product also has that property,

there's not much left for you to do…

First, we claim that a prime number can be expressed as the sum of the squares of two integers if and only if it is congruent to 1 mod 4. Here is the reference: How do you prove that a prime is the sum of two squares iff it is congruent to 1 mod 4? So every pi is a sum of two squares.

Second, since qi is congruent to 3 mod 4. Its square qi^2 is congruent to 1 mod 4. Then qi^2 is the sum of the squares of two integers.

Third, 2^i is the sum of two squares, obviously.

Since you've proved that if two numbers can be expressed as the sum of two squares, then there product can also be expressed as the sum of two squares. So 2^i times any pi times any qi^2 can be expressed in the same way.

(My first answer on Math Stackexchange. Sorry for not editing mathematical symbols. Hope it helps!)