# Locally Constant Functions on Connected Spaces are Constant

I am trying to show that a function that is locally constant on a connected space is, in fact, constant. I have looked at this related question but my approach is a little different than the suggested approach and I'm unsure about the final step and would appreciate a tip. Here is what I have so far:

Let $f$ be a locally constant function on the connected space $U$. Assume that $f$ is not constant. Then, there are distinct points $x$ and $y$ such that $f(x) \neq f(y)$. Now, since $f$ is locally constant there are neighborhoods $V_x$ of $x$ and $V_y$ of $y$ such that

$$f(V_x) = k_x, \;\; f(V_y) = k_y$$ for some constants $k_x \neq k_y$ .It follows that $V_x \cap V_y =\emptyset$

Now, let $A = U-V_x \cup V_y$ and $B = V_x \cup V_y$ so that $U = A \cup B$. With this, we have expressed $U$ as a union of disjoint sets. Since $V_x$ and $V_y$ are open $B$ is open. Note that if $A$ is empty we are done because $V_x$ and $V_y$ would comprise a separation of $U$ wich would imply that the assumption about f being not constant was faulty. So, assume $A$ is nonempty.

At this point, I want to show that $A$ itself is open. If I can do this, I believe the proof will be complete. One way I've thought about doing this is to choose a neigborhood of some point $a \in A$ and if it is not already disjoint from $B$, shrink it until it is. This would then demonstrate that $A$ is open.

Am I on the right track here?

-
Pick a point $x$. Show that the set of points $y$ such that $f(x) = f(y)$ is open (it is obviously closed). – Qiaochu Yuan Jun 11 '11 at 22:19
It is obviously closed if the codomain of $f$ is Hausdorff :) – Mariano Suárez-Alvarez Jun 11 '11 at 22:22
Since you need another open set, consider the closure of $V_x$. By continuity what is the value of f on this set? – hardmath Jun 11 '11 at 22:52
@hardmath, the condition of the problem doesn't include continuity, so you'd have to prove that a locally constant function is continuous. – Thomas Andrews Jun 11 '11 at 23:29
@Thomas Andrews: Point taken! That I can do... :) – hardmath Jun 12 '11 at 1:19

Let $\mathcal{S}$ be the set of open sets in the domain such that $f$ is constant on the open set.

Since $f$ is locally constant, we know that every $x\in \mathrm{dom}\, f$ is a member of some $S\in \mathcal{S}$.

Now, pick $x_0$, and define two sets: $U = \{x: f(x)=f(x_0)\}$ and $V=\{x: f(x)\neq f(x_0)\}$.

We can see that $U$ and $V$ are disjoint, and $U \cup V = \operatorname{dom} f$.

But each of $U$ and $V$ is just a union of open sets, namely sets in $\mathcal{S}$.

So $U$ and $V$ are both open.

-
Also, note that the notion of a "locally constant function" only depends on the topology of the domain. In fact, we don't need to know that $f$ is continuous. – Thomas Andrews Jun 11 '11 at 23:22
Thanks, but I don't see how this fits into the argument I'm making above. With the way I've got everything set up is it possible to show that $A$ is open? – ItsNotObvious Jun 11 '11 at 23:34
@3Sphere. My argument just shows that $A=U\setminus V_x$ is open and $V_x$ is open. So $A$ must be empty since $U$ is connected, and therefore $f$ must be constant. You don't need $y.$ – Thomas Andrews Jun 11 '11 at 23:39

A variation and expansion of some of the ideas here:

In my first course on topology we were taught a following useful "chain-characterisation" of connectedness. Some definitions first: if $\mathcal{U}$ is a cover of a space $X$, then a chain in $\mathcal{U}$ is a finite indexed set $U_1,\ldots U_n \in \mathcal{U}$ such that for all $i=1,\ldots n-1$ we have that $U_i \cap U_{i+1} \neq \emptyset$, and it is called a chain from $x$ to $y$ in $\mathcal{U}$ (both points from $X$) when we additonally have $x \in U_1$ and $y \in U_n$.

Now, a space $X$ is connected iff for every open cover $\mathcal{U}$ of $X$ we have a chain between any pair of points of $X$.

The chain-condition implies connectedness, because if $X$ is non-connected, we have decomposition of $X$ into 2 non-empty disjoint open sets $U$ and $V$, and then for $x \in U$ and $y \in V$ there can be no chain from $x$ to $y$ in the cover $\mathcal{U} = \{U, V\}$.

The other way around is a variant of the proofs in other replies: let $\mathcal{U}$ be any open cover of $X$ and fix $x \in X$. Then define $O$ to be the set of all $y \in X$ such that there is a chain from $x$ to $y$ from $\mathcal{U}$.

$O$ is non-empty, as any $x$ in $X$ is covered by some $U \in \mathcal{U}$ and then $U_1 = U$ is a chain from $x$ to $x$, so $x$ is in $O$.

$O$ is open: let $y$ be in $O$ and let $x \in U_1,\ldots U_n$ be a witnessing chain (from $\mathcal{U}$) for it. Then for every $z$ in $U_n$, that same chain will witness that $z$ is in $O$ as well, and so $U_n \subset O$, and every point of $O$ is an interior point. Note that we do not even need the cover to be open, just that the interiors cover $X$.

