Question 48744
Hi,

So we need to find a formula for *[tex \sum_{j=1}^N\,(-1)^{j+1}x^j]

To figure out what's actually happenning, lets write out a few terms (I'm only going to work with even N for now)

*[tex x - x^2 + x^3 - x^4 + x^5 -x^6 \ldots]

Or splitting this into two sequences.

*[tex x + x^3 + x^5 + \ldots]
*[tex -( x^2 + x ^4 + x^6 + \ldots)]

You should be able to see that the first sequence is just a factor of -x different from the first.

The sequence clearly has N/2 terms(remember I'm assuming N even at moment)

Using the formula for a geometric series (1-x^n)/(1-x) I'm sure you've seen it, we can see that the sequence we want

*[tex x^2 + x^4 + x^6 + \ldots + x^{2n}]

where *[tex n=1+\lfloor N/2 \rfloor] is given by

*[tex \frac{ x^{2\lfloor 1+\frac{N}{2} \rfloor} - 1}{x^2 - 1} - 1]

Using this and the fact we want *[tex 1/x] and *[tex -1] copies of this sequence we get the general formula (lots of tidying up)

*[tex \frac{x^2 - x^{2\left\lfloor 1+\frac{N}{2} \right\rfloor}}{x(x+1)}]

However, we haven't dealt with the n=odd case. If you try out a few examples you will note that when n is odd there is an extra term *[tex x^N] So we need to add this when n is odd. The easiest way to do this is with a function that is 1 for odd and 0 for even.

Adding *[tex -\frac{(-1)^N-1}{2}x^N] gives the final answer of

*[tex \frac{x^2 - x^{2\left\lfloor 1+\frac{N}{2} \right\rfloor}}{x(x+1)} -\frac{(-1)^N-1}{2}x^N]

It's quite possible I've made a mistake, but I've checked it with a few cases and it works so I'm pretty confident.

Of course the geometric formula isn't valid for x=1, so neither is this. I'll let you solve that case your self - it's pretty simple though.

Hope that helps,
Kev