TITLE: Spivak Chapter 13 Problem 34 Proof $\lim_{x \to \infty} 1/x \int_{0}^{x}f(t) dt =a $
QUESTION [5 upvotes]: The problem says:

Suppose f is continuous and $\lim_{x \to \infty} f(x)=a$. Prove that:
$$\lim_{x \to \infty} \dfrac{1}{x} \int_{0}^{x}{f(t) dt}=a.$$
Indication: The condition $\lim_{x \to \infty} f(x)=a$ implies that $f(t)$ is close to $a$ for some $ t\geq N$ for some N. This means that $\int_{N}^{N+M} f(t) dt$ is close to $Ma$. If $M$ is large in comparison to $N$, then $Ma/(M+N)$ is close to $a$

I found a solution but it is very different compared to mine.
Here is what I did:
Let $x= M+N$, where $N$ is a constant. So the limit becomes
$$\lim_{M \to \infty} \dfrac{1}{N+M} \int_{0}^{N+M}f(t)~ dt $$
The integral can be split as follows:
$$\int_{0}^{N+M}f(t)~ dt=\int_{0}^{N}f(t)~ dt +\int_{N}^{N+M}f(t)~ dt  $$
We can go back to the limit:
$$\lim_{M \to \infty} \dfrac{1}{N+M} \left[ \int_{0}^{N}f(t)~ dt +\int_{N}^{N+M}f(t)~ dt  \right] $$
As N is a constant, the integral $ \int_{0}^{N}f(t)~ dt$ is also a constant. Then:
$$\lim_{M \to \infty} \dfrac{1}{N+M} \int_{0}^{N}f(t)~ dt = 0 $$
So our main limit is now:
$$\lim_{x \to \infty} \dfrac{1}{x} \int_{0}^{x}{f(t) dt}=\lim_{M \to \infty} \dfrac{1}{N+M} \int_{N}^{N+M}f(t)~ dt$$
Then, it follows form the indications that:
$$\lim_{x \to \infty} \dfrac{1}{x} \int_{0}^{x}{f(t) dt}=\lim_{M \to \infty} \dfrac{1}{N+M} \int_{N}^{N+M}f(t)~ dt = a$$
I would like to know if this is a valid approach. Especially if it is valid to change the limit with $x=N+M$;  and if it is right to cancel the integral from $0$ to $N$, as $N$ is a constant.

REPLY [6 votes]: Your proof is correct. Note that by the Fundamental Theorem of Calculus we may also apply L'Hopital (we just need that the denominator diverges to $+\infty$) and prove the result in a much shorter way
$$\lim_{x \to +\infty} \dfrac{\int_{0}^{x}{f(t) dt}}{x} \stackrel{H}{=}\lim_{x \to +\infty} \dfrac{\frac{d}{dx}\left(\int_{0}^{x}{f(t) dt}\right)}{\frac{d}{dx}(x)}=\lim_{x \to +\infty} \dfrac{f(x)}{1}=a.$$