$O$ is closed: suppose that $y$ is not in $O$, and let $U$ be an element from $\mathcal{U}$ that covers $y$. Suppose that some $z$ in $U$ is in $O$, and again let $x \in U_1,\ldots U_n$ be a witnessing chain for it, so with $z \in U_n$. But then the chain $x \in U_1,\ldots U_n,U_{n+1} = U$ is a chain from $\mathcal{U}$ as well, because all intersections are non-empty in the beginning by assumption, and $U_n \cap U_{n+1}$ is non-empty, as both contain $z$, and this would witness that we have a chain from $\mathcal{U}$ from $x$ to $y$. But then $y$ would be in $O$, contrary to what we assumed. So $U$ misses $O$ entirely so $O$ is closed.

But now the connectedness of $X$ forces $O = X$ (there is only one non-empty clopen set) and then we have what we wanted in the chain condition, as $x$ was arbitrary.

Having this at our disposal we are almost done: let $f$ be locally constant and for every $x$ pick a neighbourhood $U_x$ such that $f$ is constant on $U_x$. We of course consider the cover $\mathcal{U} = \{U_x : x \in X \}$, and fix $x$ in $X$. If $y$ is another point in $X$ then we have a chain from $\mathcal{U}$ from $x$ to $y$ but when 2 sets from $\mathcal{U}$ intersect, it means $f$ is constant on their union. It follows that $f(x) = f(y)$ as required.

Other applications: in a locally compact (in the sense of every point has a compact neighbourhood) connected space for every $2$ points there is a compact subset of $X$ that contains them both. Or a locally path-connected and connected space is path-connected (use path-connected open neighbourhoods, get a chain from $x$ to $y$, a glue together paths from $x$ to a point in the intersection of $U_1 \cap U_2$, a point in $U_2 \cap U_3$ etc to $y$.) and so on. It allows for all sort of local properties to get expanded more globally for connected spaces.

-

For each point $x \in X$, pick an open neighbourhood $U_x$ such that $f$ is constant on $U_x$. Obviously, $X = \bigcup_{x\in X} U_x$ and $U_x \neq \emptyset$ for all $x$. Now, for $x \neq y$, two things can happen:

1. $U_x \cap U_y \neq \emptyset$ and then $U_x = U_y$, or
2. $U_x \cap U_y = \emptyset$.

If there exist two points for which the second is true, then $X$ would not be connected. So we are in the first case for all pairs of points in $X$ and there is just one $U_x$. Hence, $f$ is constant.

-
I don't follow. Do you mean pick a maximal open neighborhood $U_x$ such that $f$ is constant on $U_x$, or something like that? – Qiaochu Yuan Jun 11 '11 at 23:28
@Qiaochu. Why maximal? – a.r. Jun 11 '11 at 23:29
Otherwise the second case is not a contradiction...? – Qiaochu Yuan Jun 11 '11 at 23:31
Thanks, but how does this fit into the argument I'm making above? – ItsNotObvious Jun 11 '11 at 23:32
@Quiaochu. I think it's still a contradiction -even if I haven't explained it quite right. Let's see: in the second case, take the union of all open sets $U_x$ which are different from $U_y$. Call it $U$. Then, $X = U \cup U_y$ and $X$ wouldn't be connected. Is it better now? – a.r. Jun 11 '11 at 23:41

The fastest proof is probably the one already mentioned: pick $x$ and show that $f^{-1}(f(x))$ is clopen. Another way, which looks like Agustí's approach, is the following.

Let $f:X\to Y$ be locally constant. Define the following relation on $X$:

$x\sim y:\Leftrightarrow (f\text{ is constant on some open }U\supseteq\{x,y\}).$

It is reflexive because $f$ is locally constant. It is trivially symmetric. It is transitive because if $f$ is constant on $U$ and $V$ with $U\cap V\neq\emptyset$ then $f$ is constant on $U\cup V$. Thus $\sim$ is an equivalence relation, and we get a partition $P=\{[x_i]\ |\ i\in I\}$ of X. There is a nice description of the equivalence classes, namely

$[x]=\bigcup \{U\text{ open }\ |\ x\in U,|f(U)|=1\}$

i.e. it is the biggest open set containing $x$ on which $f$ is constant. Thus

$X=\bigcup_{i\in I}[x_i]$

is the disjoint union of non-empty opens. If $X$ is connected, then we must have $|I|=1$, i.e. $f$ is constant on $X$.

-

Are we don't need the hypothesis $f$ is continuous? Since if we pick $z\in X$ then $A = \{x\in X: f(x) = f(z)\}$ is open, to see this, let $y\in A$, then by $f$ is locally constant, exist open set $B_y$ containing $y$ such that $f(B_y) =\{f(y)\} =\{f(z)\}$ so $B_y \subset A$. Otherwise, $X\backslash A = \{x\in X: f(x)\neq f(z)\}$ is also open, let $w\in X\backslash A$, then exist open set $B_w$ containing $w$ such that $f(B_w) = \{f(w)\}$, so $B_w \subset X\backslash A$.\ Hence $X = A\cup (X\backslash A)$ where $A$ and $X\backslash A$ are open, by connectedness we have $X = A$ since $A\neq \emptyset$

-