Prove that $\lim_{n \rightarrow \infty} \frac{1}{n}\int^n_0xf(x)dx = 0$

Put $$g_n(x) = \frac{x}{n} f(x) \chi_{[0,n]}(x)$$ Then $$\frac{1}{n}\int_0^n xf(x) dx = \int_{0}^\infty g_n(x) dx$$ Also, $|g_n(x)| \leq |f(x)| = f(x)$ for all $x$, and $g_n(x) \rightarrow 0$ pointwise. Therefore the dominated convergence theorem applies, and $$\begin{align} \lim_{n \rightarrow \infty} \frac{1}{n}\int_0^n xf(x) dx &= \lim_{n \rightarrow \infty} \int_{0}^\infty g_n(x) dx\\ &= \int_{0}^{\infty} \lim_{n \rightarrow \infty}g_n(x) dx \\ &= 0 \end{align}$$