# Prove there is no neighborhood of $0$ on which $f$ is monotonically increasing.

I have $f:\mathbb R\rightarrow \mathbb R$ defined as $$f(x) = \left\{ \begin{array}{c} x-x^2 & \text{ if } x\in\mathbb Q \\ x+x^2 & \text{ if } x\notin \mathbb Q. \end{array} \right.$$ What I've done so far is: say $I$ is a neighborhood of $0$, so $\exists \varepsilon>0: (-\varepsilon,\varepsilon)\subseteq I.$ The density of the irrationals implies $\exists \alpha\in (0,\varepsilon)$ with $\alpha$ irrational. Now I'm trying to prove that there exists some rational number $\beta\in (\alpha,\varepsilon)$ where $f(\beta)<f(\alpha).$ Any tips on pinning $\beta$ down (without getting too messy)?

• @Quickbeam2k1: $x - x^2 > 0$ for $0 < x < 1$. Feb 4, 2015 at 22:05

Suggestion Draw the graphs of both parabolas to see the configuration around $0$.
It should be clear that the graph of $x+x^2$ lies above that of $x-x^2$ on $(0, \epsilon)$ for a small $\epsilon>0$.
I think I just solved it actually. Consider the function $g(x) = \alpha + \alpha^2 - (x-x^2).$ Then $g(\alpha) = 2\alpha^2>0,$ and since $g$ is continuous, $\exists \delta > 0: \forall x\in B_\delta(\alpha),$ $g(x)\in B_{2\alpha^2} g(\alpha),$ that is, $g(x)>0.$ Let $m=\min(\alpha+\delta,\varepsilon).$ By the density of the rationals there exists a rational $\beta\in (\alpha,m).$ Then $\alpha,\beta\in I$ and $\alpha < \beta$ but $f(\alpha)>f(\beta).$