TITLE: Show that a $T_1$-space $X$ is totally disconnected when $f:A\to \{a,b\}$ has a continuous extension
QUESTION [0 upvotes]: Question: Let $X$ be a $T_1$-space with the following property: For each closed subset $A$ of $X$ and continuous function $f:A\to \{a,b\}$ from $A$ into a discrete two-point space $\{a,b\}$, $f$ has a continuous extension $F:X\to \{a,b\}$. Prove that $X$ is totally disconnected.$^1$

My attempt: Suppose to the contrary that $X$ is not totally disconnected, then there exists a component $C$ containing more than one element of $X$. Since $C$ is connected, there is no continuous and onto function from $C$ to $\{a,b\}$. Thus, if $f:C\to\{a,b\}$ is continuous, then $f$ must be constant. Without loss of generality, assume that $f(C)=a$. By the hypothesis, $f$ has a continuous extension $F:X\to\{a,b\}$.
I think that I didn't used the condition that $C$ has more than one elements of $C$ yet, so if I use this appropriately, then the question will be solved. However, I have no idea if I chose the right way. How can I complete the proof? Or Should do I give up find the other way?

$^1$ Fred H. Croom (2002). Principles of Topology. p.253 (url)

REPLY [1 votes]: Ww want to show all connected subsets of $X$ are one-point sets.
So suppose some connected subset $C$ of $X$ has 2 points, say $x \neq y$. Then $A = \{x,y\}$ is closed (and discrete) as $X$ is $T_1$ (which is equivalent to all finite sets being closed). So $f:A \rightarrow \{a,b\}$ defined by $f(x) =a, f(y) = b$ is continuous (even a homeomorphism) and so by assumption has a continuous extension $G: X \rightarrow \{a,b\}$.
But then $O = F^{-1}[\{a\}]$ is clopen (open and closed), as the inverse of $\{a\}$ which is open and closed in $\{a,b\}$, and so is $O' = F^{-1}[\{b\}]$.
But then $C = (C\cap O) \cup (C \cap O')$ is a disconnection of $C$, and so $C$ cannot be a connected set, as both are non-empty (as witnessed by $x$ and $y$ resp.) This shows that $X$ does not have any non-trivial connected subsets.
{"set_name": "stack_exchange", "score": 0, "question_id": 2214324}