Calculate limit with L'Hopital's rule I want to calculate the limit $\displaystyle{\lim_{x\rightarrow 0}\frac{x^2\cos \left (\frac{1}{x}\right )}{\sin x}}$.
I have done the following:
It holds that $\lim_{x\rightarrow 0}\frac{x^2\cos \left (\frac{1}{x}\right )}{\sin x}=\frac{0}{0}$.
So, we can use L'Hopital's rule:
\begin{align*}\lim_{x\rightarrow 0}\frac{x^2\cos \left (\frac{1}{x}\right )}{\sin x}&=\lim_{x\rightarrow 0}\frac{x^2\cos \left (\frac{1}{x}\right )}{\sin x} \\ &=\lim_{x\rightarrow 0}\frac{\left (x^2\cos \left (\frac{1}{x}\right )\right )'}{\left (\sin x\right )'} =\lim_{x\rightarrow 0}\frac{2x\cdot \cos \left (\frac{1}{x}\right )+x^2\cdot \left (-\sin \left (\frac{1}{x}\right )\right )\cdot \left (\frac{1}{x}\right )'}{\cos x} \\ &=\lim_{x\rightarrow 0}\frac{2x\cdot \cos \left (\frac{1}{x}\right )-x^2\cdot \sin \left (\frac{1}{x}\right )\cdot \left (-\frac{1}{x^2}\right )}{\cos x} \\ & =\lim_{x\rightarrow 0}\frac{2x\cdot \cos \left (\frac{1}{x}\right )+\sin \left (\frac{1}{x}\right )}{\cos x}=\lim_{x\rightarrow 0}\left (2x\cdot \cos \left (\frac{1}{x}\right )+\sin \left (\frac{1}{x}\right )\right ) \\ & =\lim_{x\rightarrow 0}\left (2x\cdot \cos \left (\frac{1}{x}\right )\right )+\lim_{x\rightarrow 0}\left (\sin \left (\frac{1}{x}\right )\right )\end{align*}
We calculate the two limits separately

*

*$\lim_{x\rightarrow 0}\left (2x\cdot \cos \left (\frac{1}{x}\right )\right )$ :

\begin{equation*}\left |\cos \left (\frac{1}{x}\right )\right |\leq 1 \Rightarrow -1\leq \cos \left (\frac{1}{x}\right )\leq 1  \Rightarrow -2x\leq 2x\cdot \cos \left (\frac{1}{x}\right )\leq  2x\end{equation*} we consider the limit $x\rightarrow 0$ and we get \begin{equation*}\lim_{x\rightarrow 0} \left (2x\cdot \cos \left (\frac{1}{x}\right ) \right )=0\end{equation*}

*

*How can we calculate the limit $\lim_{x\rightarrow 0}\left (\sin \left (\frac{1}{x}\right )\right )$ ?

 A: To use L'Hospital rule, one needs to check if $\lim_{x\rightarrow 0}\dfrac{f'(x)}{g'(x)}$ exists. So in this case the topologist's sine curve $\sin(1/x)$ does not have limit whenever $x\rightarrow 0$, so L'Hospital rule fails to apply.
Now use the trick like 
\begin{align*}
\lim_{x\rightarrow 0}\dfrac{x}{\sin x}=1
\end{align*}
and that 
\begin{align*}
\lim_{x\rightarrow 0}x\cos(1/x)=0
\end{align*}
to conclude that the limit value is zero.
For the proof of $x\cos(1/x)\rightarrow 0$ whenever $x\rightarrow 0$:
\begin{align*}
|x\cos(1/x)|\leq|x|,
\end{align*}
and now use Squeeze Theorem to conclude that $\lim_{x\rightarrow 0}x\cos(1/x)=0$ because of that $\lim_{x\rightarrow 0}|x|=0$.
To claim that the topologist's sine curve does not have limit as $x\rightarrow 0$, simply let $a_{n}=\dfrac{1}{2n\pi}$ and $b_{n}=\dfrac{1}{2n\pi+\pi/2}$, so $a_{n},b_{n}\rightarrow 0$ but $\sin(1/a_{n})=0\rightarrow 0$ and $\sin(1/b_{n})=1\rightarrow 1$, the function has two distinct limit points whenever $x\rightarrow 0$, so the limit does not exist. 
A: The limit $$\lim_{x\rightarrow 0}\left (\sin \left (\frac{1}{x}\right )\right )$$
does not exist.
Notice that as $x\to 0^+$, $1/x\to \infty$ .
Therefore sin(1/x) jumps up and down between $-1$ and $1$ infinitely many times. 
Thus the limit   $$\lim_{x\rightarrow 0}\left (\sin \left (\frac{1}{x}\right )\right )$$ does not exist. 
You need to try a different approach to avoid this limit. 
A: L'Hospital's rule is not the alpha and omega of limits computation! When it works, Taylor's formula at order $1$ also works, and it is less dangerous.
This being said, in the present case, doing some asymptotic analysis gives you a fast answer:
Near $0$, $\;\sin x \sim x$ and $ \cos \frac1x$ is  bounded, so 
$$\frac{x^2\cos \left(\frac{1}{x}\right)}{\sin x}\sim_0\frac{x^2}x\cos\frac1x=x\,O(1)=O(x),$$
and the latter tends to $0$ as $x$ tends to $0$.
