In the solution of my homework there's this step that I don't understand:
$$\begin{align}\mathsf {Var}[X] & = \sum_{k=1}^{n}\dfrac{n(k-1)}{(n-k+1)^2}\\ &= n \sum_{k=1}^{n}\dfrac{(n-k)}{k^2}\\&= n^2 \sum_{k=1}^{n}\dfrac{1}{k^2}-n \sum_{k=1}^{^n}\dfrac{1}{k}\end{align}$$
I would have thought, that when I pull $n$ out of the $\sum$ that I'd just get: $n\sum_{k=1}^n\frac{(k-1)}{(n-k+1)^2}$.
Also I don't understand the second line. Could someone please tell me what steps are missing and how they solved this? Thanks!
They've just preformed the distribution and substitution at the same time rather than two steps.
$$\begin{align}\mathsf {Var}[X] & = \sum_{k=1}^{~~n}\dfrac{n(k-1)}{(n-k+1)^2} &&\text{as given} \\ &= n\sum_{k=1}^n\dfrac{(k-1)}{(n-k+1)^2} &&\text{distribution} \\ &= n \sum_{k=1}^{n}\dfrac{(n-k)}{k^2} && \text{substitution: } k\gets n-k+1 \\&= n \sum_{k=1}^{n}\dfrac{n}{k^2}-n \sum_{k=1}^{n}\dfrac{k}{k^2}&&\text{commutation and association}\\&= n^2 \sum_{k=1}^{n}\dfrac{1}{k^2}-n \sum_{k=1}^{n}\dfrac{1}{k}&&\text{distribution and rationalisation}\end{align}$$