Where is the mistake ( in using mean value theorem)? $$   f(x)=
      \begin{cases} 
      x^2\sin \frac1x &  x \ne 0 \\
      0 & x=0\\ 
   \end{cases}
$$
$f$ is differentiable everywhere and 
$$   f'(x)=
      \begin{cases} 
      2x\sin \frac1x-\cos \frac1x &  x \ne 0 \\
      0 & x=0\\ 
   \end{cases}
$$
$f$ satisfies the MVT. Using it on $(0,x)$ we get:
$$\frac{x^2\sin \frac1x-0}{x-0}= 2c\sin \frac1c-\cos \frac1c$$
$c\in(0,x)$
When $x\to0$ then $c\to0$. So we have a contradiction
$$0=\lim \limits_{x \to 0}x\sin \frac1x=\lim \limits_{c \to 0}2c\sin\frac1c-\cos\frac1c$$
Last limit doesn't exist where is the mistake ?
I see that $\lim \limits_{x \to 0}f'(x) $ doesn't exist but MVT still applies?
Using a limit inside of an interval is something i dont understand dont we then get a single point? This process is important it used in the proof of l"Hospital rule.
 A: In the last equation, the "constant" $c$ actually depends on $x$, so it can really be viewed as a function $c(x)$:
$$0=\lim \limits_{x \to 0}x\sin \frac1x=\lim \limits_{c \to 0}2c(x)\sin\frac1{c(x)}-\cos\frac1{c(x)}$$
All you know about $c(x)$ is that $0<c(x)<x$ (which implies $c(x)\to 0$ when $x\to 0$), but it may have nice additional properties that "smoothen" the expression on the right so that the limit would exist. (Imagine, for example, if $\frac{1}{c(x)}$ is always an odd multiple of $\frac{\pi}{2}$ so the "offending" $\cos$ is always $0$...)
A: $c$ depends on $x$. call it $c(x)$. There is no contradiction in $\lim _{x \to 0} \cos(\frac 1 {c(x)})=0$ even though $\cos (\frac  1 c)$ itself does  not have a limit as $c \to 0$. [Like a subsequence of sequence being convergent even though the squence itself is not]. 
A: MVT indicates that there exists $c$ s.t.
$$
2c \sin \frac 1c - \cos \frac 1c = x \sin \frac 1x [c =tx , t\in (0,1)]
$$
so generally we cannot assert that
$$
\lim_{c \to 0 } 2c \sin \frac 1c - \cos \frac 1c = \lim _{x \to 0} x \sin \frac 1x  
$$
since $x \to 0 \implies c \to 0$ when $c = tx$ for some $t \in (0,1)$ but not the other way around. 
To be clear, the limit on the LHS requires $c$ approaches $0$ via every possible "routes", while the MVT method only picked some of them. 
A: The mean value theorem says that there exists some $c$ in the interval $(0,x)$ such that [...]. And it is indeed the case that for any $x>0$ you can find such a $c$. That is not to say that any $c$ in $(0,x)$ satisfies the MVT, or even that the other numbers in $(0,x)$ behave nicely.
So what the MVT actually tells you in this case is that for any $x>0$, there is a $c_x\in(0,x)$, and these $c_x$ are such that $$2c_x\sin\frac1{c_x}-\cos \frac1{c_x}\to 0$$
