Proof Verification for Connectedness of a Set in a Metric Space While I was reading metric spaces, I came across a theorem statement which had no proof in the book I was reading. Therefore, I tried to construct the proof myself. Given below is the theorem statement as well as the proof that I tried to construct.
Theorem: Let $\left( M, d \right)$ be a metric space and let $X \subseteq M$. If $\phi$ and $X$ are the only sets which are both open and closed in $X$, then $X$ is connected.
Proof:-
Let, if possible, $X$ be disconnected.
Hence, $\exists A, B \subseteq X$ such that $X = A \cup B$ where $A$ and $B$ are separated and $A \neq \phi$, $B \neq \phi$, $A \neq X$, $B \neq X$.
Now, since $X$ is closed, we have $X = \tilde{X}$, where $\tilde{X}$ is the closure of $X$.
Therefore, we have $A \cup B = \tilde{A \cup B} = \tilde{A} \cup \tilde{B}$
i.e. $\forall x \in A \cup B$, $x \in \tilde{A} \cup \tilde{B}$
$\therefore x \in A$ or $x \in B$ $\Longrightarrow$ $x \in \tilde{A}$ or $x \in \tilde{B}$
$\because A$ and $B$ are separated, $A \cap \tilde{B} = \phi$ and $\tilde{A} \cap B = \phi$
Therefore, If $x \in A$, then $x \in \tilde{A}$
and if $x \in B$, then $x \in \tilde{B}$
Thus, $A \subseteq \tilde{A}$ and $B \subseteq \tilde{B}$
Also, we have
$\forall x \in \tilde{A} \cup \tilde{B}$, $x \in A \cup B$
i.e. $x \in \tilde{A}$ or $x \in \tilde{B}$ $\Longrightarrow$ $x \in A$ or $x \in B$
Again, since $A$ and $B$ are separated, $A \cap \tilde{B} = \phi$ and $\tilde{A} \cap B = \phi$
Hence, $x \in \tilde{A} \Longrightarrow x \in A$ and $x \in \tilde{B} \Longrightarrow x \in B$
Therefore, $\tilde{A} \subseteq A$ and $\tilde{B} \subseteq B$
Thus, we have proved that $A = \tilde{A}$ and $B = \tilde{B}$ which implies that $A$ and $B$ are closed in $X$.
Now, since $X$ is open, we have
$\forall x \in X$, $\exists r > 0$ such that $B \left( x, r \right) \subset X$
i.e. $\forall x \in A \cup B$, $\exists r > 0$ such that $B \left( x, r \right) \subset A \cup B$
i.e. $\forall y \in B \left( x, r \right)$, $y \in A$ or $y \in B$
Hence, $B \left( x, r \right) \subset A$ or $B \left( x, r \right) \subset B$
Now, combining the possibilities from the above two statements, we have
If $x \in A$ and $B \left( x, r \right) \subset A$, then A is open.
If $x \in B$ and $B \left( x, r \right) \subset B$, then B is open.
If $x \in A$ and $B \left( x, r \right) \subset B$, then we have a contradiction to the fact that $A$ and $B$ are separated and hence disjoint. Therefore, this cannot be true.
If $x \in B$ and $B \left( x, r \right) \subset A$, then we have a contradiction to the fact that $A$ and $B$ are separated and hence disjoint. Therefore, this cannot be true.
Therefore we have $A$ and $B$ are open in $X$.
Thus, we have proved that there are two more sets $A$ and $B$ neither of them 
equal to $X$ or $\phi$ which are both open and closed in $X$. This is again a contradiction to the hypothesis and therefore, not possible.
Hence, X must be connected.
I would like to know if this proof is correct or does it need any changes?

With the standard definition of connectedness the theorem hardly requires a proof. Here is the proof which uses your definition of connectedness:  I start with $X=A \cup B$ with A and B separated. The fact that A and B are separated implies they are disjoint. Since their union is X it follows they are complements of each other. Hence $\tilde {A}$ is contained in the complement of B which is A. This means A is closed. Similarly B is closed. Being each other's complements they are both open and closed which is a contradiction. 
