User:Ans/Sum of Sequence of Nth Powers

Theorem

 * $$\forall k \in \N_0 \forall n \in \N_0: \operatorname{sum\_of\_powers}(k, n) = \sum_{i \mathop = 1}^n i^k = \frac 1 {k+1} \left({\left({n + 1}\right)^{k+1} - 1 - \sum_{j \mathop = 0}^{k-1}\binom{k+1}{j}\operatorname{sum\_of\_powers}(j, n)}\right)$$

Proof by Sum of Differences of One Higher Order Powers
$$ \begin{align} \sum_{i \mathop = 1}^n \left({\left({i + 1}\right)^{k+1} - i^{k+1}}\right) & = \sum_{i \mathop = 1}^n \left({\sum_{j \mathop = 0}^{k+1}\binom{k+1}{j}i^j - i^{k+1}}\right) & \text{Binomial Theorem} \\ & = \sum_{i \mathop = 1}^n \left({\binom{k+1}{k+1}i^{k+1} + \binom{k+1}{k}i^k + \sum_{j \mathop = 0}^{k-1}\binom{k+1}{j}i^j - i^{k+1}}\right) & \text{recursive definition} \\ & = \sum_{i \mathop = 1}^n \left({(k+1)i^k + \sum_{j \mathop = 0}^{k-1}\binom{k+1}{j}i^j}\right) \\ & = (k+1)\sum_{i \mathop = 1}^n i^k + \sum_{i \mathop = 1}^n \sum_{j \mathop = 0}^{k-1}\binom{k+1}{j}i^j & \text{Summation is Linear} \\ & = (k+1)\sum_{i \mathop = 1}^n i^k + \sum_{j \mathop = 0}^{k-1}\sum_{i \mathop = 1}^n \binom{k+1}{j}i^j & \text{Summation is Linear} \\ & = (k+1)\sum_{i \mathop = 1}^n i^k + \sum_{j \mathop = 0}^{k-1}\binom{k+1}{j}\sum_{i \mathop = 1}^n i^j & \text{Summation is Linear} \\ \end{align} $$

On the other hand:

$$ \begin{align} \sum_{i \mathop = 1}^n \left({\left({i + 1}\right)^{k+1} - i^{k+1}}\right) & = \sum_{i \mathop = 1}^n \left({i + 1}\right)^{k+1} - \sum_{i \mathop = 1}^n i^{k+1} & \text{Summation is Linear} \\ & = \sum_{i \mathop = 1}^n \left({i + 1}\right)^{k+1} - \sum_{i \mathop = 1}^n i^{k+1} + 1^{k+1} - 1^{k+1} \\ & = 1^{k+1} + \sum_{i \mathop = 2}^{n+1} i^{k+1} - \sum_{i \mathop = 1}^n i^{k+1} - 1^{k+1} \\ & = \sum_{i \mathop = 1}^{n+1} i^{k+1} - \sum_{i \mathop = 1}^n i^{k+1} - 1^{k+1} \\ & = \left({n + 1}\right)^{k+1} + \sum_{i \mathop = 1}^n i^{k+1} - \sum_{i \mathop = 1}^n i^{k+1} - 1^{k+1} & \text{recursive definition} \\ & = \left({n + 1}\right)^{k+1} - 1 \\ \end{align} $$

Therefore:

$$ \begin{array}{rrl} & \displaystyle (k+1)\sum_{i \mathop = 1}^n i^k + \sum_{j \mathop = 0}^{k-1}\binom{k+1}{j}\sum_{i \mathop = 1}^n i^j & \displaystyle = \left({n + 1}\right)^{k+1} - 1 \\ \implies & \displaystyle (k+1)\sum_{i \mathop = 1}^n i^k & \displaystyle = \left({n + 1}\right)^{k+1} - 1 - \sum_{j \mathop = 0}^{k-1}\binom{k+1}{j}\sum_{i \mathop = 1}^n i^j \\ \end{array} $$

Therefore:

$$ \begin{align} \operatorname{sum\_of\_powers}(k, n) = \sum_{i \mathop = 1}^n i^k & = \frac 1 {k+1} \left({\left({n + 1}\right)^{k+1} - 1 - \sum_{j \mathop = 0}^{k-1}\binom{k+1}{j}\sum_{i \mathop = 1}^n i^j}\right) \\ & = \frac 1 {k+1} \left({\left({n + 1}\right)^{k+1} - 1 - \sum_{j \mathop = 0}^{k-1}\binom{k+1}{j}\operatorname{sum\_of\_powers}(j, n)}\right) \\ \end{align} $$