# Question about monotonic functions

Is the function $y=x/2 + x^{2}\sin(1/x)$ monotonic near $0$? The f' obviously goes + and - near $0 (f'= 1/2 + 2x\sin(1/x) - \cos(1/x))$, so does that mean that f is not monotonic near $0$?

-
If $f'$ takes both positive and negative values in every neighborhood of $0$, then $f$ cannot be monotonic in any neighborhood of $0$. –  Eckhard Dec 18 '12 at 18:34
Think of it this way: if the derivative takes on both positive and negative values near 0, then the function both increases and decreases near 0. So, it isn't either just increasing or just decreasing no matter how close to 0 we get, meaning it can't be monotone at 0. –  Lopsy Dec 18 '12 at 18:36
Thank you guys... i wasn't sure about f but for small x 2xsin in f ' is ~0 so 1/2 - cos(1/x) i think can be both + and - (depending on cos)... –  Maar Dec 18 '12 at 18:39
Nevertheless, you of course do have $f(x)>f(0)$ for $x>0$ and $f(x)<f(0)$ for $x<0$. –  Hagen von Eitzen Dec 18 '12 at 19:08
Show (by continuity) that for any $\epsilon$, there is an $a$ with $|a|\lt \epsilon$, and an interval about $a$, such that $f'(x)\lt 0$ in that interval. So by Mean Value Theorem, $f$ is decreaing in that interval. Repeat with $f'(x)\gt 0$. –  André Nicolas Dec 18 '12 at 19:36
add comment

## 1 Answer

It may be appropriate to now summarize what is spread across comments into an answer.

The function $$f(x) = \begin{cases}\tfrac x2+x^2\sin(1/x)&\text{if }x\ne 0\\ 0&\text{if }x=0\end{cases}$$ has one property that may make it look like being monotonic near $0$: For $0<|x|<\frac 12$ we have $|x^2\sin(1/x)|\le|x^2|<\left|\frac x2\right|$, hence $f(x)>0$ for $0<x<\frac12$ and $f(x)<0$ for $-\frac12 < x < 0$, just as would be expected from a function monotonic near $0$ (the result may be called monotonic at $0$, but I'm not sure if that concept is in use). However, we say that $f$ is monotonic near $0$ if there exists an open neighbourhood $U$ of $0$ such that the restriction $f|_U$ of the given function $f$ to that neighbourhood $U$ is monotonic. As you already noted, for $x\ne0$ we have $$f'(x)= \frac 12 + 2x\sin(1/x) - \cos(1/x).$$ Let $U$ be an open neighbourhood of $0$. For $n\in \mathbb N$ big enough, we have $\xi:=\frac1{2n\pi}\in U$. Then we check that $f'(\xi)=-\frac12<0$. Since $U$ is open, we have $\xi+h\in U$ for all sufficiently small positive $h$. By the definition of derivative, for all sufficiently small positive $h$ we have that $\left|\frac{f(\xi+h)-f(\xi)}{h}-f'(\xi)\right|<\frac12$ and hence $f(\xi+h)<f(\xi)$. On the other hand, we already saw that $f(\xi)>0$ because $0<\xi<\frac12$. Then from $f(0)<f(\xi)>f(\xi+h)$ we see that $f|_U$ is not monotonic.

-
add comment