Show that the topological space $Y$ is Hausdorff iff the diagonal $D = \{(y_1,y_2)\in Y\times Y: y_1=y_2\}$ is a closed subset of $Y\times Y$.
My attempt: First, suppose $Y$ is Hausdorff. Then $Y\times Y$ is Hausdorff, so for any $y\in Y\times Y - D$ and $y'\in D$, I can find open sets $U_y$ and $U_y'$ such that $U_y\cap U_y' = \varnothing$. This means that $y\in U_y\subseteq Y\times Y -D$, so $Y\times Y -D$ is open, which implies that $D$ is closed.
Does anyone see anything wrong with my argument?
For the converse, I'm a little stuck. My hunch is that since $D$ is closed, $Y\times Y-D$ is open, and I want to use this somehow to show that $Y\times Y$ is Hausdorff. Then we can conclude that $Y$ is Hausdorff. Any advice?