Yesterday I was asked by a friend how many squares are in a chess board of $8\times 8$. I thought about 64 immediately, but of course this is not the solution, there are much more.
So the number of squares is: $8\times 8 + 7\times 7 + 6\times 6 + 5\times 5 + 4\times 4 + 3\times 3 + 2\times 2 + 1\times 1=1^2 + 2^2 + 3^2 + 4^2...+ 8^2$
I came across this formula: $\frac{n(n + 1)(2n + 1)} 6$
It produces the sum of squares in $n\times n$ board.
My question is, how did he reached this formula? Did he just guessed patterns until he reached a match, or there is a mathematical process behind?
If there is a mathematical process, can you please explain line by line?
Thanks very much.
Btw: Couldn't find matching tags for this question, says I can't create.