I have a math problem where the expression:

$\displaystyle \displaystyle\sum_{i=0}^{n-1}(i+1)(n-i)$

is changed to:

$\displaystyle \displaystyle\sum_{i=1}^{n}i(n+1-i)$

but I am having difficulty understanding how this is achieved.

Can anyone explain how this is done?

Thanks