Prove that $\lim_{n\to\infty}\frac1{n}\int_0^{n}xf(x)dx=0$. Let $f$ be a continuous, nonnegative, real-valued function and $$\int_0^{\infty}f(x)dx<\infty.$$ Prove that $$\lim_{n\to\infty}\frac1{n}\int_0^{n}xf(x)dx=0.$$
A start: If $\lim\limits_{n\to\infty}\int_0^{n}xf(x)dx$ is finite, then it's obvious. Otherwise, perform L'Hopital's rule, we get $\lim nf(n)$, which we want to show is $0$.
 A: Let $u_n=\frac1{n}\int_0^{n}xf(x)dx \geq 0$. Let $\varepsilon > 0$. 
We need to show that $u_n \leq \varepsilon$ for large enough $n$.
By hypotesis, there is a $a$ such that
$\int_a^{\infty}f(x)dx \leq \frac{\varepsilon}{2}$. 
Let $n$ be an integer such that
$n\geq {\sf max}(a,\frac{2\int_0^a xf(x)dx}{\varepsilon})$. Then
$$
u_n=\int_0^a \frac{xf(x)}{n}dx
+ \int_a^n \frac{xf(x)}{n}dx \leq
\frac{\varepsilon}{2}+ \int_a^n \frac{nf(x)}{n}dx
\leq \frac{\varepsilon}{2}+\frac{\varepsilon}{2} =\varepsilon
$$
and we are done.
A: $$\forall n\geqslant k,\qquad0\leqslant\frac1{n}\int_0^{n}xf(x)\mathrm dx\leqslant\frac1n\int_0^{k}xf(x)\mathrm dx+\int_k^{\infty}f(x)\mathrm dx$$
A: Let $g_n(x)=\frac{x}{n}\mathbb{1}_{[0,n]}(x)$. This is a sequence of non-negative functions bounded by $1$. Since $f$ is non-negative and in $L^1(\mathbb{R}^+)$, by the dominated convergence theorem
$$ \lim_{n\to +\infty}\int_{0}^{+\infty}g_n(x)\,f(x)\,dx = \int_{0}^{+\infty}\lim_{n\to +\infty}g_n(x)\,f(x)\,dx = \int_{0}^{+\infty}0\cdot f(x)\,dx = 0.$$
