# It is impossible for $(x-1)^2+x^2+(x+1)^2$ to be a perfect square

Prove that it is impossible for three consecutive squares to sum to another perfect square. I have tried for the three numbers $$x-1$$, $$x$$, and $$x+1$$.

• What overall simplified expression did you get on adding the squares of $x-1,x,x+1$ ? Looking at that result might explain it. – coffeemath Jul 16 at 3:27
• If you attempt to fit the website, the website fits you. Your first attempt to fit is not bad. For example, you may like to write down where exactly you get stuck while working with $x-1,x,x+1$. You may have written down some equations : use MathJax to type them in. Finally, try to be less "commanding" in terms of your speech. For example, "I was trying to prove that ..." sounds better than "prove that ..." – астон вілла олоф мэллбэрг Jul 16 at 3:28
• $3x^2+2$ but i cant really prove anything from that can i? – user610551 Jul 16 at 3:28
• As the answer below shows, you can, from the fact that such a number leaves a remainder of $2$ upon division by $3$, which no square number does. – астон вілла олоф мэллбэрг Jul 16 at 3:29
• Also, dont worry. I joined this when I was 13 and I have 340 reputation. – BadAtGeometry Jul 16 at 3:30

## 3 Answers

As you stated, you let the $$3$$ consecutive numbers be $$x-1$$, $$x$$, and $$x+1$$. This will give you a sum of their squares to be $$3x^2 + 2$$. Consider any integer $$n$$ and $$r = 0,1$$ or $$2$$. Then $$(3n+r)^2 = 9n^2 + 6nr + r^2$$, so the possible remainders when divided by $$3$$ are just $$r^2$$, i.e., $$0$$, $$1$$, plus $$4$$ which has a remainder of $$1$$ also. Thus, all perfect squares have a remainder of either $$0$$ or $$1$$ when divided by $$3$$, but this sum has a remainder of $$2$$. Thus, it cannot be a perfect square.

In general, you should try to handle these types of questions by checking the remainders (sometimes called congruences in higher math) of various small integers to see if you can find any particular pattern, such as determine anything which doesn't fit.

• In other words, the sum of the three consecutive squares can be written as $(x-1)^2 + x^2 + (x+1)^2=3x^2 + 2$. But, $3x^2 + 2 \equiv 2(\text{mod } 3)$, which is impossible for a square! – Axion004 Jul 16 at 3:52
• @Axion004 Your statement is correct. Since the OP stated that he was just $15$ years old, I assumed he hasn't yet studied anything like modulo, congruence, etc. As such, I tried to give a relatively basic, more detailed explanation instead. – John Omielan Jul 16 at 3:56
• @JohnOmielan I have studied modulo but your answer is much more understandable – user610551 Jul 16 at 15:47

The smallest solution you may think of:

Note that $$(x-1)^2+x^2+(x+1)^2=3x^2+2\equiv 2\pmod{3}$$, but $$y^2\equiv 0,1\pmod{3}$$for all integers $$y$$. Therefore, $$(x-1)^2+x^2+(x+1)^2$$ can never be a perfect square.

I will attempt a proof by contradiction.

Assume that the given sum of three consecutive squares sums to the square $$(x+n)^2$$, $$n$$ being a positive integer like $$x$$. Thus the statement or proposition we conjecture to be true is

$$(x-1)^2+x^2+(x+1)^2=(x+n)^2\tag{1}$$

which simplifies to $$2x^2+2=2nx+n^2\tag{2}$$

Since the left hand side of equation 2 is even, it immediately follows that n must be even. Thus let $$n=2m$$ giving

$$x^2+1=2mx+2m^2\tag{3}$$

Now from (3) we can immediately say that $$x$$ must be odd. Thus let $$x=2u-1$$, where u is any non-zero positive integer. Substituting for $$x$$ on the left hand side, (3) then simplifies to

$$2u^2-2u+1=mx+m^2\tag{4}$$

The left hand side of (4) is always odd, therefore $$m$$ cannot be even. However if $$m$$ is odd with $$x$$ odd as required above, $$mx+m^2$$ will always be even. [The result of multiplying two odd whole numbers together is always odd, as proved by for example by algebraicly multiplying $$(2u-1)$$ and $$(2v-1)$$.]

Therefore we have reached a contradiction, as $$x$$ cannot be both odd and even at the same time, and so the original conjecture (1) must be false.