$1-x+x^2-x^3+..(-1)^nx^n$ I have the following sum:
$1-x+x^2-x^3+..(-1)^nx^n, x\neq -1$
So what I thought was separating it in two cases like this:
Case 1. n is even
$$
1+x^2+x^4+...+x^n-x(1+x^2+...+x^n)
$$
Which I can turn into $\frac{1-x^{n+2}}{1-x^2}-\frac{x(1-x^{n+2})}{1-x^2}=\frac{1-x^{n+2}}{1-x^2}(1-x)$
Case 2. n is odd
$$
1+x^2+x^4+...+x^{n-1}-x(1+x^2+...+x^{n-1})=\frac{1-x^{n+1}}{1-x^2}-x(\frac{1-x^{n+1}}{1-x^2})
$$
My question is: Assuming what I've written is correct, which I'm not entirely sure, how can I combine the two cases for n even and odd into one equation?

Call $S(x)$ your sum and note that 
$$
S(x)(1+x)=1+(-1)^{n}x^{n+1}.
$$
