# Evaluating Sums $\sum_{i=1}^{n} \sum_{j=0}^{n-i}$

I'm unsure how to evaluate sums when the second sum has $n-i$ on the top.

$$\sum_{i=1}^{n} \sum_{j=0}^{n-i} (3j^{2} - 2)$$ $$=\sum_{i=1}^{n} (\sum_{j=0}^{n-i} 3j^{2} - \sum_{j=0}^{n-i}2)$$ $$=\sum_{i=1}^{n} (\sum_{j=0}^{n-i} 3(\frac {n(n+1)(n+2)} 6 ) - 2n)$$

From here I'm lost to what I could do. Could some one please explain how to evaluate this sum in detail? I'm confused.

## 2 Answers

First off, that last step isn’t right, so I’m going to start from the beginning.

\begin{align*} \sum_{i=1}^n\sum_{j=0}^{n-i}\left(3j^2-2\right)&=\sum_{i=1}^n\left(\sum_{j=0}^{n-i}3j^2-\sum_{j=0}^{n-i}2\right)\\\\ &=\sum_{i=1}^n\sum_{j=0}^{n-i}3j^2-\sum_{k=1}^n\sum_{j=0}^{n-i}2\;. \end{align*}

Now let’s deal separately with these summations. There are $n-i+1$ terms in the inner summation, so

\begin{align*} \sum_{i=1}^n\sum_{j=0}^{n-i}2&=\sum_{i=1}^n2(n-i+1)\\\\ &=2\left(\sum_{i=1}^n(n+1)-\sum_{i=1}^ni\right)\\ &=2\left(n(n+1)-\frac{n(n+1)}2\right)\\\\ &=n(n+1)\;. \end{align*}

The first one is a little messier:

\begin{align*} \sum_{i=1}^n\sum_{j=0}^{n-i}3j^2&=\sum_{i=1}^n\frac{(n-i)(n-i+1)\big(2(n-i)+1\big)}2\\\\ &=\frac12\sum_{i=1}^n\Big((n-i)(n-i+1)\big(2(n-i)+1\big)\Big)\\\\ &\overset{*}=\frac12\sum_{k=0}^{n-1}k(k+1)(2k+1)\\\\ &=\frac12\sum_{k=0}^{n-1}\left(2k^3+3k^2+k\right)\\\\ &=\sum_{k=0}^{n-1}k^3+\frac32\sum_{k=0}^{n-1}k^2+\frac12\sum_{k=0}^{n-1}k\\\\ &=\left(\frac{(n-1)n}2\right)^2+\frac{(n-1)n\big(2(n-1)+1\big)}4+\frac{(n-1)n}4\;. \end{align*}

The step marked with an asterisk is accomplished by letting $k=n-i$: as $i$ runs from $1$ through $n$, $n-i$ runs from $n-1$ down through $0$. Now just simplify this last result, combine with the first one, and simplify again to get the final result.

Realize that the top of the first sum ranges from $0$, when $i=n$, to $n-1$, when $i=1$. So by making the substitution $i=n-l$, we have $$\sum_{i=1}^{n} \sum_{j=0}^{n-i} (3j^{2} - 2)=$$ $$\sum_{l=0}^{n-1} \sum_{j=0}^{l} (3j^{2} - 2)=$$ $$\sum_{l=0}^{n-1} \left(3\frac{l(l+1)(2l+1)}{6} - 2(l+1)\right)=$$ $$\sum_{l=0}^{n-1} \left(l^3+\frac{3l^2}{2}-\frac{3l}{2}-2\right)=$$ $$\frac{n^2(n-1)^2}{4}+\frac{n(n-1)(2n-1)}{4}-\frac{3n(n-1)}{4}-2n=$$ $$\frac{n^4-5n^2-4n}{4}$$