[proofplan]
The key point is that the [discrete metric](/page/Discrete%20Metric) makes every singleton $\{x\}$ open. Therefore a [dense subset](/page/Dense%20Subset) of a discrete [metric space](/page/Metric%20Space) cannot omit any point: if it omitted $x$, then the open neighbourhood $\{x\}$ would miss the dense set. One direction is immediate by taking the whole [countable set](/page/Countable%20Set) as the dense subset; the other direction forces any countable dense subset to equal $X$.
[/proofplan]
[step:Show that every singleton is open in the discrete metric]
For each $x\in X$, define the open $d$-ball of radius $1/2$ around $x$ by
\begin{align*}
B_d(x,1/2)=\{y\in X:d(x,y)<1/2\}.
\end{align*}
We claim that $B_d(x,1/2)=\{x\}$. Since $d(x,x)=0<1/2$, we have $x\in B_d(x,1/2)$. Conversely, if $y\in B_d(x,1/2)$ and $y\neq x$, then the definition of the discrete metric gives $d(x,y)=1$, contradicting $d(x,y)<1/2$. Hence $y=x$, and so $B_d(x,1/2)=\{x\}$.
Because every open ball is open in the metric topology induced by $d$, it follows that $\{x\}$ is open for every $x\in X$.
[/step]
[step:Use countability of $X$ to build a countable dense subset]
Assume that $X$ is countable. Let $D:=X$. Then $D$ is countable by assumption. Since $D=X$, every nonempty open subset of $X$ intersects $D$. Therefore $D$ is a countable dense subset of $(X,d)$, so $(X,d)$ is separable.
[/step]
[step:Force a dense subset to contain every point]
Assume that $(X,d)$ is separable. By definition of separability, there exists a countable subset $D\subset X$ such that $D$ is dense in $(X,d)$. Density means that every nonempty open subset of $X$ intersects $D$.
Let $x\in X$. By the first step, $\{x\}$ is an open subset of $X$. It is nonempty because it contains $x$. Since $D$ is dense, we must have
\begin{align*}
\{x\}\cap D\neq \varnothing.
\end{align*}
Thus $x\in D$. Since $x\in X$ was arbitrary, $X\subset D$. The reverse inclusion $D\subset X$ holds by construction, so $D=X$.
[guided]
We now prove the direction in which separability implies countability. Since $(X,d)$ is separable, there is a subset $D\subset X$ such that $D$ is countable and dense in the metric topology induced by $d$. The density condition says that every nonempty [open set](/page/Open%20Set) in this topology must meet $D$.
Fix an arbitrary point $x\in X$. From the previous step, the singleton $\{x\}$ is open in the metric topology induced by the discrete metric. This is the exact place where discreteness is used: the ball $B_d(x,1/2)$ contains $x$ and no point other than $x$, so it equals $\{x\}$.
Because $\{x\}$ is nonempty and open, density of $D$ gives
\begin{align*}
\{x\}\cap D\neq \varnothing.
\end{align*}
The only element of $\{x\}$ is $x$, so the nonempty intersection condition forces $x\in D$. Since $x$ was arbitrary, every point of $X$ belongs to $D$, which gives $X\subset D$. Since $D$ was chosen as a subset of $X$, we also have $D\subset X$. Therefore $D=X$.
[/guided]
[/step]
[step:Conclude that separability is equivalent to countability]
In the separable case, the previous step gives $X=D$, and $D$ is countable by the definition of separability. Hence $X$ is countable.
Combining this with the converse direction already proved, $(X,d)$ is separable if and only if $X$ is countable.
[/step]