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:
$$f(0)=0$$
$$\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.
$$
So
$$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?
Best Answer
"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$: