Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm given the sum of even squares to be $\frac{2n(n+1)(2n+1)}{3}$ e.g. 4+16+36+...

I'm also given the sum of odd squares to be $\frac{n(2n-1)(2n+1)}{3}$ 1+9+25+...

The problem is to find the summation formula of the series 1-4+9-16+25-... using the above facts.

I know I can write the sum of the even starting at 0 (e.g. 0+4+16+36+...) by $\frac{2(n-1)((n-1)+1)(2(n-1)+1)}{3}$ but I cannot figure out how to combine them to get the target series ( 1-4+9-16+25-...)

When just subtracting the evens starting from zero from the odds I always seem to get a sum that has more of the series than I want (1,6,15,28) when it should give (1,-3,6,-10) can anybody point me in the right direction?

share|cite|improve this question
What about separately considering the cases of n odd and n even? If n is odd, there's one more odd square than even. If n is even, there are equal numbers of odd and even squares. Though from the first few results, you might have a good guess already. – Mike Jan 11 '12 at 5:49
We have been given two gift expressions, one for the sum of the first $n$ even squares and one for the sum of the first $n$ odd squares. Throw away the second gift expression, divide the first gift expression by $4$. You get the formula for the sum of the first $n$ squares. (Presumably that's not what is intended, too simple!) – André Nicolas Jan 11 '12 at 6:55
First, please state when your sums begins and when it ends. It should just make the task easier to evaluate the sum. And similarly for 1-4+9-16 : do they both start from k=1 and stop at n ? And by the way your relation for the sum of the odds is only correct for n nonzero. – user20010 Jan 11 '12 at 9:48
@Ismail: The formulas are clearly intended to give the sum of the first $n$ positive even and odd squares, respectively, so they both work fine for $n=0$. – Brian M. Scott Jan 11 '12 at 10:33
up vote 2 down vote accepted

Let $e_n$ be the sum of the squares of the first $n$ even positive integers, and let $o_n$ be the sum of the squares of the first $n$ odd positive integers; you have formulas for these. Let $s_n$ be the sum of the first $n$ terms of the target series, $1-4+9-16+-\dots$. Consider two cases, $n$ even and $n$ odd. (Note that I will be assuming throughout that $n$ is a positive integer.)

Suppose that $n$ is even, say $n=2m$. Then $$\begin{align*} s_n&=s_{2m}\\ &=o_m-e_m\\ &=\frac{m(2m-1)(2m+1)}3-\frac{2m(m+1)(2m+1)}3\\ &=\frac{m(2m+1)}3\Big((2m-1)-2(m+1)\Big)\\ &=-m(2m+1)\;. \end{align*}$$

Now suppose that $n$ is odd, say $n=2m+1$. Then $$\begin{align*} s_n&=s_{2m+1}\\ &=o_{m+1}-e_m\\ &=\frac{(m+1)(2m+1)(2m+3)}3-\frac{2m(m+1)(2m+1)}3\\ &=(m+1)(2m+1)\;. \end{align*}$$

Let’s run a quick spot-check. The first formula yields $s_4=-10$, which is correct, and the second yields $s_5=15$, which is also correct. All that remains is to combine them into a single nice expression, if possible. We have

$$s_n=\begin{cases} -m(2m+1),&\text{if }n=2m\\ (m+1)(2m+1),&\text{if }n=2m+1\;. \end{cases}$$

The algebraic sign is easily taken care of with a factor of $(-1)^{n+1}$, and $$\lceil n/2\rceil=\begin{cases} m,&\text{if }n=2m\\ m+1,&\text{if }n=2m+1\;, \end{cases}$$

so it only remains to handle the factor of $2m+1$. This can be done in many ways, but since we’re already using $\lceil n/2\rceil$, one easy way is to note that $2m+1=2\lceil n/2\rceil+(-1)^n$ no matter whether $n=2m$ or $n=2m+1$. Thus, we can finally write $$s_n=(-1)^{n+1}\left\lceil\frac{n}2\right\rceil\left(2\left\lceil\frac{n}2\right\rceil+(-1)^n\right)\;,$$ or, if you prefer, $$s_n=2(-1)^{n+1}\left\lceil\frac{n}2\right\rceil^2-\left\lceil\frac{n}2\right\rceil\;.$$

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.