If you do $x^2 + y^2 = n$ where $x$ and $y$ are both prime numbers and are both greater than $3$, why is $n$ always an even number that isn't a perfect square?
2026-03-29 07:00:28.1774767628
On
Why is it that if you square two prime numbers and add them, you get a number that is even and is not a perfect square?
2.6k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
3
There are 3 best solutions below
0
On
It is easy to see that $n$ is even, as both $x,y$ are odd.
To see why $n$ cannot be a perfect square, here is an alternative approach: assume by contradiction that $n=m^2$.
Than $$x^2+y^2=m^2 \\ x^2=m^2-y^2=(m-y)(m+y)$$
As $x$ is prime, he only ways of writing $x^2$ as a product of 2 positive integers are $1 \cdot x^2$ or $x \cdot x$. Since $m-y < m+y$ we get $$m-y =1 \\ m+y=x^2$$
This shows that $$2y=x^2-1=(x-1)(x+1)$$
Now, again there are only two ways to write $2y$ as a product of two positive integers which yields $x-1=1$ or $x-1=2$ and it is easy to see that neither works.
Any prime not equal to $2$ is odd (obvious/trivial from the definition). The square of an odd number is odd ( $1^2 \equiv 1 \pmod 2 $ ). The sum of two odd numbers is even. Hence the sum of the squares of two odd primes is even.
As for the "not a perfect square" part, look at the squares modulo $4$. It is easy to see that $$ (4k+a)^2 = 4(4k^2+2a)+a^2 \equiv a^2 \pmod 4, $$ so we just have to check the squares of the first 4 numbers modulo $4$ to find the possible options. You find that $$ 0^2 \equiv 2^2 \equiv 0 $$ and $$ 1^2 \equiv 3^2 \equiv 1 $$, so that any perfect square is $0$ or $1$ modulo $4$. Further, the square of any odd number is equivalent to $1$ modulo $4$ by looking at the above more carefully. Then $$ p_1^2 + p_2^2 \equiv 1+1 = 2 \pmod{4}, $$ which we just showed cannot be a perfect square.