Let $I_{n, k}$ denote the number of permutations $\pi \in S_n$ with exactly $k$ inversions. Using the convention $I_{n, k} = 0$ for $k < 0$ and $\displaystyle k > \frac{n(n - 1)}{2}$, we first have the well-known sum
$\displaystyle I_{n, k} = \sum_{j = 0}^{n - 1} I_{n - 1, k - j}$
which can be derived by considering the position of element $1$. But there is a second recurrence:
$\displaystyle I_{n, k} = I_{n, k - 1} + I_{n - 1, k} - I_{n - 1, k - n}$
How to derive this formula? Is there a way to obtain it from the above sum using algebraic reasoning?
This is sort of an extended hint. Given a combinatorial interpretation of the summands in $$ I_{n, k} = \sum_{j = 0}^{n - 1} I_{n - 1, k - j}, $$ try to use that to interpret combinatorially the following: $$ \begin{split} I_{n, k} &= I_{n-1,k} + \sum_{j=1}^{n-1}{I_{n-1,k-j}}\\ &= I_{n-1,k} + \sum_{j=0}^{n-2}{I_{n-1,k-j-1}}\\ &= I_{n-1,k} + \sum_{j=0}^{n-1}{I_{n-1,k-1-j}}-I_{n-1,k-n}\\ &=I_{n-1,k}+I_{n,k-1}-I_{n-1,k-n}. \end{split} $$