Question: How to derive this formula? 

$$n^2=\sum\_{k=1}^n(2k-1).$$

Answer: 
*[Notice](http://en.wikipedia.org/wiki/Square_number#Properties) how the difference of two consecutive squares is always an odd number:* $$(x+1)^2=x^2+(2x+1)$$
[![Image](https://i.stack.imgur.com/CJiZi.png)](http://betterexplained.com/articles/surprising-patterns-in-the-square-numbers-1-4-9-16/)
Well, since other had given formulae for calculating this sum, I will write a summing method from my primary school days: For $n=5$,

$$\begin{array}{c|c|c|c|c}
\times&\times&\times&\times&\times\\\hline
\color{red}\bigcirc&\color{red}\bigcirc&\color{red}\bigcirc&\color{red}\bigcirc&\times\\\hline
\times&\times&\times&\color{red}\bigcirc&\times\\\hline
\color{red}\bigcirc&\color{red}\bigcirc&\times&\color{red}\bigcirc&\times\\\hline
\times&\color{red}\bigcirc&\times&\color{red}\bigcirc&\times
\end{array}$$