I'm attempting a topology proof and think my proof is correct but I'm not 100% sure. The problem is as follows: Define $\Delta_X=\{(x,x)\in X\}$. Prove that $X$ is Hausdorff if and only if $\Delta_X$ is a closed set. The reverse proof is fine but for my proof of the forward one I attemopted as follows.
Assume $\Delta_X$ is closed, then $D=(\Delta_X)^C$ is open. Let $p_1,p_2\in D$ then $p_1 \neq p_2$. Take a union of open sets $U=\cup_{\alpha \in A}U_{\alpha}$ such that $p_1,p_2 \in U$. If $p_i \in U_{\alpha_i}$ with $U_{\alpha_1} \cap U_{\alpha_2} = \varnothing$ then we're done. If not, then $p_1,p_2$ are contained in the same open set. Write this set as a union of open sets such that $p_1$ and $p_2$ are not contained in the same open set. Therefore, $X$ is Hausdorff.
I'm not sure if this is correct but if it isn't any comments on where it is wrong and hints at improving it would be greatly appreciated!