Q:

an example related to derivatives

How can I construct an example of the following?
$f$ is differentiable at $x_0$ but $\lim_{x\to x_0} f'(x)$ does not exist?
A bit stupid but if a function that doesn't have a limit at a point does that mean left hand limit is not equal to the right hand limit?
Can I construct $f$ such that $f=0$ for all $x\in (-\infty,0]$ and $f=\sin(x)$ for all $x \in (0, \infty)$ and take $x_0$ to be at zero? 

A:

Take$$\begin{array}{rccc}f\colon&\mathbb R&\longrightarrow&\mathbb R\\&x&\mapsto&\begin{cases}x^2\sin\left(\frac1x\right)&\text{ if }x\neq0\\0&\text{ if }x=0.\end{cases}\end{array}$$Then $f$ is differentiable everywhere, but the limit $\lim_{x\to0}f'(x)$ doesn't exist, since, if $x\neq0$,$$f'(x)=2x\sin\left(\frac1x\right)-\cos\left(\frac1x\right)$$and, although the limite $\lim_{x\to0}2x\sin\left(\frac1x\right)$ exists (it is equal to $0$), the limit $\lim_{x\to0}\cos\left(\frac1x\right)$ doesn't.

