Help finishing a proof about compact/connected sets.

Original Question: Suppose that $X$ and $Y$ are metric spaces and that $f:X \rightarrow Y$. If $X$ is compact and connected, and if to every $x\in X$ there corresponds an open ball $B_{x}$ such that $x\in B_{x}$ and $f(y)=f(x)$ for all $y\in B_{x}$, prove that f is constant on $X$.

Here's my attempt: Cover X by $\bigcup _{x \in X}B_x$. Since X is compact there is a finite sub-covering $\bigcup _{n=1}^NB_x$ of $X$. Given $x\in X$ there is an i between 1 and N such that $x\in B_{x_{i}}$. By assumption $f(x)=f(x_{i})$. Since there are only finitely many balls covering $X$, $f(X)$ is finite, say $f(X)=\{a_{1},...a_{m}\}$.

Where do I go from here, I want to show that f(X) is a singleton. Is $X$ a singleton too?

-
math.stackexchange.com/questions/44850/… –  user26770 Apr 4 '12 at 20:57

You’ve not yet used the fact that $X$ is connected, and that’s essential. Otherwise, $X$ and $Y$ could both be the two-point discrete space, and $f$ could be the identity map; all of the hypotheses except connectedness of $X$ would be satisfied, but $f$ wouldn’t be constant.

Let’s go back to your finite cover $\{B_{x_1},B_{x_2},\dots,B_{x_N}\}$ of $X$, where $f$ is constant on each of the open balls $B_{x_k}$. Let $F=\{f(x_k):k=1,\dots,N\}$; $F$ is a finite subset of the metric space $Y$. In fact, $F$ is a discrete metric space with the metric inherited from $Y$, so you really have a continuous function $f:X\to F$. You also know that $X$ is connected. You probably know that compactness is preserved by continuous functions; what about connectedness? And what finite metric spaces are connected?

I’ve added a full proof of a more general result, but since I didn’t want to give the full solution to the homework problem right away, I’ve spoiler-protected it; mouseover to see it.

Added: It’s worth noting that the conclusion follows from much weaker assumptions: $X$ need not be compact, and $f$ need not be continuous. Let $\mathscr{U}$ be the collection of open subsets of $X$ on which $f$ is constant, so that in particular $B_x\in\mathscr{U}$ for all $x\in X$. Fix $x_0\in X$, let $y=f(x_0)$, and let $$U_0=\bigcup\Big\{U\in\mathscr{U}:\forall x\in U\big[f(x)=y\big]\Big\}\;.$$ If $U_0=X$, we’re done: $f$ is constant on $X$ with value $y$. If not, let $$U_1=\bigcup\Big\{U\in\mathscr{U}:\exists x\in U\big[f(x)\ne y\big]\Big\}\;.$$ Then $f(x)=y$ for every $x\in U_0$, and $f(x)\ne y$ for every $x\in U_1$, so $U_0\cap U_1=\varnothing$. On the other hand, it’s clear that $U_0\cup U_1=X$, and $U_0$ and $U_1$, being unions of open sets, are certainly open, so $\{U_0,U_1\}$ is a disconnection of $X$. This contradicts the connectedness of $X$ and shows that in fact we must have $U_0=X$ and hence $f$ constant on $X$.

-

Notice that since $f(X)$ is a finite set and $Y$ is Hausdorff you can cover each $a_i$ with an open ball disjoint from all others. For example: let $B_i = B_{a_i}(\epsilon_i)$ where $\epsilon_i$ is $1/4$ the minimal distance between $a_i$ and the rest of the $a$'s (this exists because you have a finite set). Then you're pretty much done. Just note:

• $f^{-1}(B_i)$ is open because $B_i$ is open and $f$ is continuous.
• $f^{-1}(\{a_i\})$ is closed because $\{a_i\}$ is closed and $f$ is continuous.
• $f^{-1}(\{a_i\})=f^{-1}(B_i)$ since the only element of the range contained in $B_i$ is $a_i$.

Therefore, each $C_i=f^{-1}(\{a_i\})=f^{-1}(B_i)$ is open and closed. But for $i\not=j$, $C_i$ and $C_j$ are disjoint and they're union is all of $X$. So if there is more than one of them $X$ is not connected!

-
Looks like the OP is doing this in metric spaces, he may not know what a Hausdorff space is. –  user38268 Apr 4 '12 at 22:21

Since $f(X)=\{a_1,a_2,\ldots,a_n\}$ we can take $A_k=\bigcup\{B_x\mid f(x)=a_k\}$ to be an open set in $X$ for every $k\leq n$.

These are disjoint open sets and their union is $X$. Use the fact the space is connected to deduce $k=1$.

-

If you assume that U_0 is not equal to X initially, then the boundary points of U_0 must be in X, which implies by hypothesis that U_0 is closed, which is a contradiction unless U_0 equals X. Does this argument tacitly rely on the connectedness of X?

-