In metric space, $X$ is connected and $X\subset Y \subset \bar X$, prove that $Y$ is connected.

Question: $X$ is connected and $X\subset Y\subset\bar X$, prove that $Y$ is connected.

This is one of my midterm questions this morning. I couldn't figure it out. But now I came up with this proof, so if anyone could check and see if it makes sense, I would really appreciate it (although that's not gonna change my grade).

Proof: For the purpose of arguing by contradiction, we assume that $Y$ is disconnected. Then we have nonempty, open sets $U,V$ such that $U \cup V=Y$ and $U \cap V=\emptyset$.

Since $X \subset Y$, then it's obvious that we either have $X \subset U$, or $X \subset V$. Without losing generality, we assume that $X\subset U$. Then $\bar X \subset \bar U$, then $Y \subset \bar U$, then $V \subset \bar U$.

Consider some $v \in V$. There exits some $\epsilon$ such that $B_\epsilon (x)\subset V$. At the same time, since $x\in V \subset \bar U$, $B_\epsilon(x) \cap U \neq \emptyset$. This is a contradiction since $U \cap V =\emptyset$. So $Y$ is connected.

• You seem to assume that the space is a metric space? – Asaf Karagila Oct 31 '14 at 21:59
• @AsafKaragila Oh yes. – 3x89g2 Oct 31 '14 at 22:00

We assume that $Y$ is disconnected. Then we have open sets U, V with $Y \subseteq U \cup V$, $U \cap V = \emptyset$, $Y \cap U \neq \emptyset \neq Y \cap V$. On the other hand, since $X \subseteq Y$ and X is connected, we can assume wlog that $X \subseteq U$. Now, since $Y \cap V \neq \emptyset$, there is a $z \in Y \cap V$. Since $Y \subseteq \bar X$, we have $z \in \bar X$. On the other hand, from $X \subseteq U$ and $z \in V$ and $U \cap V = \emptyset$, we get that $V$ is an open neighborhood of $z$ which doesn't contain any points of $X$. This means $z \notin \bar X$. Contradiction. So $Y$ must be connected.
The best proof i know is by using this equivalent characterization of a connected space: a space $X$ is connected if and only if every continuous function $X \rightarrow \{0,1\}$ is constant. If $X\subset Y\subset \overline{X}$ and if $Y \rightarrow \{0,1\}$ is continuous, then it restriction to $X$ is constant, and since $X$ is dense in $Y$, it follows that the function is constant, so $Y$ is connected.
• Why $X$ is dense in $Y$ ? – Empty Jan 28 at 16:24