How do I find a closed formula for the following?
$$\sum_{i=1}^n(-1)^{i-1}i$$
If $n$ is odd number, I can express it as $\frac{n+1}{2}$; if $n$ is even, then the expression if $\frac{-n}{2}$, but how do you find a expression that can express it in one formula?
We can use $(-1)^n$ to distinguish positive and negative terms: $$ \frac{-n\cdot(-1)^n+\frac{1-(-1)^n}2}2=\frac{1 + (-1)^{n+1}(1+2n)}{4} $$