# general topology - Prove that if $C$ is a connected subset of $(X,\tau)$ and $B\subseteq X$ such that $C\subseteq B\subseteq \overline{C}$ then $B$ is connected.

Let $C$ be a connected subset of a topological space $(X,\tau)$ and $B\subseteq X$ such that $C\subseteq B\subseteq \overline{C}$. Now it is required to prove that $B$ is connected. The following is my attempt.

Suppose $f:B\to \{0,1\}$ is continuous where $\{0,1\}$ is endowed with its discrete topology. Now since $C\subseteq B$ and $f$ is continuous we have $f(\overline{C})\subseteq\overline{f(C)}$, whence $f(C)\subseteq f(B)\subseteq f(\overline{C})\subseteq \overline{f(C)}$. But $f(C)$ is either $\{0\}$ or $\{1\}$ as $C$ is connected, and $f(C)$ is closed. Thus $f(C)=\overline{f(C)}$. Therefore $f(B)=f(C)$. Thus $f$ is constant. Hence $B$ is connected.

Is the above argument alright? Thanks.

With functions another way: by definition $C$ is dense in $\overline{C}$, so $C$ is dense in $B$ as well and $\{0,1\}$ is Hausdorff, and if $f: B \to \{0,1\}$ is continuous, $f|C$ is constant with value $c \in \{0,1\}$. But then $1_c$ and $f$ coincide on the dense set $C$ of $B$, so also on $B$ and $f$ is constant with the same value. Done: $B$ is connected.