# Thread: Sum of Two Squares theorem

1. ## Sum of Two Squares theorem

If m is odd and if every prime dividing m is congruent to 1 modulo 4, prove that m can be written as the sum of two squares $\displaystyle m = a^{2} + b^{2}$ where gcd(a,b) = 1.

So it's easy enough to prove that it is the sum of two squares (the product of two primes that be written as the sum of two squares is also the sum of two squares), but I don't know how to prove that the gcd would be 1. A follow up question is , if m is even and m/2 and every prime dividing m/2 is congruent to 1 modulo 4, prove that m can be wrtten as a sum of two squares $\displaystyle m= a^{2} + b^{2}$ with gcd(a,b)=1. Thanks

2. ## Re: Sum of Two Squares theorem

So I've tried using induction on $\displaystyle p$ but I still can't get the fact that the two squares are relatively prime.

3. ## Re: Sum of Two Squares theorem

Firstly, how exactly did you show that m = a^2 + b^2?
Secondly, are you allowed to use the Gaussian integers?

4. ## Re: Sum of Two Squares theorem

Well, we showed $\displaystyle m = a^{2}+b^{2}$ by using the fact that any prime congruent 1 modulo 4 can be written as a sum of two squares, and a product of sums of squares is a sum of squares as well. And no, we haven't covered those in class.