<s>[INST] Solving a limit of integral with L'Hopital I have this limit:
$\displaystyle \lim\limits_{x\to \infty}\dfrac{1}{x}\int_{0}^x \dfrac{1}{2+\cos(\mathrm t)}\, \mathrm{dt}$
I said that 
Edit:
$-1\leq \cos\mathrm{t}\leq 1 \Rightarrow \dfrac{1}{2+\cos\mathrm{t}} > 0 \text{ and because that expression has no limit as x -> inf}\\\Rightarrow \displaystyle \int_{0}^x \dfrac{1}{2+\cos\mathrm{t}}\, dt \to \infty \\ \\ \Rightarrow \lim\limits_{x\to \infty} \dfrac{\displaystyle\int_{0}^x \dfrac{1}{2+\cos\mathrm{t}}\,\mathrm{dt}}{x} = \lim\limits_{x\to \infty} \dfrac{\Big( \displaystyle\int_{0}^x \dfrac{1}{2+\cos \mathrm{t}}\, \mathrm{dt}\Big)'}{x'} = \lim\limits_{x\to \infty} \dfrac{\dfrac{1}{2+\cos \mathrm{x}}}{1} = \lim\limits_{x\to \infty} \dfrac{1}{2+\cos \mathrm{x}}$
But here I got stuck because that limit does not exist, because cos x has no limit when x goes to infinity.
But the correct answer is $\dfrac{1}{\sqrt 3}$, what did I do wrong?
 [/INST] Note that
\begin{align}
\int^{2\pi n}_0 \frac{dt}{2+\cos t} = n \int^{2\pi}_0 \frac{dt}{2+\cos t}
\end{align}
which means
\begin{align}
\frac{1}{2\pi n}\int^{2\pi n}_0 \frac{dt}{2+\cos t} = \frac{1}{2\pi}\int^{2\pi }_0 \frac{dt}{2+\cos t}.
\end{align}
Hence
\begin{align}
\lim_{n\rightarrow \infty} \frac{1}{2\pi n}\int^{2\pi n}_0 \frac{dt}{2+\cos t}= \frac{1}{2\pi}\int^{2\pi }_0 \frac{dt}{2+\cos t}= \frac{1}{\sqrt{3}}.
\end{align}
This suggests that 
\begin{align}
\lim_{x\rightarrow \infty} \frac{1}{x}\int^x_0 \frac{dt}{2+\cos t} = \frac{1}{\sqrt{3}}
\end{align}
if the limit exists. 
To show that the limit exists, observe we have that
\begin{align}
\left|\frac{1}{x}\int^{x}_0 \frac{dt}{2+\cos t}- \frac{1}{2\pi} \int^{2\pi}_0 \frac{dt}{2+\cos t}\right| =&\ \left|\frac{1}{2\pi n+r}\int^{2\pi n+r}_0 \frac{dt}{2+\cos t}- \frac{1}{2\pi} \int^{2\pi}_0 \frac{dt}{2+\cos t}\right|\\
=&\ \left|\frac{n}{2\pi n+r}-\frac{1}{2\pi}\right|\int^{2\pi}_0\frac{dt}{2+\cos t}+ \frac{1}{2\pi n+r}\int^{r}_{0} \frac{dt}{2+\cos t}
\end{align}
where $0\le r< 2\pi$. Then as $n\rightarrow \infty$ we get the desired result. 
</s>