Prove that a topological space $(X, \tau)$ is $T_2$ if and only if the diagonal $D=\{(x,x):x \in X\}$ is closed subset of the product space $X\times X$
=> assume that $(X, \tau)$ is $T_2$, I know that $\forall x,y \in X$, there exists $U,V \subset X$ are open and disjoint sets such that $x\in U$ and $y \in V$. I think that $U \times U= \{(x,x):x\in U\}$ but I'm not sure this is correct, I don't know how to continue from here
for the converse, I can't see how the hypothesis help me prove $(X, \tau)$ is $T_2$