Let $f:[a,b]\rightarrow\mathbb{R}$ be a continuous real function and assume $f(a)<0<f(b)$. Does $f$ necessarily have a point $c\in (a,b)$ such that $f\leq 0$ on a left neighborhood of $c$ and $f\geq 0$ on a right neighborhood of $c$ (a "switching point", for that matter)?
This is a seemingly simple question, but it took me longer than I expected to answer it. The answer turns out to be negative; however the counterexample I found it a bit "exotic" and I wondered if simpler examples can be found.
My counterexample is based on the Cantor set, and it actually produces a smooth $f$. First, for a closed interval $I$, let $g_I$ be a smooth bump function whose support is $I$. Specifically, $g_I(x)>0$ for $x\in I$ and $g_I(x)=0$ otherwise. Let $\mathcal{I}_n$ be the set of intervals removed at the $n$-th stage of the construction of the Cantor set (of which there are $2^{n-1}$). Define $f:[0,1]\rightarrow\mathbb R$ by $$f(x)=\sum_{n=1}^\infty \sum_{I\in\cal{I}_n}(-1)^ng_{I}(x).$$Note that all the removed intervals are pairwise disjoint, so $f$ is well-defined.
Now, it's not to hard to prove that:
- $f$ is smooth.
- The set $\left\{x:f(x)=0\right\}$ is the Cantor set $C$. Therefore any $x\not\in C$ can't be a switching point of $f$.
- For every $c\in C$, there's a negative point and a positive point in every right and every left neighborhood of $c$. Therefore $f$ has no switching points.
Now it only remains to choose $0<a<b<1$ such that $f(a)<0<f(b)$.
This turned out to be more involved than I expected; are any simpler counterexamples, preferably ones that would appear more "familiar" to a standard Calculus course major?