Prove that $X$ is Hausdorff if and only if the diagonal $\Delta$ is closed in $X\times X$.
This exercise appeared on a previous exam in my course, and also in Munkres. Here's my attempt:
First I want to show the implication starting with assuming that $X$ is Hausdorff. Consider $(X\times X)\backslash \Delta$, then for any tuple $(x_1, x_2) \in (X\times X)\backslash \Delta$ we know $x_1\neq x_2$. Then there are neighbourhoods $U,V$ of $x_1,x_2$ respectively such that $U\cap V = \emptyset$. The set $U\times V$ is a basis element of $X\times X$ so it's in the product topology. So any tuple $(x_1, x_2) \in (X\times X)\backslash \Delta$ lies in an open set of $X\times X$, thus $(X\times X) \backslash\Delta$ is open which makes $\Delta$ closed in $X\times X$.
Now I assume that $\Delta$ is closed in $X\times X$. Then $(X\times X)\backslash\Delta$ is open in $X\times X$. Unless I'm mistaken, every open set $A\times B$ in $X\times X$ will be a subset of $(X\times X)\backslash\Delta$. Then $A\cap B = \emptyset$ because otherwise we would have $(x_1,x_1)\in A\times B \subseteq (X\times X)\backslash\Delta$ for some $x_1\in X$, which is a contradiction. Thus $X$ is Hausdorff.
I'm simply wondering if my argument is correct.