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/)
You could use mathematical induction to do this:
First prove the statement for n=1 (or 0 if you like) and then prove that if it holds for n=k, it is also true for n=k+1. (You can do the last part by looking at differences between consecutive squares for example.)