0

I've been working on trying to figure out the titular sum, $\sum_{i = 1}^{n} \sum_{j = i + 1}^{n} (j - i)$, which has an analytical solution by the Wolfram-Alpha output here. However, I have not been able to replicate this fully." line2 = "I began by swapping the order of summation and splitting terms, which lead me to the following: $$ \begin{align*} \sum_{i = 1}^{n} \sum_{j = i + 1}^{n} (j - i) &= \left(\sum_{i = 1}^{n} \sum_{j = i + 1}^{n} j\right) - \left(\sum_{i = 1}^{n} \sum_{j = i + 1}^{n} i\right) \\ &= \left(\sum_{j = i + 1}^{n}\sum_{i = 1}^{n} j\right) - \left(\sum_{i = 1}^{n} \sum_{j = i + 1}^{n} i\right) \\ &= \left(\sum_{j = i + 1}^{n} nj \right) - \left(\sum_{i = 1}^{n} (n - i) i\right) \\ &= n\sum_{j = i + 1}^{n} j - \left(n\sum_{i = 1}^{n}i \right) + \left(\sum_{i = 1}^{n} i^2 \right) \end{align*} $$ However, I do not know how to proceed further from here. I know the last two terms have closed form expressions (sum of integers/sum of squares), but I am not able to get the expression that Wolfram has produced. The first term, in particular, I am not sure how to handle. I considered using the arithmetic series formula, but could not get it to cancel.

  • $$ \sum\limits_{j = i + 1}^n j = \sum\limits_{j = 1}^n j - \sum\limits_{j = 1}^i j $$ but $i$ should not appear in the final result, so you made a mistake somewhere. I suspect it is in line 2 when you swapped the two sums. – Gary Oct 19 '21 at 04:18

1 Answers1

2

As Gary says in the comments, you have an error on line 2.

We can do the following. Let $k = j-i$. Then the inner summations goes from $k = 1$ to $k = n-i$. Thus, we have that

$$ \sum_{i=1}^n\sum_{j = i+1}^n(j-i) = \sum_{i=1}^n \sum_{k=1}^{n-i}k = \sum_{i=1}^n \frac{(n-i)(n-i+1)}{2} = \sum_{i=1}^n \frac{n^2+i^2-2ni+n-i}{2}. $$

Lets evaluate each of these.

$$\sum_{i=1}^n \frac{n^2}{2} = \frac{n^3}{2}.$$

$$\sum_{i=1}^n \frac{n}{2} = \frac{n^2}{2}.$$

$$-\sum_{i=1}^n ni = -\frac{n^2(n+1)}{2} = -\frac{n^3+n^2}{2}.$$

$$ -\sum_{i=1}^n \frac{i}{2} = -\frac{n^2+n}{4}.$$

$$\sum_{i=1}^n \frac{i^2}{2} = \frac{n(n+1)(2n+1)}{12} = \frac{2n^3+3n^2+n}{12}.$$

Note that the terms in the first three equations cancel completely. Finally, we have

$$\frac{2n^3+3n^2+n}{12} - \frac{n^2+n}{4} = \frac{2n^3-2n}{12} =\frac{1}{6}n(n^2-1).$$