[proofplan]
We use the separation definition of connectedness. First, if $X$ has no points or exactly one point, then it cannot be written as a union of two nonempty disjoint open subsets, so it is connected. Conversely, if $X$ contains two distinct points, then the [discrete metric](/page/Discrete%20Metric) makes every singleton open, and hence $\{x\}$ and $X\setminus\{x\}$ form a separation.
[/proofplan]
[step:Show that a set with at most one point has no separation]
Assume that $X$ has at most one point. Suppose, for contradiction, that $X$ is disconnected. Then there exist subsets $U\subset X$ and $V\subset X$ such that $U$ and $V$ are open in the metric topology on $X$, both $U$ and $V$ are nonempty, $U\cap V=\varnothing$, and $X=U\cup V$.
Choose $u\in U$ and $v\in V$. Since $U\cap V=\varnothing$, we have $u\neq v$. Thus $X$ contains at least two distinct points, contradicting the assumption that $X$ has at most one point. Therefore no such separation exists, and $X$ is connected.
[guided]
We prove connectedness directly from the separation definition. A [topological space](/page/Topological%20Space) is disconnected exactly when it can be written as the union of two open sets that are both nonempty and disjoint.
Assume that $X$ has at most one point. If a separation existed, then there would be subsets $U\subset X$ and $V\subset X$ such that $U$ and $V$ are open in the metric topology on $X$, both are nonempty, they are disjoint, and their union is all of $X$.
Because $U$ is nonempty, we may choose a point $u\in U$. Because $V$ is nonempty, we may choose a point $v\in V$. Since $U\cap V=\varnothing$, no point can lie in both sets, so $u\neq v$. This produces two distinct points of $X$, contradicting the hypothesis that $X$ has at most one point.
Hence no separation of $X$ exists. This also covers the empty set: there are no two nonempty subsets whose union is the empty set. Therefore $X$ is connected.
[/guided]
[/step]
[step:Separate a discrete metric space with at least two points]
Assume that $X$ contains at least two distinct points. Choose distinct points $x,y\in X$. Define subsets $U\subset X$ and $V\subset X$ by $U:=\{x\}$ and $V:=X\setminus\{x\}$.
Since $d$ is the discrete metric, the open ball $B(x,1/2)$ in $(X,d)$ is exactly $\{x\}$. Hence $U$ is open in the metric topology. For each $z\in V$, the open ball $B(z,1/2)$ is exactly $\{z\}$ and is contained in $V$, because $z\neq x$. Therefore $V$ is open in the metric topology.
The sets $U$ and $V$ are disjoint by definition, and $U\cup V=X$. They are both nonempty: $x\in U$, and $y\in V$ because $y\neq x$. Thus $U$ and $V$ form a separation of $X$, so $X$ is disconnected.
[/step]
[step:Combine the two directions]
The first step shows that if $X$ has at most one point, then $X$ is connected. The second step shows that if $X$ has at least two points, then $X$ is disconnected. Therefore $X$ is connected if and only if $X$ has at most one point.
[/step]