I'm trying to prove that
$$f(x)=\begin{cases}\dfrac{x}{2}+x^2\sin\left(\dfrac{1}{x}\right)& x\neq 0,\\0, &x=0.\end{cases}$$
has a derivative everywhere. Here is what I have done:
Let $x_0\in\Bbb{R}-\{0\}$ where $x\neq x_0$
$$\dfrac{f(x)-f(x_0)}{x-x_0}=\dfrac{\left[\dfrac{x}{2}+x^2\sin\left(\dfrac{1}{x}\right)\right]-\left[\dfrac{x_0}{2}+x_0^2\sin\left(\dfrac{1}{x_0}\right)\right]}{x-x_0}$$
$$=\dfrac{\left(\dfrac{x-x_0}{2}\right) + x^2\sin\left(\dfrac{1}{x}\right)-x^2\sin\left(\dfrac{1}{x_0}\right)}{x-x_0}$$
$$=\dfrac{1}{2}+\left(x+x_0\right) \sin\left(\dfrac{1}{x}\right)+x^2\left[2\sin\left(\dfrac{x-x_0}{2}\right)\cos\left(\dfrac{x+x_0}{2}\right)\right].$$
So, attaching limit
$$f'(x_0)=\lim\limits_{x\to x_0}\dfrac{f(x)-f(x_0)}{x-x_0}=\dfrac{1}{2}+2\,x_0 \sin\left(\dfrac{1}{x_0}\right).$$
Hence, $f$ has a derivative everywhere, since the case of $x=0$ is obvious. But I have not tried it.
Questions:
- Am I right?
- How do I get an open interval containing $x=0$ in which $f(x)$ is increasing?
HINT
For $x\neq 0$ let derive $f(x)$ according to the expression given.
For $x=0$ let apply the definition of derivative by limit of the incremental ratio at $x=0$, that is
$$f'(0)=\lim\limits_{x\to 0}\dfrac{f(x)-f(0)}{x-0}$$
As noted in the comments, since $f’(x)=1/2 +2x\sin(1/x)-\cos(1/x)$ for $x\to 0$ the derivative oscillates between $-\frac12$ and $\frac 32$ therefore there is no interval containing $0$ with $f$ monotone.