Function which derivative at $0$ is $1$ but is not monotonic increasing
Please, I need help in order to understand the following assumption that I've found in Bartle's book Introduction to Real Analysis page 171. It says: One might suppose that, if the derivative is strictly positive at a point, then the function is increasing at this point. However, this supposition is false; indeed, the differentiable function defined by
\begin{equation} g(x)=\begin{cases} x+2x^2\sin(\frac{1}{x}), & \text{if $x\neq 0$},\\ 0, & \text{$x=0$}. \end{cases} \end{equation}
Ok. So I've got that $g$ is continuous at zero and $$g'(0)=1, g'\left(\frac{1}{2n\pi}\right)=-1<0, \text{ and } g'\left(\frac{1}{(2n+1)\pi}\right)=3>0.$$ So this function has positive derivative at zero but $g$ is not increasing in any neighborhood of $x = 0$? What am I doing wrong here?
So far what I know is that if a function has positive derivative at a point we can find a neighborhood of that point where the function is increasing. Thanks for any help on this.
Your claim that a function $f$ such that $f'(x) > 0$ is increasing in a neighborhood of $x$ is generally only true for $C^1$ functions (functions that have a continuous derivative). In general it's not true. Indeed, try to prove it, and you'll see that you need $f'$ to be positive in a whole neighborhood of $x$, not just at $x$ (proofs can use the mean value theorem, for example).
Here the function can be increasing in a neighborhood of $0$, because if it were the derivative would be positive in a neighborhood of $0$ (again, MVT), but $g'(\frac{1}{2n\pi}) < 0$ so any neighborhood of zero contains points where the derivative is negative.