<s>[INST] Formula for $\sum _{i=1}^n (n+1-i) (n-i)$ It is easy to show that
$$\sum _{i=1}^n (n+1-i) (n-i) = n (n-1)+(n-1) (n-2)+...+1 (1-1)=\frac{1}{3} \left(n^3-n\right)$$
using induction. But how do I derive this formula? I couldn't find any substitution to do this.
 [/INST] You must already know that
$$
\begin{align}
\sum_{i = 1}^n 1 &= n \\
\sum_{i = 1}^n i &= \frac{n(n + 1)}{2} \\ 
\sum_{i = 1}^n n &= n \cdot \sum_{i = 1}^n 1 \\
& = n^2 \\
\sum_{i = 1}^n i^2 &= \frac{n(n + 1)(2n + 1)}{6} \\ 
\end{align}
$$
Now, from the given expression;
$$
\begin{align}
\sum_{i=1}^n (n+1-i) (n-i) &= \sum_{i = 1}^n\left( n^2 + i^2 + n - i - 2 n i\right) \\
&= n^2 \cdot \sum_{i=1}^n 1 + \sum_{i=1}^n i^2 + n \cdot \sum_{i=1}^n1 - \sum_{i=1}^ni -2n \cdot \sum_{i=1}^ni \\
&= n^3 +  \frac{n(n + 1)(2n + 1)}{6} + n^2 - \frac{n(n + 1)}{2} - n^2(n + 1) \\
&= \frac{n(n + 1)}{6} \cdot \left( 2n + 1 - 3\right) \\
&= \frac{n (n + 1)}{6} \cdot 2(n - 1) = \frac{n (n + 1) (n - 1)}{3} \\
&= \frac{n^3 - n}{3}
\end{align}
$$
</s>