I am learning about metric spaces and I find it very confusing. Is this a valid proof that a singleton must be closed?

If $(X,d)$ is a metric space, to show that $\{a\}$ is closed, let's show that $X \setminus \{a\}$ is open. Choose $y \in X \setminus \{a\}$ and set $\epsilon = d(a,y)$. Then since $a \not \in B(y,\epsilon)$, we have that $B(y,\epsilon) \subset X \setminus \{a\}$ so that $X \setminus \{a\}$ is open.


Your proof is okay. More generally, we can define any topological space to be $T_1$ if its singleton sets are closed (or equivalently, for any points $x \neq y$, there is an open set containing $x$ and not containing $y$). $T_1$ is an example of a separation axiom. You've shown that metric spaces are $T_1$, but much stronger separation axioms hold for metric spaces.

Credit to Squirtle for providing similar details in a comment.