Two-Valued Function Crit. for the Disconnectedness of a Metric Space

# Two-Valued Function Criterion for the Disconnectedness of a Metric Space

Recall from the Connected and Disconnected Metric Spaces page that a metric space $(M, d)$ is said to be disconnected if there exists nonempty open sets $A$ and $B$ such that $A \cap B = \emptyset$ ($A$ and $B$ are disjoint) and also:

(1)\begin{align} \quad M = A \cup B \end{align}

Furthermore, we said that a metric space $(M, d)$ that is not disconnected is connected.

If $S \subseteq M$ then $S$ is said to be connected/disconnected if the metric subspace $(S, d)$ is connected/disconnected.

We will now look at a nice theorem which gives us criterion for which a metric space is disconnected or not.

Theorem 1: Let $(M, d)$ be a metric space. Then $(M, d)$ is disconnected if and only if there exists a continuous real-valued function $f : M \to \mathbb{R}$ such that $f(M) = \{ 0, 1 \}$. |

*Any two-element subset of real numbers $\{ a, b \}$ can replace $\{ 0, 1 \}$ in Theorem 1.*

**Proof:**$\Rightarrow$ Suppose that $(M, d)$ is disconnected. Then there exists nonempty open sets $A$ and $B$ such that $A \cap B = \emptyset$ and $M = A \cup B$.

- Define a function $f : M \to \mathbb{R}$ for all $x \in M$ by:

\begin{align} \quad f(x) = \left\{\begin{matrix} 0 & \mathrm{if} \: x \in A \\ 1 & \mathrm{if} \: x \in B \end{matrix}\right. \end{align}

- We claim that $f$ is continuous. To show this, let $U$ be an open set in $\mathbb{R}$. There are four cases to consider. First suppose that $0, 1 \in U$. Then $f^{-1}(U) = A \cup B = M$ which is open in $(M, d)$. Secondly, suppose that $0, 1 \not \in U$. Then $f^{-1}(U) = \emptyset$ which is open in $(M, d)$. Thirdly, suppose that $0 \in U$ and $1 \not \in U$. Then $f^{-1}(U) = A$ which we defined to be open in $(M, d)$. Lastly, if $0 \not \in U$ and $1 \in U$ then $f^{-1}(U) = B$ which we defined to be open in $(M, d)$. Therefore $f$ is continuous.

- $\Leftarrow$ Now suppose that there exists a continuous real-valued function $f : M \to \mathbb{R}$ such that $f(M) = \{ 0, 1 \}$. Take any open sets $U, V \in \mathbb{R}$ such that $0 \in U$, $1 \not \in U$ and $0 \not \in V$, $1 \in V$. Then $f^{-1}(U) = f^{-1}(\{ 0 \})$ and $f^{-1}(V) = f^{-1}(\{ 1 \})$ are open in $(M, d)$. Let:

\begin{align} \quad A = f^{-1}(U) = f^{-1}(\{ 0 \}) \quad \mathrm{and} \quad B = f^{-1}(V) = f^{-1}(\{ 1 \}) \end{align}

- Clearly $A$ and $B$ are nonempty since $f(m) = \{0, 1\}$ (The range of $M$), and so the inverse images of $\{ 0 \}$ and $\{ 1 \}$ contain points. Furthermore, these sets are open by the continuity of $f$. We claim that $A \cap B = \emptyset$. Suppose not, i.e., suppose that there exists an $x \in A \cap B$. Then $x \in A = f^{-1}(U) = f^{-1} (\{ 0 \})$ and $x \in B = f^{-1}(V) = f^{-1} (\{ 1 \})$ so $f(x) \in \{ 0 \}$ and $f(x) \in \{ 1 \}$ which implies that $f(x) = 0, 1$ which contradicts $f$ being a function as a function cannot output two different values!

- Lastly, since $f(M) = \{ 0, 1 \}$ we see that:

\begin{align} \quad M = f^{-1}(\{0, 1\}) = f^{-1}(\{ 0 \} \cup f^{-1} ( \{ 1 \}) = A \cup B \end{align}

- Hence $(M, d)$ is a disconnected metric space. $\blacksquare$