Measure theory question integrable function I am stuck with the following problem in my introductory measure theory course.
Let $(X,\mathcal{A},\mu)$ be a measured space and $f:X\to \mathbb R$ be a Lesbegue-integrable function.

(a) Show that $\displaystyle\lim_{n\to\infty} n\mu(\{|f|\geqslant n\})=0$.
(b) Show that $\displaystyle\sum_{n=1}^\infty \frac{1}{n^2}\int_{|f|\leqslant n} |f|^2\,d\mu<\infty$.

For (a), I am almost sure that Markov's inequality should be used, there is not many more information. The only assumption is that $\int_X |f|d\mu<\infty$ . Now Markov gives
$$n\mu(\{|f|\geqslant n\})\leqslant \int_X |f|\,d\mu<\infty,$$
but I don't see how to proceed.
For (b), I think I have to use the dominated convergence theorem.
Any hints would be helpful.
 A: For part (a) we need a bit more than Markov's inequality. It readily follows from
$$n\mu(\{\lvert f\rvert \geqslant n\}) = \int_{\{\lvert f\rvert \geqslant n\}} n\,d\mu \leqslant \int_{\{\lvert f\rvert \geqslant n\}} \lvert f\rvert\,d\mu$$
and for example Fatou's lemma or the dominated convergence theorem because $\lvert f\rvert\cdot \chi_{\{\lvert f\rvert \geqslant n\}}$ converges to $0$ almost everywhere. It does so monotonically, so we can also use the monotone convergence theorem to reach the conclusion $n\mu(\{\lvert f\rvert \geqslant n\}) \to 0$.
For part (b) it seems that some variant of exchanging the order of summation and integration is the most straightforward way. Since the domain of integration depends on the summation index, we need to rewrite the integrals to do that. Let's use
$$H(t) = \begin{cases} 1 &\text{if } t \geqslant 0, \\ 0 &\text{if } t < 0, \end{cases}$$
then the series can be rewritten as
$$\sum_{n = 1}^{\infty} \frac{1}{n^2}\int_X \lvert f\rvert^2\cdot H(n - \lvert f\rvert)\,d\mu\,.$$
Since everything is nonnegative, changing the order of summation and integration is allowed, leading to
$$\int_X \lvert f\rvert^2 \cdot \sum_{n = 1}^{\infty} \frac{H(n - \lvert f\rvert)}{n^2}\,d\mu = \int_X \lvert f\rvert^2 \sum_{n \geqslant \lvert f\rvert} \frac{1}{n^2}\,d\mu\,.$$
Now for each $x > 0$ we have
$$\sum_{n \geqslant x} \frac{1}{n^2} < \frac{2}{x}\,,$$
so
$$\sum_{n = 1}^{\infty} \frac{1}{n^2}\int_{\lvert f\rvert \leqslant n} \lvert f\rvert^2\,d\mu \leqslant \int_{\lvert f\rvert > 0} \lvert f\rvert^2\cdot \frac{2}{\lvert f\rvert}\,d\mu = 2\int_X \lvert f\rvert\,d\mu < \infty.$$
