# Why is this function continuous but not differentiable?

I have a true and false on my practice exam about this function being continuous but not differentiable. The answer is true, but I don't understand how it is not differentiable. $$f(x) = \begin{cases} x\sin(1/x) & : \text{if }x \neq 0 \\ 0 & : \text{if }x=0 \end{cases}$$

I know that when $x$ doesn't equal $0$, that it is continuous and differentiable since $x\sin(1/x)$ is composed of 2 continuous and differentiable functions.

I also found it to be continuous when $x=0$. For it being differentiable at $x=0$, I took $\lim_{x\to 0}\frac{f(x)-0}{x-0}$ and got $\lim_{x\to 0}\frac{x\sin x}{x}$ and then the limit equals $0$. Does this not show it's differentiable? what am I doing wrong?

• You seem to have forgotten the $1/x$ in the argument of the sinus in your limit: $\frac{f(x)-f(0)}{x-0}=\frac{x\sin(1/x)}{x}=\sin(1/x)$ which has no limit as $x\rightarrow 0$, it keeps oscillating. Mar 1, 2016 at 12:15
• You should not put two formulas next to each other without a word between them. Mar 1, 2016 at 12:21

In the calculation of the limit you have substituted $r=1/x.$ The limit is not $\frac{r\sin r}r$ as $r$ goes to $0$ but (the same expression) as $r$ goes to $\pm\infty.$
• Why is it to infinity, if to figure out if something is differentiable I use as lim x goes to 0 $\frac{f(x)-f(0)}{x-0}$ Mar 1, 2016 at 12:15
• If you make that explicit, you will continue to have $\sin(1/x)$ instead of $\sin x$ unless you write a different variable (like $r$) to denote $1/x.$ But that new variable goes to $\pm\infty$ as $x$ goes to $0.$ Mar 1, 2016 at 12:16
Using the definition of derivative, we have $$\lim_{x \to 0} \frac{f(x) - f(0)}{x-0} = \lim_{x \to 0} \frac{x\sin\tfrac1x}{x} = \lim_{x \to 0}\sin\frac1x = \lim_{r \to \infty}\sin r$$ The last limit on the right does not exist, so $f$ is not differentiable at $x=0$.
Because $$sin (1/x)$$ is oscillating near 0 and the limit doesn't exist... And just use the fact that $$x^msin(1/x^n)$$ is differentiable iff $$m >1$$ .ofcourse the interval of consideration is $$[0,1]$$