If $c$ is a local extreme but not a strict local extreme of a continuous $f$, then does there exist $X$ such that $x \in X$ and $f(X)=f(x)$?
I recently solved problem involving local extrema, and during the process found it necessary to prove the following lemma:
Suppose $c$ is a non-strict local extreme of $f$, where $f(c)=y$ (i.e. $c$ is an extreme but not a strict extreme). Then, there exist infinite $x$ such that $f(x)=y$.
Which I proved as follows:
Suppose the contrary, i.e. $c$ is a non-strict local extreme of $f$, where $f(c)=y$, and there exist finite $x$ such that $f(x)=y$ and $x \neq c$ (which we label $x_1, x_2, x_3, \cdot, x_n$). WLOG $|x_1-c|\geq|x_2-c|\geq|x_3-c|\geq\cdots|x_n-c|>0$.
Consider the case where $c$ is a non-strict local minimum. Then $(\exists \varepsilon>0)(\forall x\in\mathbb{R})\,0<|x-c|<\varepsilon \Rightarrow f(c) \leq f(x)$, but $(\not\exists \varepsilon>0)(\forall x\in\mathbb{R})\,0<|x-c|<\varepsilon \Rightarrow f(c) < f(x)$, or equivalently $(\forall \varepsilon>0)(\exists x \in \mathbb{R})\,0<|x-c|<\varepsilon,f(c)=f(x)$
Now consider $\varepsilon=|x_n-c|$. Then $\varepsilon\geq|x_i-c|$ where $i$ is an arbitrary integer between $1$ and $n$. Hence, there does not exist an $x$ such that $0<|x-c|<\varepsilon$ but $f(x)=f(c)$, which means $c$ is not a non-strict local minimum. This is a contradiction.
The proof for the case where $c$ is a non-strict local maximum is similar.
But this led to a question: does there necessarily exist an interval $X\neq[c, c]$ containing $c$ such that $(\forall x \in X) f(x)=f(c)$?
This is not the case for discontinuous $f$. Consider the following function:
$$f(x)=\begin{cases} \lfloor\log_2(x)\rfloor \pmod 2, x>0 \\ 0, x=0 \\ 1, x<0 \end{cases}$$
Which looks like this:
Clearly at the intervals $\left(\frac{1}{2^{n+1}},\frac{1}{2^n}\right)$ where $n$ is an even number, $f(x)=0$, but there does not actually contain an interval containing $0$ (other than $[0, 0]$) where $f(X)=\{0\}$. If the interval contained negative numbers then $1\in f(X)$ as $f(x)=1$ for negative $x$. For intervals $[0, \varepsilon)$ or $[0, \varepsilon]$, we can find a subinterval where $f(x)=1$.
But $f$ is clearly discontinuous. Which raises the question: if $f$ is continuous, and $c$ is a non-strict local extreme (i.e. $(\forall \varepsilon>0)(\exists x \in \mathbb{R})\,0<|x-c|<\varepsilon,f(c)=f(x)$), does that imply that there exists an interval $X$ surrounding $c$ where $f(X)=\{f(c)\}$?
Solution 1:
It doesn't. Let's take $$f(x) = \left(x \cdot \sin\left(\frac{1}{x}\right)\right)^2$$ (and continued to zero $f(0) = 0$)
It has non-strict local minima in $0$ as it's zero in any point $\frac{1}{\pi n}$, but it's non-constant on any interval.