# Why is $f(x)$ not differentiable at $0$?

Consider the function:

$$f(x) = \begin{cases} 0 & x=0\\ |x^2\sin\frac1x| & x \neq 0 \end{cases}$$

I can easily verify that $\lim_{x \to 0} f(x) = 0$ using the squeeze theorem on $(-1, 1)$. So $f'(0)$ must exist.

On the other hand, the derivative is not defined at $x=0$.

I'm confused here. I understand that I've shown that $f(x)$ is continunous at $0$, but isn't the requirement for it to be differentiable the same in this particular case $$\lim_{x \to 0} \frac{f(x)-f(0)}{x-0} = \lim_{x \to 0} f(x)$$

Why is $f(x)$ not differentiable at $0$?

• $f$ is very much differentiable at $0$, it's just that the derivative is not continuous there. Also, $\frac{f(x)-f(0)}{x-0}$ is not equal to $f(x)$, but rather to $\frac{f(x)}x$. Feb 7, 2017 at 22:49
• On the other hand, just because $\lim_{x\to 0}f(x)=0$ doesn't mean that $f'(0)$ must exist -- for example, this reasoning fails for $f(x)=|x|$. Feb 7, 2017 at 22:55

Since $f(0)=0$ and $|\sin x |\leq 1$ for all $x\in \mathbf R$ we have $$\lim_{x\to 0} \frac{f(x)-f(0)}{x}=\lim_{x\to 0} \left| x\sin \frac{1}{x} \right| =0,$$ what shows that $f$ is differentiable in $0$.
Maybe you are confused because the function $g\colon \mathbf R \to \mathbf R$ with $$g(x) = \begin{cases} 0 & x=0\\ \left|x\sin\frac1x \right| & x \neq 0 \end{cases}$$ is not differentiable in $0$. The reason is that the limit $\lim_{x\to 0} \left|\sin\frac1x \right|$ does not exist.
I can easily verify that $\lim_{x \to 0} f(x) = 0$ using the squeeze theorem on $(-1, 1)$. So $f'(0)$ must exist.
This is incorrect. $f$ being continuous at $a$ does not imply that that $f$ is differentiable at $a$. But the converse is true. That is, if you know $f$ is differentiable at $a$, you can indeed conclude that it is continuous at $a$.