Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd appreciate your help showing that if $p\equiv3\,\left(\mbox{mod 4}\right)$ then p can't be written as a sum of two squares.


share|cite|improve this question
up vote 9 down vote accepted

Any square of an integer must be equivalent to 0 or 1 $\pmod{4}$, so if you add two of them, you can't get something which is equivalent to $3 \pmod{4}$.

share|cite|improve this answer
Thanks for the help John. And also thanks to the other repliers. I love math.stackexchange... – Serpahimz Jan 16 '13 at 23:21

Every number is congruent to $0$, $1$, $2$ or $3$ or modulo $4$.

Notice that $0^2 \equiv 0 \bmod 4$, $1^2 \equiv 1 \bmod 4$, $2^2 = 4 \equiv 0 \bmod 4$ and $3^2 = 9 \equiv 1 \bmod 4$. Thus, all square numbers are congruent to either $0$ or $1$ modulo $4$.

Assume that $n$ is the sum of two square numbers, then it is congruent to $0+0 = 0$, $1+0 = 1$, $0+1 = 1$ or $1+1 = 2$ modulo $4$. The contrapositive tells us that if $n$ is not congruent to either $0$, $1$ or $2$ modulo $4$ then it is not the sum of two square numbers. This proves your statement.

share|cite|improve this answer

Hint: Take any integer number. If even, its square is divisible by four. If odd, its square gives remainder 1 when divided by 4.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.