<s>[INST] Prove that $1^2 - 2^2 + 3^2 - 4^2 + \cdots + (-1)^{n-1}n^2 = \frac12(-1)^{n-1} n (n + 1)$, where $n $ is a positive integer 
Prove that $1^2 - 2^2 + 3^2 - 4^2 + \cdots + (-1)^{n-1}n^2 = \frac12(-1)^{n-1} n (n + 1)$, where $n $ is a positive integer

How do I prove the above expression using mathematical induction? So far I have only been proving simpler stuff. The base case P(1) is easy enough but I am lost as to where I should even start with my inductive step. I really don't know what the steps for P(k + 1) should be, and so help would be greatly appreciated.
 [/INST] If $n$ is even,
$$
\begin{align}
\sum_{k=1}^n(-1)^{k-1}k^2
&=\sum_{k=1}^{n/2}\left[(2k-1)^2-(2k)^2\right]\\
&=\sum_{k=1}^{n/2}\left[1-4k\right]\\
&=-\frac{n^2+n}2
\end{align}
$$
If $n$ is odd, $n-1$ is even.
$$
\begin{align}
\sum_{k=1}^n(-1)^{k-1}k^2
&=n^2+\sum_{k=1}^{n-1}(-1)^{k-1}k^2\\
&=n^2-\frac{n^2-n}2\\
&=\frac{n^2+n}2
\end{align}
$$
Therefore,
$$
\sum_{k=1}^n(-1)^{k-1}k^2=(-1)^{n+1}\frac{n^2+n}2
$$
</s>