I have the following sum
$$\sum_{i = 0}^{n-2}\sum_{j=i}^{n}(i + j) + \sum_{i = 0}^{n-2}\sum_{j=i}^{n}1$$?
and i have no idea how to continue from here?
I have the following sum
$$\sum_{i = 0}^{n-2}\sum_{j=i}^{n}(i + j) + \sum_{i = 0}^{n-2}\sum_{j=i}^{n}1$$?
and i have no idea how to continue from here?
For each fixed value of $i$, $\sum_{j=i}^n(i+j)$ is the sum of the consecutive integers starting with $2i$ and ending with $i+n$. You should know at least two ways to evaluate this.
It’s the sum of a finite arithmetic progression. The first term is $2i$, the last is $i+n$, and there are $n-i+1$ terms, so the sum is $$\frac{(n-i+1)\big(2i+(n+i)\big)}2=\frac{(n-i+1)(n+3i)}2=\frac12\left(n^2+n+(2n+3)i-3i^2\right)\;.$$
It’s the sum of the first $i+n$ positive integers minus the sum of the first $2i-1$ positive integers, which is $$\frac{(i+n)(i+n+1)}2-\frac{2i(2i-1)}2$$ and of course simplifies to the same thing.
Thus,
$$\begin{align*} \sum_{i=0}^{n-2}\sum_{j-i}^n(i+j)&=\frac12\sum_{i=0}^{n-2}\left(n^2+n+(2n+3)i-3i^2\right)\\ &=\frac12\left(\sum_{i=0}^{n-2}\left(n^2+n\right)+\sum_{i=0}^{n-2}(2n+3)i-\sum_{i=0}^{n-2}3i^2\right)\\ &=\frac{n^2+n}2\sum_{i=0}^{n-2}1+\frac{2n+3}2\sum_{i=0}^{n-2}i-\frac32\sum_{i=0}^{n-2}i^2\;. \end{align*}$$
Now $\sum_{i=0}^{n-2}1$ is just the sum of $n-1$ ones, so it’s $n-1$, and $\sum_{k=0}^{n-2}i=\frac{(n-2)(n-1)}2$ as the sum of the first $n-2$ consecutive positive integers. For the last summation you need to know that
$$\sum_{k=1}^mk^2=\frac{m(m+1)(2m+1)}6\;,$$
something that can be proved, for instance, by induction on $m$. When the algebra’s done, you should find that
$$\sum_{i=0}^{n-2}\sum_{j=i}^n(i+j)=\frac{n^3+3n^2-10n+6}2\;.$$
I’ll leave the evaluation of
$$\sum_{i=0}^{n-2}\sum_{j=i}^n1$$
to you, as it requires nothing that I’ve not already mentioned.
$$\begin{align} \sum_{i=0}^{n}\sum_{j=i}^n (i+j+1) &=\sum_{j=0}^n\sum_{i=0}^j (i+j+1)\\ &=\sum_{j=0}^n\binom {j+1}2+(j+1)^2\\ &=\sum_{j=1}^{n+1}\binom j2+j^2\\ &=\sum_{j=1}^{n+1}2\binom j2+\binom {j+1}2 &&\text{as } j^2=\binom j2+\binom {j+1}2\\ &=2\binom{n+2}3+\binom{n+3}3\\ &=\frac12 (n+1)^2(n+2)\\ \sum_{i=0}^{n-2}\sum_{j=i}^n (i+j)+\sum_{i=0}^{n-2}\sum_{j=i}^n 1 &=\sum_{i=0}^{n-2}\sum_{j=i}^n (i+j+1)\\ &=\sum_{i=0}^{n}\sum_{j=i}^n (i+j+1)-\sum_{i=n-1}^{n}\sum_{j=i}^n (i+j+1)\\ &=\frac 12(n+1)^2(n+2)-6n\\ &=\frac 12 (n-1)(n^2+5n-2)\qquad\blacksquare\end{align}$$
$$\color{lightgrey}{\text {NB} \qquad\qquad\sum_{i=n-1}^{n}\sum_{j=i}^n (i+j+1)=(2n-1)+2n+(2n+1)=6n}$$