0

If $1+2+3+...+r$ is in otherwords $\frac{r(r+1)}{2}$, then what is the answer with squares?

Thank you for all the help.

Eric Stucky
  • 12,758
  • 3
  • 38
  • 69
  • The answer to the question that is not in the title is $\frac{r(r+1)(2r+1)}{6}$. – Marc May 27 '14 at 19:41
  • http://en.wikipedia.org/wiki/Square_pyramidal_number, seriously –  May 27 '14 at 19:42
  • 4
    @EdvinOrlov: It's not remotely fair to expect someone to think of "square pyramidal" as a descriptor for that kind of number, particularly if they aren't familiar with the triangular numbers. Searching google for 1^2+2^2+3^2+4^2 (for me) gives a correct formula in a link, but neither the name of the numbers nor the linked Wikipedia page. – Eric Stucky May 27 '14 at 19:48
  • @EricStucky, if one writes in google "sum of squares", the first link is http://en.wikipedia.org/wiki/Sum_of_squares, then the first under Number Theory, is "For the sum of squares of consecutive integers, see Square pyramidal number". It is not that difficult to find imho. –  May 27 '14 at 20:20

2 Answers2

3

$$1^2+2^2+3^2+\ldots+n^2= \sum_{k=1}^nk^2 = \frac{n(n + 1)(2n + 1)}{6} = \frac{2n^3 + 3n^2 + n}{6}. $$

Proof by induction:

For all $n \in \mathbb N$, let $P \left({n}\right)$ be the proposition:

$$ \sum_{i \mathop = 1}^n i^2 = \frac{n \left({n+1}\right)\left({2n+1}\right)} 6 .$$

When $n = 0$, we see from the definition of vacuous sum that:

$$0 = \sum_{i \mathop = 1}^0 i^2 = \frac{0 \left({1}\right)\left({1}\right)} 6 = 0 .$$

and so $P(0)$ holds.

Base Case

When $n=1$, we have $\displaystyle \sum_{i \mathop = 1}^1 i^2 = 1^2 = 1.$

Now, we have:

$$ \displaystyle \frac {n \left({n + 1}\right) \left({2 n + 1}\right)} 6 = \frac {1 \left({1 + 1}\right) \left({2 \cdot 1 + 1}\right)} 6 = \frac 6 6 = 1 .$$

So $P(1)$ is true. This is our base case.

Induction Hypothesis

Now we need to show that, if $P \left({k}\right)$ is true, where $k \geqslant 1$, then it logically follows that $P \left({k+1}\right)$ is true.

So this is our induction hypothesis:

$$\displaystyle \sum_{i \mathop = 1}^k i^2 = \frac {k \left({k + 1}\right) \left({2 k + 1}\right)} 6 .$$

Then we need to show:

$$\sum_{i \mathop = 1}^{k+1} i^2 = \frac{\left({k+1}\right) \left({k+2}\right) \left({2 \left({k+1}\right) + 1}\right)} 6 .$$

This is our induction step:

Using the properties of summation, we have:

$$ \sum_{i \mathop = 1}^{k+1} i^2 = \sum_{i \mathop = 1}^k i^2 + \left({k+1}\right)^2 .$$

We can now apply our induction hypothesis, obtaining:

$$\begin{align*} \sum_{i \mathop = 1}^{k+1} i^2 &= \displaystyle \displaystyle \frac{k \left({k + 1}\right) \left({2 k + 1}\right)} 6 + \left({k + 1}\right)^2 \\ &= \displaystyle \displaystyle \frac{k \left({k + 1}\right) \left({2 k + 1}\right) + 6 \left({k + 1}\right)^2} 6 \displaystyle \displaystyle \\ &= \displaystyle \displaystyle \frac{\left({k + 1}\right) \left({k \left({2 k + 1}\right) + 6 \left({k + 1}\right)}\right)} 6 \displaystyle \displaystyle \\ &= \frac{\left({k + 1}\right) \left({2 k^2 + 7 k + 6}\right)} 6 \\ &= \frac{\left({k + 1}\right) \left({k + 2}\right) \left({2 \left({k + 1}\right) + 1}\right)} 6 \displaystyle \displaystyle \end{align*} $$

So $P \left({k}\right) \implies P \left({k+1}\right)$ and the result follows by the Principle of Mathematical Induction.

Therefore:

$$\displaystyle \forall n \in \mathbb N: \sum_{i \mathop = 1}^n i^2 = \frac {n \left({n + 1}\right) \left({2 n + 1}\right)} 6 .\rlap{\color{white}{\mathbf l}}{\tag{$\blacksquare$}}$$

For a general formula for the sum $1^m+2^m+3^m+\cdots+n^m$, where $m$ and $n$ are positive integers, you can use Faulhaber's formula which says that: $$\sum_{k \mathop = 1}^n k^p = \frac 1 {p + 1} \sum_{i \mathop = 0}^p \left({-1}\right)^i \binom {p + 1} i B_i n^{p + 1 - i}$$ where $B_n$ denotes the $n^{\displaystyle\text{th}}$ Bernoulli number.

Hakim
  • 10,213
1

Are you familiar with summation notation? You stated that: $$\sum_{k = 1}^{r}k = \frac{r(r+1)}{2}$$

In fact, there is a closed expression for what you need, and it is: $$\sum_{k=1}^{r} k^2= \frac{r(r+1)(2r+1)}{6}$$

You can prove this using induction. However, there is another way:

We expand: $$\sum_{k = 1}^{r}(k+1)^3 = \sum_{k = 1}^{r} k^3 + 3\sum_{k=1}^{r}k^2 + 3 \sum_{k=1}^{r} k + n$$

Now, we do an adjust on the left side, making $i = k+1$. Then: $$\sum_{i = 2}^{r+1}i^3 = \sum_{k = 1}^{r} k^3 + 3\sum_{k=1}^{r}k^2 + 3 \frac{r(r+1)}{2} + n$$

It follows that: $$\sum_{i = 1}^{r} i + (r+1)^3 - 1 = \sum_{k = 1}^{r} k^3 + 3\sum_{k=1}^{r}k^2 + 3 \frac{r(r+1)}{2} + n$$

Now the summation with the cubes will cancel, and we get:$$(r+1)^3 - 1 = 3\sum_{k=1}^{r}k^2 + 3 \frac{r(r+1)}{2} + n$$

Then, manipulating it to isolate $\sum_{k=1}^r k^2$, we get the desired expression. Ok?

Ivo Terek
  • 77,665