# How is the summation being expanded? I am trying to understand summations by solving some example p

How is the summation being expanded?
I am trying to understand summations by solving some example problems, but I could not understand how is the second to last line being expanded? I would really appreciate if you could explain me how is it being expanded.
$\begin{array}{rl}& \sum _{i=1}^{n-1}\sum _{j=i+1}^{n}\sum _{k=1}^{j}1=\\ & \sum _{i=1}^{n-1}\sum _{j=i+1}^{n}j=\\ & \sum _{i=1}^{n-1}\left(\sum _{j=1}^{n}j-\sum _{j=1}^{i}j\right)=\\ & \sum _{i=1}^{n-1}\left(\frac{n\left(n+1\right)}{2}-\frac{i\left(i+1\right)}{2}\right)=\\ & \frac{1}{2}\sum _{i=1}^{n-1}{n}^{2}+n-{i}^{2}-i=\\ & \frac{1}{2}\left(\left(n-1\right){n}^{2}+\left(n-1\right)n-\left(\frac{n\left(n+1\right)\left(2n+1\right)}{6}-{n}^{2}\right)-\left(\frac{n\left(n+1\right)}{2}-n\right)\right)=\\ & f\left(n\right)=\frac{n\left(n\left(n+1\right)\right)}{2}-\frac{n\left(n+1\right)\left(2n+1\right)}{12}-\frac{n\left(n+1\right)}{4}\end{array}$
You can still ask an expert for help

## Want to know more about Discrete math?

• Questions are typically answered in as fast as 30 minutes

Solve your problem for the price of one coffee

• Math expert for every subject
• Pay only if we can solve it

Keegan Barry
Step 1
I take it that what has to be explained is this (I've introduced parentheses on the left hand side for clarity):
$\begin{array}{c}\sum _{i=1}^{n-1}\left({n}^{2}+n-{i}^{2}-i\right)=\hfill \\ \hfill \left(n-1\right){n}^{2}+\left(n-1\right)n-\left(\frac{n\left(n+1\right)\left(2n+1\right)}{6}-{n}^{2}\right)-\left(\frac{n\left(n+1\right)}{2}-n\right).\end{array}$
This equation results from adding together the following four identities:
$\begin{array}{rl}\sum _{i=1}^{n-1}{n}^{2}& =\left(n-1\right){n}^{2},\\ \sum _{i=1}^{n-1}n& =\left(n-1\right)n,\\ \sum _{i=1}^{n-1}{i}^{2}& =\sum _{i=1}^{n}{i}^{2}-{n}^{2}\\ & =\frac{n\left(n+1\right)\left(2n+1\right)}{6}-{n}^{2},\\ \sum _{i=1}^{n-1}i& =\sum _{i=1}^{n}i-n\\ & =\frac{n\left(n+1\right)}{2}-n.\end{array}$
Step 1
Lines 4 and 6 follow, of course, from the familiar identities:
$\begin{array}{rl}\sum _{i=1}^{n}{i}^{2}& =\frac{n\left(n+1\right)\left(2n+1\right)}{6},\\ \sum _{i=1}^{n}i& =\frac{n\left(n+1\right)}{2}.\end{array}$
I don't know why it was done this way! It seems to me that it would have been simpler just to write:
$\begin{array}{rl}\sum _{i=1}^{n-1}{i}^{2}& =\frac{\left(n-1\right)n\left(2n-1\right)}{6},\\ \sum _{i=1}^{n-1}i& =\frac{\left(n-1\right)n}{2}.\end{array}$
(Also, in the comments, I've suggested two ways to arrive at the final answer with less calculation.)

kolutastmr
Step 1
Starting from line 4 of the displayed equation, we have
$\sum _{i=1}^{n-1}\frac{n\left(n+1\right)}{2}=\left(n-1\right)\frac{n\left(n+1\right)}{2}$ because there are $n-1$ equal terms. Also, $\sum _{i=1}^{n-1}\frac{i\left(i+1\right)}{2}=\sum _{i=1}^{n-1}\left(\frac{i\left(i+1\right)\left(i+2\right)}{6}-\frac{\left(i-1\right)i\left(i+1\right)}{6}\right)$ is a telescoping sum, hence equal to $\frac{\left(n-1\right)n\left(n+1\right)-0}{6}.$
Step 2
Therefore, the whole sum is equal to $\frac{\left(n-1\right)n\left(n+1\right)}{2}-\frac{\left(n-1\right)n\left(n+1\right)}{6}=\frac{\left(n-1\right)n\left(n+1\right)}{3}.$
The "weird" decomposition above comes in fact from a general property of the raising factorials: e.g.
$i\left(i+1\right)\left(i+2\right)\left(i+3\right)\left(i+4\right)-\left(i-1\right)i\left(i+1\right)\left(i+2\right)\left(i+3\right)=5i\left(i+1\right)\left(i+2\right)\left(i+3\right).$