# Homework Help: Formula for the alternating sum of the first n numbers.

1. Jul 22, 2011

### Why?

1. The problem statement, all variables and given/known data
The alternating sum of the first five numbers is 1-2+3-4+5=3. Find a formula for the alternating sum of the first n numbers. How about the alternating sum of the squares of the first n numbers?

2. Relevant equations

Sum of the first n numbers. $\frac{n(n+1)}{2}$

Sum of the first n even numbers. n(n+1)

Sum of the first n odd numbers. n2

3. The attempt at a solution

Sum of the first n alternating numbers if n is odd. ${(\frac{n+1}{2}})^{2}-(\frac{n-1}{2})({\frac{n-1}{2}+1})$

Sum of the first n alternating numbers if n is even. ${(\frac{n}{2}})^{2}-(\frac{n}{2})({\frac{n}{2}+1})$

I cannot figure out how to combine these two equations into one that will work for both odd and even n. I have not even begun the second part of the problem.

2. Jul 22, 2011

### Bohrok

Maybe you should consider the first few partial sums of the alternating series and find a formula from that.

3. Jul 22, 2011

### Ray Vickson

Do you know the formula for Sn(x) = sum{x^k,j=1..n}? Have you looked at the summation for Tn(x) = x*dSn(x)/dx? Can you see how to continue from there?

RGV

4. Jul 22, 2011

### HallsofIvy

Two excellent resposes.

(Darn, leave me nothing to say.)