2

After hearing about "locally constant". This question popped up in my mind.

Is there a continuous non-constant function $f: \mathbb{R} \to \mathbb{R}$ which is locally constant everywhere? That is given any $r \in \mathbb{R}$, there exists $\epsilon >0$ such that $f(B_{\epsilon}(r))=\{f(r)\}$. In words, given any $r \in \mathbb{R}$, there is a neighborhood of $r$ where such that the restriction of the function $f$ is constant.

I tried to solve this problem by assuming that $x \neq y$ and then showing that $f(x)=f(y)$, but it is possible that we cannot do that in finite number of steps, and even in countably infinite number of steps. then how can I solve this?

Bernard
  • 179,256
  • 1
    You have to use the fact that a line segment $[x,y]$ is compact. That is, from any cover of the segment by balls $B_{\epsilon}(z)$ you can select a finite sub cover. Now, the function will be constant on each ball and these balls have no-empty intersection so the function has to be constant on the whole segment $[x,y]$. – Salcio Feb 28 '21 at 14:10

3 Answers3

2

If $f:X\to Y$ is a function that is locally constant at every point and $X$ is connected then $f$ is (globally) constant. So the answer is no with domain $\Bbb R$ in the usual topology. If we give it the discrete metric topology then every function on $\Bbb R$ is locally constant trivially. A complete proof for the connected domain case can be found here.

Henno Brandsma
  • 250,824
1

Take $r$ in the image of $f$ and consider $A=\{x\in\mathbb{R}:f(x)\ne r\}$, which is open in $\mathbb{R}$. Let $x\in\mathbb{R}$ such that $f(x)=r$; then there is a neighborhood $U$ of $x$ such that $f(y)=r$, for every $y\in U$. Therefore also $B=\{x\in\mathbb{R}:f(x)=r\}$ is open. Since $\mathbb{R}$ is connected, the only possibility is that $A=\emptyset$, because $B\ne\emptyset$.

So the only case when the function is locally constant is when it is constant.

More generally, if $f\colon X\to Y$ is a locally constant continuous function between topological spaces (metric spaces, if you prefer) is constant in every connected component of the domain.

egreg
  • 244,946
0

The closest function that comes to mind is the Cantor-Function. It is continuous, non-constant and its derivative is 0 almost everywhere, in the sense that the derivative doesnt vanish on a lebesgue zero set $A\subset [0,1]$. I hope i didnt miss anything wrong when writing this and could help a little.

bsvgu
  • 143
  • I think the Cantor Function is locally constant almost everywhere, not everywhere (but that's just from looking at it's graph: I'm not certain.) – Adam Rubinson Feb 28 '21 at 14:40
  • Yeah i forgot to mention that it should follow from the fact that its derivative vanishes "almost everywhere". Could have made it more clear, also i typed " the closest ", as in " the closest function satisfiying the criteria, i can come up with". Very sloppy written by me, i must admit. :) – bsvgu Feb 28 '21 at 15:54
  • No, it’s interesting. I can see how your example is relevant. But it doesn’t answer OP’s question. So maybe you should have left it as a comment rather than an answer. Just my opinion. – Adam Rubinson Feb 28 '21 at 16:06