I found this odd relationship, $x^2 = \sum_\limits{k = 0}^{x-1} (2k + 1)$. [duplicate]

I stumbled across this relationship while I was messing around. What's the proof, and how do I understand it intuitively? It doesn't really make sense to me that the sum of odd numbers up to $2x + 1$ should equal $x^2$.


How do I understand it intuitively? It doesn't really make sense to me that the sum of odd numbers up to $2x+1$ should equal $x^2$

Hope this picture will provide you with the visual aid you need. :-)


Yet another picture for illustration:

enter image description here


Recall that:

$$\sum_{k=0}^{x}k = \frac{x(x+1)}{2}$$

Then

$$\sum_{k=0}^x(2k + 1) = 2\sum_{k=0}^x k + \sum_{k=0}^x1 = x(x+1) + (x+1) = x^2 + 2x + 1 \neq x^2$$

Instead, since $x^2 + 2x + 1= (x+1)^2$, then

$$\sum_{k=0}^x(2k + 1) = (x+1)^2$$

Using $x-1$ in place of $x$, then you have:

$$\sum_{k=0}^{x-1}(2k + 1) = x^2$$


We prove this via induction.

Base case ($x = 1$): $$1^2 = \sum_{k=0}^{1-1} (2k+1) = \sum_{k=0}^0 (2k+1) = 2\cdot 0+1 = 1$$

Inductive step: Suppose it is true for some $x$. Now, we note that $$(x+1)^2 = x^2 + 2x + 1$$

and that

$$\sum_{k=0}^{x+1-1} (2k+1) = \sum_{k=0}^{x-1} (2k+1) + 2x+1$$


The standard proof without words is as follows:

1   12    123    1234    ...
    22    223    2234
          333    3334
                 4444