Let $f$ be continuous in $\left[0,\infty\right]$ and $\lim_{x\rightarrow\infty}f(x)=a$. Prove $\lim_{x\to\infty}\frac{1}{x}\int_{0}^{x}f(t)dt=a$. Let $f$ be a continuous function in $\left[0,\infty\right]$ such that $\displaystyle \lim_{x\to\infty}f(x)=a$ Prove $\displaystyle \lim_{x\to\infty}\frac{1}{x}\int_{0}^{x}f(t)dt=a$.
Well, i made this:
As $f$ is a continuos function in $\left[0,\infty\right]$ by the fundamental theorem of calculus I exists a $F(x)$ such that $f(x)=F'(x)$ and by the FTC II we have $\int_{0}^{x}f(t)dt=f(x)-f(0)$, Then:
$\displaystyle \lim_{x\rightarrow\infty}\frac{1}{x}\int_{0}^{x}f(t)dt=\lim_{x\rightarrow\infty}\frac{1}{x}(f(x)-f(0))=0-0=0\neq a $
Can someone help?
 A: You are trying to compute an indeterminate form. Just use L'Hôpital's rule.
A: Hint: use L'Hopital's Rule together with the first part of the Fundamental Theorem of Calculus.
EDIT: in your tentative solution you say that $0\neq a$ and let's assume without loss that $a > 0$. Then there is $x_0$ such that for $x \ge x_0$ $|f(x) - a| < \frac{a}{2}$, which implies $f(x) \ge \frac{a}{2}.$ But then $$\int_0^{\infty}f(x)\,dx \ge \int_0^{x_0}f(x)\,dx + \frac{a}{2}\int_{x_0}^{\infty}1\,dx = \infty.$$ This shows that the numerator blows up to $+\infty$. The denominator is $x$, which obviously converges to $+\infty$ as well and hence you have an indeterminate form.
A: For each $x>0$ and $c>0$ with $0<c<x$, 
$$\begin{align*}\left|\frac1x\int_0^x f(t)\,dt - a\right|&=\left|\frac1x\int_0^x f(t)-a\,dt\right|\\
&=\left|\frac1x\int_0^c f(t)-a\,dt+\frac1x\int_c^x f(t)-a\,dt\right|\\
&\leq\left|\frac1x\int_0^c f(t)-a\,dt\right|+\left|\frac1x\int_c^x f(t)-a\,dt\right|\\
&\leq \frac{c(\max_{t\in[0,c]}|f(t)|+|a|)}{x}+\frac{x-c}{x}\sup_{t\geq c}|f(t)-a|.
\end{align*}\\$$
Given $\varepsilon>0$, let $c>0$ be such that $t\geq c$ implies $|f(t)-a|<\frac12\varepsilon$.  Let $x_0>c$ be sufficiently large that $\frac{c(\max_{t\in[0,c]}|f(t)+|a|)}{x_0}<\frac12\varepsilon$.  Then for all $x\geq x_0$, $\left|\frac1{x}\int_0^x f(t)\,dt-a\right|<\varepsilon.$
A: Since $f(x)\to a$ at infinity, there exists $x_0$ such that $\forall x\ge x_0$ we have  $a-\varepsilon\le f(x)\le a+\varepsilon$
We have $\displaystyle \frac 1x\int_0^x f(t)dt=\frac 1x\underbrace{\int_0^{x_0} f(t)dt}_{\text{constant}=C}+\frac 1x\int_{x_0}^x f(t)dt$
So $\displaystyle\frac{(a-\varepsilon)(x-x_0)+C}x\le \frac 1x\int_0^x f(t)dt\le \frac{(a+\varepsilon)(x-x_0)+C}x$
And the conclusion is immediate.
A: You can argue this, as known
$$ \int_{0}^{x} f(x)dx = \int_{0}^{x_0} f(x)dx + \int_{x_0}^{x} f(x)dx $$ 
Take $\varepsilon > 0$.
$\hspace{1cm}$Once $\lim\limits_{x \rightarrow \infty} f(x) = a$, given $\frac{\varepsilon}{2}>0$ exists $x_0$ such that $|f(x) - a| < \frac{\varepsilon}{2}$, $\forall$ $x$ $>$ $x_0$. Let $M = \sup\limits_{x \in [0,x_0]} {|f(x) - a|}$.
So for all $x > \max\{{x_0, \frac{2M}{\varepsilon}}\}$, we have
\begin{align*}\left| \frac{1}{x}  \int_{0}^{x} f(x)dx - a \right| &= \left| \frac{1}{x}\int_{0}^{x_0} f(x)dx + \frac{1}{x}\int_{x_0}^{x} f(x)dx - a \right|\\
&= \left| \frac{1}{x}\int_{0}^{x_0} f(x)dx + \frac{1}{x}\int_{x_0}^{x} f(x)dx - \frac{x}{x}a \right|\\
&= \left| \frac{1}{x}\int_{0}^{x_0} f(x) - a \hspace{0.1cm}dx + \frac{1}{x}\int_{x_0}^{x} f(x) - a \hspace{0.1cm}dx \right|\\
&\leq \left| \frac{1}{x}\int_{0}^{x_0} f(x) - a \hspace{0.1cm}dx \right| + \left| \frac{1}{x}\int_{x_0}^{x} f(x) - a \hspace{0.1cm}dx \right|\\
&\leq \frac{1}{x} M +  \frac{\varepsilon}{2}  \left|\frac{x-x_0}{x} \right|\\
&\leq \frac{\varepsilon}{2M} M +  \frac{\varepsilon}{2}  \\
& \leq \varepsilon \\
 \end{align*}
So $\lim\limits_{x \rightarrow \infty} \frac{1}{x}{\int_{0}^{\infty} f(x)dx} = a$
