online advertising

Sunday, February 19, 2017

An interesting sum

Problem:

$ 1^2 - 2^2 + 3^2 - 4^2 + \cdots - (2n)^2 $

Solution:

We will assume the formula:

$ 1 + 2 + \cdots + n = \frac{n(n+1)}{2} $

$ 1^2 + 2^2 + \cdots + n^2 = \frac{n(n + 1)(2n + 1)}{6} $

We split the sum into two halves:

$ 1^2 + 3^2 + 5^2 + \cdots + (2n - 1)^2 $ can be think of as

$ (2 \times 0 + 1)^2 + (2 \times 1 + 1)^2 + \cdots + (2 \times (n - 1) + 1)^2 $

Expanding them we get

$ (4 \times 0^2 + 4 \times 0 + 1) + (4 \times 1^2 + 4 \times 1 + 1) + \cdots + (4(n-1)^2 + 4(n-1) + 1) $.

Grouping terms, factoring and applying the formula, we get

$ 4\frac{(n - 1)(n)(2n - 1)}{6} + 4\frac{(n-1)(n)}{2} + n $

Simplifying we get

$ \frac{n(2n - 1)(2n + 1)}{3} $

The even number squared sum is easier, we can think of them as just a scaled version of the square sum

$ 2^2 + 4^2 + \cdots + (2n)^2 $

$ 4(1^2 + 2^2 + \cdots + n^2) $

The answer is simply $ \frac{2n(n + 1)(2n + 1)}{3} $

Therefore, the final answer is simply the difference of the two sums, and it is

$ -n(2n + 1) $




No comments:

Post a Comment