TITLE: Calculus Proof Unsure
QUESTION [5 upvotes]: Let $$g(x)=x^2\sin\left(\frac{1}{x}\right)+\frac{1}{2}x$$ Show that $g'(0)>0$ but there is no neighborhood of $0$ on which $g$ is increasing. (More precisely, every interval containing $0$ has sub intervals on which g is decreasing). 
For the first part, I used the limit definition of the derivative to calculate $g'(0)=0.5$. I have an intuitive understanding of the second part but I am having trouble coming up with an approach as to how to come up with the proof for it. Any help would be appreciated.

REPLY [4 votes]: This is a very good question. Clearly $$g'(x) = 2x\sin\left(\frac{1}{x}\right) - \cos\left(\frac{1}{x}\right) + \frac{1}{2},\,\,\text{if }x \neq 0$$ and $$g'(0) = \lim_{x \to 0}\frac{g(x) - g(0)}{x} = \lim_{x \to 0}x\sin\left(\frac{1}{x}\right) + \frac{1}{2} = \frac{1}{2}$$ Thus we have $g'(0) > 0$. But if we see the function $g'(x)$ it consists of three parts: 1) $2x\sin(1/x)$ which tends to $0$ as $x \to 0$, 2) $-\cos(1/x)$ which oscillates between $-1$ and $1$ and 3) $1/2$ which remains constant. Thus as $x \to 0$, $g'(x)$ oscillates between $(-1 + (1/2))$ and $(1 + (1/2))$ i.e. between $-1/2$ and $3/2$. It follows that if we take any interval $(-h, h)$ around $0$ then we have $g'(x) < 0$ at some points in this interval (because of oscillation around the negative value $-1/2$). And hence $g(x)$ is not increasing in any interval containing $0$.
If we observe carefully our argument we find that the modified function $f(x) = x^{2}\sin(1/x) + kx$ also has the same behavior as $g(x)$ if $0 < k < 1$. If $k = 1/2$ then $f(x) = g(x)$. We can analyze the behavior for $f(x)$ in case $k \geq 1$ with some more difficulty.