# Property of a continuous function in the neighborhood of a point

Let $f:\mathbb{R} \to \mathbb{R}$ be a differentiable function. Let $a \in \mathbb{R}$ and define the following sets: \begin{align*} M= \{x>a \mid f(t)>f(a), \forall t \in (a,x] \}\\ N=\{x>a \mid f(t)=f(a), \forall t \in (a,x] \}\\ P=\{x>a \mid f(t)<f(a), \forall t \in (a,x] \} \end{align*} Prove that at least one of these sets is not empty.

I tried to prove this by contradiction. If they were all empty, then, for all $n \in \mathbb{N}_{\geq 1}$ there would be some numbers $a_n,b_n,c_n \in (a,a+\frac{1}{n})$ such that $f(a_n) \leq f(a), \: f(b_n) \neq f(a)$ and $f(c_n) \geq f(a)$. But these sequences that are formed seem independent, and I couldn't connect them such that I reach a contradiction.

The fact that at least one of these sets is not empty is pretty obvious on a graph, but I didn't manage to prove it rigorously. I think I'm missing something obvious.

Edit: Thank you for your counterexamples! As mentioned in one of the comments, I added the differentiability of the function.

• I have doubts about this question after see the graph of a scaled version of topologists' sine curve. $$f(x) = \begin{cases}x \sin\dfrac1x & x \ne 0 \\ 0 & x = 0 \end{cases}$$ Here $a = 0$. It oscillates in every neighbourhood of $(0,0)$, and you can't find such interval $(0,x]$ such that $f$ is monotone. Apr 1, 2018 at 14:29

If you take $f(x)=\begin{cases}x^2\sin(1/x),& x\neq0\\0,& x=0\end{cases}$ and take $a=0$, then for all $x>0$, there are values of $t_1,t_2,t_3\in(0,x]$ such that $f(t_1)>0=f(0)$, such that $f(t_2)=0=f(0)$ and such that $f(t_3)<0=f(0)$, respectively.

Therefore $M,N,P$ are empty.

Observe that $f$ is even differentiable at all points. Therefore, even for differentiable it is not true.

One can even have $f$ smooth. For example, replace the $x^2$ above with $e^{-1/x^2}$ and the function will be smooth, but still have the same oscillatory behavior near $x=0$.

• @ervx The derivative of $f'(0)=\lim_{x\to0}\frac{f(x)-f(0)}{x}=\lim_{x\to0}\frac{x^2\sin(1/x)}{x}=\lim_{x\to0}x\sin(1/x)=0$.
– user547557
Apr 1, 2018 at 14:33
• Seems you are right. If the function is infinitely differentiable, then it should be okay.
– ervx
Apr 1, 2018 at 14:38
• @ervx No, not enough. By Whitney's extension theorem you can produce a smooth function with all that oscillation and all derivatives equal to zero at the origin. A condition that ensures it is non-zero derivative, for example.
– user547557
Apr 1, 2018 at 14:43
• @ervx Or even simpler, use $e^{-1/x^2}\sin(1/x)$ instead of $x^2\sin(1/x)$.
– user547557
Apr 1, 2018 at 14:45

This is not true in general! Consider

\begin{aligned} f(x):= \begin{cases} x\sin(1/x)&\text{ if }x\not =0\\ 0 &\text{ if }x=0 \end{cases} \end{aligned}.

This function is continuous at the point $0$, but it oscillates indefinitely as it approaches $0$. Hence, all three of your sets will be empty.

• Yes, actually my function was also differentiable, but I thought only continuity was needed. How can we prove it in that case? Apr 1, 2018 at 14:29