# Function that is constant on connected components but not locally constant

The Wikipedia page for locally constant function says that a locally constant function is constant on each connected component, but that the converse only holds if the space is locally connected. What would be an example of a function that is constant on each connected component but not locally constant?

I first thought of the topologist's sine curve, which is not locally connected, but since this is a connected space, such a function would be constant on the entire space and therefore automatically locally constant.

## 2 Answers

After some further thought, I think if we take $$X = \{0\}\cup\{\frac{1}{n}\}_{n \ge 1}$$ with the euclidean topology and the identity function, this would be an example, because it is not locally constant at 0.

(I leave this question up in case it helps anyone else.)

I think the key insight is that the connected component of $$x$$ is not necessarily a neighbourhood of $$x$$ (and it doesn't in general give a disconnection of the space!). I remember having to fine-tune my own intuition about "the connected component of $$x$$ is the sub-blob in which $$x$$ lives" a bit when I learned about connected components, precisely because of this issue. The example above is a good one.

Another good example to know about is $$\Bbb Q$$, with its usual topology! If you ever think a fact about connected components is obviously true, it's worth having a quick check to see if it's true in $$\Bbb Q$$. More generally, any totally-disconnected-but-not-discrete space. On such a space, every function is constant on the connected components, but there will be non-locally constant functions. For example, the identity function is not locally constant, since there is some point $$x$$ for which every neighbourhood of $$x$$ contains another point.

• A search of examples of totally disconnected but non-discrete spaces: topology.pi-base.org/… Nov 1, 2023 at 3:20