I am self studying proof by induction and tried some tasks, but im stuck with this one and i can't comprehend the solution.
- Proof by induction that, for all positive integers n, $\sum_{i=1}^{n} (-1)^i i^2 = \frac{(-1)^n n(n+1)}{2} $
Proof:
when n=1
$\sum_{i=1}^{1} (-1)^1 1^2 = \frac{(-1)^1 1(1+1)}{2} $
$-1=-1$
$\therefore$ true when $n=1$
Assume true when $n=k$
$\sum_{i=1}^{k} (-1)^i i^2 = \frac{(-1)^k k(k+1)}{2} $
when $n=k+1$
$\sum_{i=1}^{k+1} (-1)^i i^2 = \frac{(-1)^{k+1} (k+1)((k+1)+1)}{2} $
$\sum_{i=1}^{k} (-1)^i i^2+(-1)^{k+1} (k+1)^2 = \frac{(-1)^{k+1} (k+1)((k+1)+1)}{2} $
$\frac{(-1)^k k(k+1)}{2}+(-1)^{k+1} (k+1)^2 = \frac{(-1)^{k+1} (k+1)((k+1)+1)}{2} $
This is how far I got and I cant get get further with the left side. I think I'm missing some easy algebra. The solution's next step (for the left side of the eq.) was:
$= \frac{(-1)^k(k+1)}{2}\cdot(k-2(k+1))$
$= \frac{(-1)^k(k+1)}{2}\cdot(-k-2)$
$= \frac{(-1)^{k+1}(k+2)}{2}$
\begin{align} \frac{(-1)^k k(k+1)}{2}+(-1)^{k+1} (k+1)^2 &= (-1)^k(k+1) \left( \frac{k}{2} + (-1)(k+1) \right)\\ &= (-1)^k(k+1) \left( \frac{k}{2} -k -1 \right)\\ &= (-1)^k(k+1) \left( -\frac{k}{2} -1 \right)\\ &= -(-1)^k(k+1) \left( \frac{k}{2} + 1 \right)\\ &= -(-1)^k(k+1) \frac{k+2}{2}\\ &= \frac{(-1)^{k+1}(k+1)((k+1)+1)}{2} \end{align}