Show (via differentiation) $1-2+3-4+\cdots+(-1)^{n-1}n$ is $-\frac{n}{2}$ for $n$ even, $\frac{(n+1)}{2}$ for $n$ odd. i) By considering $(1+x+x^2+\cdots+x^n)(1-x)$ show that, if $x\neq 1$,
$$1+x+x^2+\cdots+x^n=\frac{(1-x^{n+1})}{1-x}$$
ii) By differentiating both sides and setting $x=-1$ show that
$$1-2+3-4+\cdots+(-1)^{n-1}n$$
takes the value $-\frac{n}{2}$ if n is even and the value $\frac{(n+1)}{2}$ if n is odd.
For part i) I just simplified the LHS, divided by $(1-x)$ and got the desired result.
For the next part I found the derivative of both sides, and set $x=-1$ giving me:
$$1-2+3-4+\cdots+(-1)^{n-1}n = \frac{(2)(-1(n+1)(-1)^n)-(1-x^{n+1})(-1)}{4} = \frac{-2(n+1)(-1)^n+1+(-1)^{n+2}}{4}$$
However I'm not understanding the part about n being even and odd. If n is even, does this mean that $n = 2n$ and if it is odd, $n = 2n+1/2n-1$? What would be the next step?
Thanks

If $n$ is even, $n = 2k$ for some integer $k$. Then $(-1)^n = (-1)^{2k} = ((-1)^2)^k = 1^k = 1$ and $(-1)^{n + 2} = (-1)^n\times(-1)^2 = 1\times 1 = 1$. Therefore, we have 
\begin{align*}
\frac{-2(n+1)(-1)^n + 1 +(-1)^{n+2}}{4} &= \frac{-2(n+1)\times 1 + 1 + 1}{4}\\ 
&= \frac{-2(n+1) + 2}{4}\\ 
&= \frac{-2n -2 + 2}{4}\\ 
&= \frac{-2n}{4}\\ 
&= -\frac{n}{2}.
\end{align*}
Can you follow the steps to do the odd case?
