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

During a test, I was told to calculate the exact value of this: $$S=1^2+2^2+3^2+\cdots+10000$$

This is what I did:

Observe the following: $$(S=1^2+2^2+3^2+\cdots+100^2)\wedge (S=100^2+\cdots+3^2+2^2+1^2)$$ Is true. Therefore, $$2S = (1^2+2^2+3^2+\cdots+100^2) + (100^2+\cdots+3^2+2^2+1^2) = 100\cdot101^2$$ So, $$S=50\cdot(101^2)$$ $$=50\cdot10201$$ $$=510050$$

I was wrong.

There was no explanation in the result page, so I am not very sure what went wrong. But yeah, upon returning home, I tried to evaluate this with Java:

int x = 0;
for (int i = 1; i <= 100; ++i) {
    x += Math.pow(i,2);

It returns $338350$.

Could you tell me what did I do wrong? It may seem obvious, but clearly I'm not able to see it.

Furthermore, apparently this kind of question is under the category of mathematical induction. Honestly, the only thing I've been doing with induction was prove some equalities, inequalities and divisibility. How is this exactly related to induction?

share|cite|improve this question (Proof by Induction - The sum of the squares of the first n natural numbers is n(n+1)(2n+1)/6) – Amzoti Dec 1 '12 at 2:03
Ooops, notice that $a^2+b^2\ne(a+b)^2$ unless $ab=0$. – Frenzy Li Dec 1 '12 at 2:10
Try the same method, but calculate $S=1^2+2^2$, and see what happens. – MJD Dec 1 '12 at 12:57
up vote 8 down vote accepted

You were trying to imitate one of the standard ways to find $1+2+3+\cdots+n$.

However, that procedure does not work for the sum of the squares. For $1^2+100^2$ is not equal to $101^2$, $2^2+99^2$ is not equal to $101^2$, and so on.

There is a standard formula for the sum of the first $n$ perfect squares. It is $$1^2+2^2+\cdots +n^2=\frac{n(n+1)(2n+1)}{6}.$$

Probably, given the context, you were expected to know this formula, or a procedure for deriving it, since discovering it, under exam time pressure, is not easy.

If we are given the formula, and asked to prove it is correct, it is not particularly difficult to do so, using mathematical induction.

share|cite|improve this answer
... Oh damn it. You're right, we were given that formula very long ago... now I remember... – Zol Tun Kul Dec 1 '12 at 3:09

$$ \begin{array}{cccccc} 1^2 & + & 2^2 & + & 3^2 & + & \cdots \\ 100^2 & + & 99^2 & + & 98^2 & + & \cdots \\[15pt] 10001 & + & 9805 & + & 9613 & + & \cdots \end{array} $$ The numbers in the last row are just the sums of the numbers above them. The problem with your argument is that it assumes these 100 numbers are all equal. They're not. If we'd had first powers instead of squares, they'd all be equal.

share|cite|improve this answer

$$(1^2+2^2+3^2+\cdots+100^2) + (100^2+\cdots+3^2+2^2+1^2) = 100\cdot101^2$$ is wrong since $n^2 + (101-n)^2 \neq 101^2$.

Note that $$(1^1+2^1+3^1+\cdots+100^1) + (100^1+\cdots+3^1+2^1+1^1) = 100\cdot101^1$$ works because $n + (101-n) = 101$.

share|cite|improve this answer

To add to Marvis' answer, that equality is wrong because, for example, $100^2$ + $1^2$ is not equal to $101^2,$ which I think was part of your reasoning for that equality. In general, $(a+b)^2$ is not equal to $a^2 + b^2$ unless one of $a$ and $b$ is $0.$

share|cite|improve this answer
I would say "...unless one of $a$ or $b$ is zero" (or both). – Pedro Tamaroff Dec 1 '12 at 2:08

You seem to have assumed that the sum of the squares of 2 numbers is equal to the square of their sum which is not true.

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.