Prove the identity $\sum_{i=0}^n i(n-i) = {n+1 \choose 3}$ , by a combinatorial argument This question was asked on an exam I made. In the answers they proved a bijection between the following sets:
$\def\N{\Bbb N}X_i = \{\,(a, i, b) \mid a,b \in\N ∪ \{0\}, 0 ≤ a < i, i < b ≤ n\,\}$ for $i \in \{ 0, 1, \ldots , n\}$
$Y = \{\,C \mid C ⊆ \N_{n+1}, |C| = 3\,\}$ where $\N_{n+1}=\{\,i\in\Bbb Z\mid 0\leq i\leq n\,\}$
and provided the following relations:
$f : \bigcup_{i=0}^n X_i \to Y : (a,i,b) \mapsto \{a,i,b\} $
$f^{-1}: Y \to \bigcup_{i=0}^n X_i : \{c_1, c_2, c_3\}$  with $c_1 < c_2 < c_3 \mapsto (c_1, c_2, c_3)$
Could someone provide me with an explanation as to why these sets and relations were chosen?

By stars and bars, the number of $k$-uples $(x_1,\ldots,x_k)$ with $x_j\in\mathbb{N}^+$ such that $x_1+\ldots+x_k = n$ is given by $\binom{n-1}{k-1}$. This is the same as stating that
$$ [x^n]\left(\sum_{m\geq 1}x^m\right)^k = \binom{n-1}{k-1} \tag{1}$$
$$ \frac{x^k}{(1-x)^k} = \sum_{n\geq k}\binom{n-1}{k-1} x^n \tag{2} $$
$$ \frac{x^{k}}{(1-x)^{k+1}} = \sum_{n\geq k}\binom{n}{k} x^{n} \tag{3} $$
so by considering the instance $k=3$ of $(3)$ we have
$$\sum_{k=0}^{n}k(n-k) = [x^n]\left(\sum_{k\geq 0} k x^k\right)^2 = [x^n]\frac{x^2}{(1-x)^4} = [x^{n+1}]\frac{x^3}{(1-x)^4} = \binom{n+1}{3}.$$
