I am given the following function:

$$f : \mathbb{R} \rightarrow \mathbb{R} \hspace{2cm} $$

$$ f(x) = \left\{ \begin{array}{ll} x^2 \sin(\frac{1}{x}) & \quad x \neq 0 \\ 0 & \quad x = 0 \end{array} \right. $$

And I do not understand why this function is differentiable in $x = 0$, as my textbook claims. Firstly, I know that the function must be continuous in $x=0$ for us to even discuss the possibility of it being differentiable. For the function to be continuous at $x=0$, the limits of the function from both sides of $x=0$ must equal the value of the function itself at $x=0$. We have:


$$\lim\limits_{x \to +0}f(x) = \lim\limits_{x \to +0} x^2 \sin\bigg (\frac{1}{x} \bigg ) = 0$$

$$\lim\limits_{x \to -0}f(x) = \lim\limits_{x \to -0} x^2 \sin\bigg (\frac{1}{x} \bigg ) = 0$$

So we can see that the function is indeed continuous at $x=0$. Now it is natural to discuss differentiability. For the function to be differentiable at $x=0$, the limit of the derivatives from both sides of $x=0$ must be equal to the derivative itself at $x=0$. If I find the derivative of $f(x)$ I get:

$$ f'(x) = \left\{ \begin{array}{ll} 2x \sin(\frac{1}{x}) - \cos(\frac{1}{x}) & \quad x \neq 0 \\ 0 & \quad x = 0 \end{array} \right. $$


$$f'(0) = 0$$

$$\lim\limits_{x \to +0}f'(x) = \lim\limits_{x \to +0} 2x \sin \bigg( \frac{1}{x} \bigg) - \cos\bigg ( \frac{1}{x} \bigg )$$

$$\lim\limits_{x \to -0}f'(x) = \lim\limits_{x \to -0} 2x \sin \bigg( \frac{1}{x} \bigg) - \cos\bigg ( \frac{1}{x} \bigg )$$

And the last $2$ limits do not exist because of the $\cos(\frac{1}{x})$ term.

So I am really confused as to why this function is differentiable at $x=0$. What mistakes did I make in my reasoning? Why is the derivative of the function at $x=0$ well defined?

  • $\begingroup$ While it is true that differentiability at $0$ implies continuity at $0$, that does not oblige you to first verify continuity at $0$ before you go on to consider differentiability at $0$. And, in fact, once you have demonstrated differentiability at $0$, you may conclude continuity at $0$ without any further work. That's how implications work. $\endgroup$
    – Lee Mosher
    Dec 15, 2019 at 1:32

2 Answers 2


"Differentiable at $0$" does not mean that the derivative is continuous, but rather that the derivative exists at $0$. You can see it by taking the limits of the Newton quotients at $0$: $$ \frac{h^2\sin\frac1h}{h}=h\sin\tfrac1h\xrightarrow[h\to0]{}0, $$ so the derivative exists at $0$ and is $0$.

The "squeezing" by $x^2$ is what makes the function differentiable at $0$: enter image description here


Diffentiability of $f$ at $0$ doesn't guarantee the continuity of $f'$ at $0$, and this is a classic example.

Indeed, the reasoning of the differentiability of $f$ at $0$ is the following.

For $h\ne 0$, $|f(h)-f(0)|=|f(h)|=|h^{2}\sin(1/h)|$, so $|f(h)/h|\leq|h||\sin(1/h)|\leq|h|\rightarrow 0$, therefore $f'(0)=0$.


You must log in to answer this question.