TITLE: Continuity and differentiability of a piecewise trig function
QUESTION [0 upvotes]: Before I go ask my question, I need to mention that the closest problems I have found are these: 1. and 2.. Maybe there are more, but I couldn't find those. And, here's my question:
Let, $$f(x) = \{x \sin (1/x),  x \neq 0$$
$$\{0,   x = 0$$

Is $f$ continuous on $\mathbb{R}$
Is $f$ differentiable on $\mathbb{R}$

For the first part, I am trying to understand this without using $\epsilon-\delta$ definition but using sqeeze theorem, and for the 2nd part, the answers on the other problem did not make much sense to me. So, I have no choice but asking the same question. 
My thoughts for the problem: 1. $f(x) = 0,$ whenever, $x = 0.$ But, for $x \neq 0,$ we know $- x \leq x \sin(1/x) \leq x$, lim$_{x \to 0} -x = 0$ and lim$_{x \to 0}  x = 0 \Rightarrow f(x) = 0.$ Not sure what to conclude.

$f'(x) = \sin(1/x) - (1/x) \cos(1/x)$. From here can we say $f$ is differentiable on $\mathbb{R} - \{0\},$ since $f'(x)$ is undefined when $x = 0$?

REPLY [0 votes]: For (1), be careful. You should have $-|x|\leq x\sin(1/x)\leq |x|$. You have to keep in mind negative numbers. Since $\pm|x|$ is continuous and $|0|=-|0|=f(0)=0$, you know by the squeeze theorem that $f$ is continuous. 
For differentiablity, go back to the definition: $$f'(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}.$$ In this case, $$\lim_{h\to 0}\frac{f(h)-f(0)}{h}=\lim_{h\to 0}\frac{h\sin(1/h)}{h}=\lim_{h\to 0} \sin(1/h).$$ This limit does not exist, so the function is not differentiable at $0$.
{"set_name": "stack_exchange", "score": 0, "question_id": 1366112}