TITLE: Prove if metric space $X$ contains a connected dense subset, then $X$ is connected.
QUESTION [6 upvotes]: I am attempting to solve the following question.

Q. Suppose a metric space $X$ contains a connected dense subset $A$. Show that $X$ is connected.

Here is my attempt at a solution:

A. Assume to the contrary that $X$ is not connected, that is, let $X=U \cup V$ where $U$ and $V$ are two disjoint, non-empty, open sets.  Since $A$ is dense, we have that $cl(A)=U \cup V$ and since $X$ is a metric space, then $A \subseteq U \cup V$...

This is where I get stuck. I'd like to show that $A$ is not dense, but I'm not really sure where to go from here.  Any help would be appreciated!

REPLY [2 votes]: Generally, you can show that if $A$ is connected, so is $\overline A$. 
Indeed, $A$ is connected iff every continuous function $\eta:A\to 2$ is constant. Now, consider a continuous function $\eta:\overline A\to 2$. Since the codomain is Hausdorff, $f$ is determined by any dense subset of $\overline A$. Since $\eta\mid A$ is constant, thus so is $\eta$. Hence $\overline A$ is connected.