Question The function$$f(x)=\begin{cases} x^{2} \sin \frac{1}{x} & \text {for } x \neq 0 \\ 0 & \text {for } x=0 \end{cases}$$ is differentiable for any $x$. By Lagrange's Mean Value Theorem$$x^{2} \sin \frac{1}{x}=x\left(2 \xi \sin \frac{1}{\xi}-\cos \frac{1}{\xi}\right)\text{ where }0 <\xi <x$$Hence $$\cos \frac{1}{\xi}=2 \xi \sin \frac{1}{\xi}-x \sin \frac{1}{x} $$ As $x$ tends to zero, $\xi$ will also tend to zero. Passing to the limit, we obtain $$\lim\limits_{\xi \to 0} \cos (1 / \xi)=0$$ whereas it is known that $\lim \limits_{x \to 0} \cos \frac{1}{x}$ is non-existent.
Find the mistake in this reasoning. This proof seems logical but this is not valid. Why is this?