# every point takes local extreme value

If $f:\mathbb{R}\to\mathbb{R}$ then it's a fact that we can only have countable local extreme values, so if the function is continuous and every point takes a local extreme value (could be a local maximum or local minimum value ) , we know f must be constant.

My question is: if we drop the condition continuous, can we prove there must be a interval that f is constant on it?

No. Take $f=\chi_{\mathbb Q}$, the characteristic function of the rationals. Then every point of $\mathbb Q$ is a local maximum and every point of $\mathbb{R}\setminus\mathbb Q$ is a local minimum.

• Hi, what if every point takes local maximum value？ – Idele Aug 14 '17 at 16:07
• @hctb I don't know. My guess is that then the function must be constant on some interval. I suggest that you ask this question here. – José Carlos Santos Aug 14 '17 at 22:14

Let $f(x)=1$ if $x \in \mathbb Q$ and $f(x)=0$ if $x \in \mathbb R \setminus \mathbb Q$.

Let $x_0 \in \mathbb R$.

Case 1: $x_0 \in \mathbb Q$. Then $f(x) \le f(x_0)$ for all $x$. Hence, $f$ has a global maximum in $x_0$

Case 2: $x_0 \notin \mathbb Q$. Then $f(x) \ge f(x_0)$ for all $x$. Hence, $f$ has a global minimum in $x_0$.

But there is no interval such that $f$ is constant on it.

• What if every point takes local maximum value？ – Idele Aug 14 '17 at 8:00