[Math] Help with this double summation

discrete mathematicssummation

I'm having trouble when the indexes are related in a double summation. For example, this problem:
$\sum^n_{i = 1} \sum^n_{j = i+1} j – i + 2$

How could I sum this and what's a general approach to this type of double/triple summations?

Best Answer

$$\sum^n_{i = 1} \sum^n_{j = i+1} j - i + 2= \sum^n_{i = 1} \sum^{n-i}_{j =1} j + 2=\sum^n_{i = 1}\frac{(n-i)^2+(n-i)}{2}+2(n-i)$$ $$=\sum_{i=1}^{n-1}\frac{i^2+i}{2}+2i=\sum_{i=1}^{n-1}\frac{i^2+5i}{2}=\frac{1}{2}\sum_{i=1}^{n-1}i^2+\frac{5}{2}\sum_{i=1}^{n-1}i=\frac{n(n-1)(n+7)}{6}$$