<s>[INST] Nicomachus theorem proof - what did I do wrong? The exercise asked me to proof
$1^3=1$
$2^3=3+5$
$3^3=7+9+11$
$...$
I formulate the equation as
(1)$$a^3 = \sum_{i=0}^{a-1} (a-1)a+1+2i$$
Proof base case:
$$1^3=\sum_{i=0}^{1-1} (1-1)(1)+1+2i=1$$
Proof (a+1) case:
(2) $$(a+1)^3=a^3+3a^2+3a+1$$
(3) $$(a+1)^3=\sum_{i=0}^{(a+1)-1}((a+1)-1)(a+1)+1+2i=\sum_{i=0}^{a}(a)(a+1)+1+2i$$
factor out last summation term, so number of iterations match (1):
$$\sum_{i=0}^{a-1}[(a)(a+1)+1+2i]+(a)(a+1)+1+2a=\sum_{i=0}^{a-1}[(a)(a+1)+1+2i]+a^2+3a+1$$
rearrange the summation term, so part of equation match (1):
$$\sum_{i=0}^{a-1}[(a)(a-1)+1+2i]+\sum_{i=0}^{a-1}(2a)+a^2+3a+1$$
substitute summation with (1):
(4) $$a^3+\sum_{i=0}^{a-1}(2a)+a^2+3a+1=a^3+(2a)(a-1)+a^2+3a+1=a^3+3a^2+a+1$$
From (2) I got $a^3+3a^2+3a+1$ but from (3) & (4) I got $a^3+3a^2+a+1$
My result with induction is off by 2a. Can someone please help me to understand where I did wrong?
 [/INST] There are simpler ways to prove this relation.
The sum $\displaystyle S(n)=\sum\limits_{i=0}^n i=\frac{n(n+1)}{2}$ is well known and easy to prove, for instance
$\begin{align}2S(n)&=\bigg(1+2+\cdots+(n-1)+n\bigg)+\bigg(n+(n-1)+\cdots+2+1\bigg)\\&=\bigg((n+1)+(n+1)+\cdots+(n+1)\bigg)\\&=n(n+1)\end{align}$
Then notice $(a-1)a+1$ does not depend on the summation index $i$, thus we can factor it out of the sum and multiply by the number of terms.
$\begin{align}\sum\limits_{i=0}^{a-1}((a-1)a+1+2i)&=((a-1)a+1)\times a+2\sum\limits_{i=0}^{a-1}i\\&=(a^3-a^2+a)+2S(a-1)\\&=(a^3-a^2+a)+(a-1)a\\&=a^3\end{align}$

Now to come back to your solution, it is a bit confusing because in (2) you start from your result, then go back to your starting point and try to match both...
In any case, this method involves also factorizing constant values out of the sum so the previous method is more straightforward in this regard.
$\begin{align}(a+1)^3&=(a^3)+(3a^2+3a+1)
\\&=\sum\limits_{i=0}^{a-1}((a-1)a+1+2i)+(3a^2+3a+1)&\text{induction hypothesis P(a)}
\\&=\sum\limits_{i=0}^{a-1}((a+1)a+1+2i)-\underbrace{\sum\limits_{i=0}^{a-1}(2a)}_{-2a^2}+(3a^2+3a+1)&\text{shift formula by 2a, remove the excess}
\\&=\sum\limits_{i=0}^{a-1}((a+1)a+1+2i)+(a^2+3a+1)&\text{simplify constant sum}
\\&=\sum\limits_{i=0}^{a}((a+1)a+1+2i)-\underbrace{((a+1)a+1+2a)}_{a^2+3a+1}+(a^2+3a+1)&\text{add/remove last term of sum}
\\&=\sum\limits_{i=0}^{a}((a+1)a+1+2i)&\text{after cancelling terms P(a+1) is verified}\end{align}$
You pretty much got all of these ideas, so mostly it is a question of organizing your calculations in a way that is less prone to mistakes (negative sign forgotten or missed term, ...).
</s>