<s>[INST] Prove $1^2-2^2+3^2-4^2+......+(-1)^{k-1}k^2 = (-1)^{k-1}\cdot \frac{k(k+1)}{2}$ I'm trying to solve this problem from Skiena book, "Algorithm design manual".
I don't know the answer but it seems like the entity on the R.H.S is the summation for series $1+2+3+..$. However the sequence on left hand side is squared series and seems to me of the form:
$-3-7-11-15\ldots $
I feel like its of the closed form:
$\sum(-4i+1)$
So how do I prove that the equality is right?
 [/INST] i) $k=2n$:
\begin{align}
\sum_{m=1}^{2n}(-1)^{m-1}m^2&=\sum_{m=1}^{2n}m^2-2\sum_{m=1}^{n}(2m)^2\\
&=\sum_{m=1}^{2n}m^2-8\sum_{m=1}^{n}m^2\\
&=\frac{2n(2n+1)(4n+1)}{6}-8\frac{n(n+1)(2n+1)}{6}\\
&=\frac{2n(2n+1)(4n+1-4n-4)}{6}\\
&=\frac{2n(2n+1)(-1)}{2}=-\frac{k(k+1)}{2}=(-1)^{k-1}\frac{k(k+1)}{2}
\end{align}
ii)$k=2n+1$:
\begin{align}
\sum_{m=1}^{2n+1}(-1)^{m-1}m^2&=(2n+1)^2+\sum_{m=1}^{2n}(-1)^{m-1}m^2\\
&=(2n+1)^2+\frac{2n(2n+1)(-1)}{2}\\
&=\frac{(2n+1)(4n+2-2n)}{2}=\frac{k(k+1)}{2}=(-1)^{k-1}\frac{k(k+1)}{2}
\end{align}
</s>