Sum of alternating sign squares of integers stuck with proof by induction Note that
$$
A(1):1=1\\A(2):1-4=-(1+2)\\A(3):1-4+9=1+2+3\\A(4):1-4+9-16=-(1+2+3+4)
$$
Let us set up the $A(k)$:
$$
A(k)=1-4+9-…+(-1)^{k+1}k^2=(-1)^{k+1}(1+2+…+k)
$$
Setting up $A(k+1)$:
$$
A(k+1)=1-4+9-…+(-1)^{k+1+1}(k+1)^2=(-1)^{k+1+1}(1+2+…+k+(k+1))
$$
Knowing that:
$$
1+2+…+n=\frac{n(n+1)}{2}
$$
We simplify right hand sides of $A(k)$ and $A(k+1)$:
$$
A(k)=(-1)^{k+1}(1+2+…+k)=(-1)^{k+1}\frac{k(k+1)}{2}\\A(k+1)=(-1)^{k+1+1}(1+2+…+k+(k+1))=(-1)^{k+1+1}\frac{(k+1)(k+2)}{2}
$$
Then I am trying to show that right hand side of $A(k+1)$ is equal to $A(k) + (-1)^{k+1+1}(k+1)^2$, but it does not work for me. That is what I am getting:
$$
A(k+1)=(-1)^{k+1+1}\frac{(k+1)(k+2)}{2}=(-1)^{k+1+1}\frac{k^2+2k+k+2}{2}=(-1)^{k+1+1}(\frac{k(k+1)}{2}+(k+1))=(-1)A(k)+(-1)^{k+1+1}(k+1)=-(A(k)+(-1)^{k+1}(k+1))
$$
What am I doing wrong?
How to prove $A(k)$ by induction?

To prove it by induction, first show by calculation that $A(1)$ is true.  Then we assume $A(n)$ is true and try to show $A(n+1)$ is true.  So we assume $\displaystyle \sum_{i=1}^n (-1)^{i+1} i^2=(-1)^{n+1}\frac 12 n(n+1)$.  Now we evaluate the left side of $A(n+1)$  $$\begin {align} \sum_{i=1}^{n+1} (-1)^{i+1} i^2&=(-1)^{n+1}\frac 12 n(n+1)+(-1)^{n+2}(n+1)^2 \\&=(-1)^{n+2}\left((n+1)^2-\frac 12n(n+1) \right)\\&=(-1)^{n+2}\left((n+1)(n+1-\frac 12n) \right)\\&=(-1)^{n+2}\left(\frac 12(n+1)(n+2) \right)\end {align}$$ and we have derived $A(n+1)$
