Is a function differentiable at a point if its derivative is continuous at that point?

My professor said that the title statement might not always be the case and gave $$x^2 \sin\left(\frac{1}{x}\right)$$ at $$x=0$$ as a counter-example.

But I don't seem to understand its differentiability and continuity at the point $$x=0$$.

Any explanation and if possible a better example are highly appreciated.

• Maybe helpful: math.stackexchange.com/questions/2776837/…. Your function (assuming you define it as $0$ at $x=0$) provides us an example of a function being differentiable at a point without the derivative being continuous there. – Minus One-Twelfth May 24 at 11:19
• This is an example of a function that is differentiable; but whom’s derivative is not continuous... So the title should be the other way around – Maximilian Janisch May 24 at 11:40

Since $$x = 0$$ is not in the domain of $$f(x)$$, let's define $$f(0) = 0$$. Here's how it becomes continuous if we do so.

Continuity at $$x = 0$$:

$$\lim_{x \to 0} x^2 \sin(\frac{1}{x}) = 0$$

The function is continuous because $$\sin(t) \in [-1,1] \quad \forall t$$.

Differentiability at $$x = 0$$:

$$\lim_{h \to 0} \frac{h^2 \sin(\frac{1}{h}) - 0}{h}$$ $$=\lim_{h \to 0} h \sin(\frac{1}{h}) = 0$$

This will hold for the LHD as well. I have only considered the RHD. (Verify it!)

Therefore $$f(x)$$ is differentiable as well.

Now the above explanation only holds if we define $$f(0) = 0$$ and not otherwise.

Now coming to the statement in the title of the question, it doesn't make much sense. Because if the derivative of a function is continuous, it is implicit that the derivative exists at that point.

Edit: In this case the derivative is not continuous. For this consider $$f'(x)$$ at $$x \neq 0$$ (can be simply obtained by applying the product rule and chain rule to $$f(x)$$), with the fact that $$f'(0) = 0$$ and observe that it indeed isn't continuous at $$x =0$$. Maybe your professor meant that just because the derivative exists doesn't imply that it is continuous.

I think your professor gave you that

$$f(x)=x^2 \sin(\frac{1}{x})$$, if $$x \ne 0$$ and $$f(0)=0.$$

For $$x \ne 0$$ we have $$f'(x)=2x \sin(\frac{1}{x})-\cos(\frac{1}{x})$$ and $$f'(0)=0.$$

Now let $$x_n= \frac{1}{n \pi}.$$ Then $$x_n \to 0$$, but $$f'(x_n)=(-1)^{n+1}.$$

Hence $$(f'(x_n))$$ does not converge (t0 $$f'(0)$$). This shows that $$f'$$ is not continuous at $$x=0.$$