Showing by an example that $f'(x)$ may exist everywhere but need not be continuous Let $f(x)=x^2\sin\left(\dfrac{1}{x}\right)$ I'm asked to show that $f'(x)$ exists everywhere but is not continuous.$f'(x)=2x\sin\left(\dfrac{1}{x}\right)-\cos\left(\dfrac{1}{x}\right).$ We can see that $\lim_{x\to0}f'(x)$ does not exist. It is not continuous at $x=0.$
But It does not exist everywhere? At $x=0,$ $f'(x)$ takes on many different values, it is not defined everywhere,
So Doesn't this show that the $f'(x)$ does not exist at $x=0$?
 A: The original function is not even defined at 0.  The example is supposed to be defined as what you wrote with f(0)=0 additionally.  In that case the derivative you wrote is valid when $x\neq 0$.  To compute the derivative at 0 you should use the limit definition.
A: I assume $f(0)$ is defined to be $0$. $f'(x) = 2x\sin\frac 1 x - \cos\frac 1 x $ for nonzero $x$, but at $x = 0$,
\begin{align*}
f'(0) &:=\lim_{h\to 0} \frac{f(h) - f(0)}{h - 0}\\
&= \lim_{h\to 0}\frac{h^2\sin\frac1 h}{h}\\
&=\lim_{h\to 0} h\sin\frac1 h\\
&= 0.
\end{align*}
Thus, because $\lim_{x\to 0} f'(x)$ does not exist but $f'(0) = 0$, $f'$ is discontinuous but exists everywhere.
If you look at the requirements needed to apply rules like the product rule and chain rule at a point $c$, you see that they require that $g$ be differentiable at $c$ in order to say that $(f\circ g)'(c) = f'(g(c)) g'(c)$.  You need to perform the computation of $f'(0)$ separately, because $\frac1 0$ isn't a number, and hence $0^2\sin\frac1 0$ is not a number either, and so the formula $x^2\sin\frac1 x$ does not make any sense at $x = 0$ and the above rules cannot be applied there; the limit definition must be used instead.
A: Hint
$$f(0)=\lim_{x\to 0}f(x)=0$$
$$f'(0)=\lim_{x\to 0}\frac{f(x)-f(0)}{x}$$
$$=\lim_{x\to 0} x\sin(\frac{1}{x})=0.$$
