Suppose $f(x)=\begin{cases}
x^2\sin\dfrac{1}{x},& x\ne0\\
0,& x=0
\end{cases}$

It is continuous at $x=0$, it is differentiable at $x=0$, $f'(0)=0$

Can we say $f(x)$ is differentiable at $\forall$ $x$?

**If yes, then we can differentiate it**.

$f'(x)=2x\sin\dfrac{1}{x}-\cos\dfrac{1}{x}$

$f'(0)$ is undefined here. It means our assumption was wrong, so function is not differentiable at $\forall x$

So now it raises a question can we differentiate a function only if it is differentiable at $x$ or if it is differentiable in some finite interval like $(2,5)$?