$f\in C[0,\infty]$ and $\lim\limits_{x\to \infty}f(x)=L<\infty$. Compute $\lim\limits_{n\to \infty} \int_{0}^{2} f(nx)dx$ I'd really love your help with this
Let $f$ be a continuous function in $[0,\infty )$  and assume that $\lim\limits_{x\to \infty} f(x)=L<\infty$. I need to compute:
$$\lim_{n\to \infty} \int_{0}^{2} f(nx)dx.$$
Because of the fact that $f$ is continuous I want to insert the $\lim$ into the integral (Am I allowed to? What conditions?), and basically to write :
$\lim\limits_{n\to \infty} \int_{0}^{2} f(nx)dx=\int_{0}^{2}\lim\limits_{n\to \infty}  f(nx)dx=\int_{0}^{2}\ L  dx=2L$. I'm quite sure that it's wrong. What are my mistakes, and why am I not allowed to do so? what is the correct solution? 
Thanks a lot!
 A: You can use Lebesgue's dominated convergence theorem. For this you need that $f$ is dominated by some integrable function $g$, i.e. $\int_0^2 |g| dx < \infty$ and $ | f_n (x) | := |f(nx) | \leq g(x)$ for all $n$ and for all $x$ in the set over which you integrate, in your case all $x \in [0,\infty)$.
$f$ is continuous and bounded. So you can pick $g(x) := \sup\limits_{x \in [0,\infty)} |f(x)|$; then, 
$$ f_{n}(x) \leq |f_{n}(x)| \leq g(x)$$
and by the dominated convergence theorem,
$$ \lim_{n \rightarrow \infty} \int_0^2 f(nx) dx = \int_0^2  \lim_{n \rightarrow \infty} f(nx) dx = \int_0^2 L dx = 2L$$
A: You can solve this problem just using definition of the limit. 
Let us denote $I_n = \int\limits_0^2f(nx)\,dx = \frac1n\int\limits_0^{2n} f(x)dx$. Since $\lim\limits_{x\to\infty}f(x) = L<\infty$, for any $\varepsilon>0$ there is $x(\varepsilon)$ s.t. for all $x>x(\varepsilon)$:
$$
L-\varepsilon\leq f(x)\leq L+\varepsilon.
$$
Let us fix $\varepsilon>0$ and pick up any $n>x(\varepsilon)$, then
$$
I_n = \frac1n\int\limits_{0}^{x(\varepsilon)}f(x)dx+\frac1n\int\limits_{x(\varepsilon)}^{2n}f(x)dx\quad (1)
$$
and so
$$
\frac1nJ(\varepsilon)+\left(2-\frac{x(\varepsilon)}{n}\right)(L-\varepsilon)\leq I_n\leq \frac1nJ(\varepsilon)+\left(2-\frac{x(\varepsilon)}{n}\right)(L+\varepsilon)\quad (2)
$$
where $J(\varepsilon)= \int\limits_{0}^{x(\varepsilon)}f(x)dx$. In other words,
$$
\frac1n(J(\varepsilon)-(L+\varepsilon)x(\varepsilon))-2\varepsilon\leq I_n-2L\leq \frac1n(J(\varepsilon)-(L+\varepsilon)x(\varepsilon))+2\varepsilon.
$$
For any $\delta$ we pick up $\varepsilon<\delta$ and $N>\frac{3}{\delta}(J(\varepsilon)-(L+\varepsilon)x(\varepsilon))$, so for any $n\geq N$ we have
$$
|I_n-2L|\leq \delta,
$$
so $\lim\limits_{n\to\infty}I_n = 2L$.

Let me show how $(1)$ implies $(2)$:
$$
I_n = \frac1n J(\varepsilon)+\frac1n\int\limits_{x(\varepsilon)}^{2n}f(x)dx\leq \frac1n J(\varepsilon) +\frac{2n-x(\varepsilon)}{n}(L+\varepsilon)=\frac1nJ(\varepsilon)+\left(2-\frac{x(\varepsilon)}{n}\right)(L+\varepsilon).
$$
where the inequality holds because $f(x)\leq L+\varepsilon$ for all $x\geq x(\varepsilon)$. The other inequality in $(2)$ is obtained in a similar way since $f(x)\geq L-\varepsilon$ for all $x\geq x(\varepsilon)$.
A: Since $f$ is continuous and since $\lim\limits_{x\rightarrow\infty} f(x)=L$, it follows that $|f|$ is bounded by some constant  $M$ on all of $[0,\infty)$.
Let $ \epsilon>0$. Set $\delta={\epsilon\over M}$.  Choose $N$ so that  for any $n>N$ and any $x>\delta$, $L-\epsilon\le f(nx)\le L+\epsilon$.
Now
$$
\int_0^2 f(nx) =\int_0^\delta f(nx) +\int_\delta^2 f(nx) .
$$
For $n>N$
$$ (2-\delta)(L-\epsilon)\le\int_\delta^2 f(nx) \le (2-\delta)(L+\epsilon).$$
It follows that
$$
\int_0^\delta f(nx) + (2-\delta)(L-\epsilon) \le \int_0^2 f(nx) \le\int_0^\delta f(nx) + (2-\delta)(L+\epsilon);
$$
whence
$$
  -\delta M+  (2-\delta)(L-\epsilon) \le  \int_0^2 f(nx) \le\delta\cdot M+ (2-\delta)(L+\epsilon).
$$
From this, we have
$$
-\epsilon+ (2-\delta)(L-\epsilon) \le  \int_0^2 f(nx) \le\epsilon+ (2-\delta)(L+\epsilon),
$$
for all n>N.
But then
$$
2L+{\epsilon^2\over M}-3\epsilon-{\epsilon\over M}L \le  \int_0^2 f(nx) \le 2L-{\epsilon^2\over M}+3\epsilon-{\epsilon\over M}L ,
$$for all n>N.
Since $L$ and $M$ are fixed, the result follows.
