# $X$ is Hausdorff iff the diagonal is a closed subset of $X^2$ [duplicate]

Let $(X,\tau)$ be a topological space. Consider $X^2$ with the product topology. Show that $X$ is Hausdorff iff the diagonal $D = \{(x,y) \in X^2 \mid x=y\}$ is a closed subset of $X^2$.

## marked as duplicate by Najib Idrissi, J.-E. Pin, John B, Dan Rust, Harish Chandra RajpootMar 2 '16 at 12:09

Hint: Convince yourself that for $x \neq y$, finding distinct open neighborhoods $U_x$ and $U_y$ is the same as finding an open neighborhood of $(x,y) \in X \times X$, which does net meet the diagonal.