# Little Bird and a Recursive Generator When I was asked to prove the following power summation formulas by mathematical induction: $\sum\limits_{i=1}^{n}i = 1+2+3+...+n=\frac{n (n+1)}{2}$, $\sum\limits_{i=1}^{n}i^2=1^2+2^2+3^2+...+n^2= \frac{n (n+1) (2n +1)}{6}$, $\sum\limits_{i=1}^{n}i^3=1^3+2^3+...+n^3 = \frac{n^2 (n+1)^2}{4}$,

I wondered how these closed forms are obtained in the first place!  Did a little bird whisper the formulas into our ears?

Even though there are elementary derivations of the power summation formulas, for example,  the visual derivations in Proof Without Words by MAA, none goes beyond the 3rd power.

In this blog, I will construct a recursive generator capable of generating the closed form of power summation $\sum\limits_{i=1}^{n}i^p$,

for all $p \in N^{+}$. Fig. 1

Let $A$ denotes the area of a rectangle, Fig.1 shows $\sum A_{blue} = A_{n^p \times n} - \sum A_{yellow}$.

Since $\sum A_{blue} = \sum\limits_{i=1}^{n}i^p$, $A_{n^p\times n} = n^p n$, $\sum A_{yellow}= \sum\limits_{i=1}^{n-1}i((i+1)^p-i^p)$,

we have $\sum\limits_{i=1}^{n}i^p = n^p n - \sum\limits_{i=1}^{n-1}i((i+1)^p-i^p)\quad\quad\quad(1)$.

when $p = 1$, (1) becomes $\sum \limits_{i=1}^{n}i=n^2-\sum\limits_{i=1}^{n-1}i((i+1)-i)$ $= n^2-(\sum\limits_{i=1}^{n}(i(i+1)-i)-(n(n+1)-n))$ $= n^2-\sum\limits_{i=1}^{n}i+n$,

hence, $2\sum\limits_{i=1}^{n}i=n^2+n$,

or, $\sum\limits_{i=1}^{n}i=\frac{n(n+1)}{2}\quad\quad\quad(2)$.

When p = 2, $\sum\limits_{i=1}^{n}i^2=n^2 n-\sum\limits_{i=1}^{n-1}i((i+1)^2-i^2)$ $= n^3-2\sum \limits_{i=1}^{n}i^2-\sum\limits_{i=1}^{n}i+2n^2+n$.

Substituting (2) for $\sum\limits_{i=1}^{n}i$,  we have $3\sum\limits_{i=1}^{n}i^2=n^3-\frac{n(n+1)}{2}+2n^2+n$

or, $\sum\limits_{i=1}^{n}i^2= \frac{n(n+1)(2n+1)}{6}$.

In general, $\forall p \in N^+$, $\sum\limits_{i=1}^{n}i^p = n^p n-\sum\limits_{i=1}^{n-1}i((i+1)^p-i^p)$ $= n^{p+1}-(\sum\limits_{i=1}^{n}i((i+1)^p-i^p)-n((n+1)^p-n^p))$ $= n^{p+1}- \sum\limits_{i=1}^{n}(i(\sum\limits_{j=0}^{p}\binom{p}{j}i^{p-j}-i^p)) +n((n+1)^p-n^p)$ $=n(n+1)^p-\sum\limits_{i=1}^{n}(i\sum\limits_{j=1}^{p}\binom{p}{j}i^{p-j})$ $= n(n+1)^p - \sum\limits_{i=1}^{n}\sum\limits_{j=1}^{p}\binom{p}{j}i^{p-j+1}$ $= n(n+1)^p - \sum\limits_{i=1}^{n}(p i^p + \sum\limits_{j=2}^{p}\binom{p}{j}i^{p-j+1})$ $= n(n+1)^p - p\sum\limits_{i=1}^{n}i^p-\sum\limits_{i=1}^{n}\sum\limits_{j=2}^{p}\binom{p}{j}i^{p-j+1}$ $= n(n+1)^p-p\sum\limits_{i=1}^{n}i^p-\sum\limits_{j=2}^{p}\sum\limits_{i=1}^{n}\binom{p}{j}i^{p-j+1}$ $= n(n+1)^p-p\sum\limits_{i=1}^{n}i^p-\sum\limits_{j=2}^{p}(\binom{p}{j}\sum\limits_{i=1}^{n}i^{p-j+1})$.

Solving for $\sum\limits_{i=1}^{n}i^p$, we obtain $\sum\limits_{i=1}^{n}i^p = \frac{n(n+1)^p -\sum\limits_{j=2}^{p}(\binom{p}{j}\sum\limits_{i=1}^{n}i^{p-j+1}) }{p+1}$.

Let $s_p \triangleq \sum\limits_{i=1}^{n}i^p$,

then $s_p = \frac{n(n+1)^p - \sum\limits_{j=2}^{p}\binom{p}{j} s_{p-j+1}}{p+1}\quad\quad\quad(3)$

What we have here is a recursive generator capable of  generating  power summation formulas for virtually all integrer powers. Implemented in Omega CAS Explorer,  the figures below illustrate the awesomeness of this generator: Fig. 2 Fig. 3