Hausdorff Space iff Diagonal Set on Product is Closed

Theorem
Let $T = \left({S, \tau}\right)$ be a topological space.

Let $\Delta_S$ be the diagonal set on $S$:
 * $\Delta_S = \left\{{\left({x, x}\right) \in S \times S: x \in S}\right\}$

where $S \times S$ is the Cartesian product of $S$ with itself.

Then $T$ is a $T_2$ (Hausdorff) space iff $\Delta_S$ is closed in the product topology of $T^2 = \left({S \times S, \mathcal T}\right)$.

Proof
Suppose $T$ is a $T_2$ (Hausdorff) space.

Let $\Delta: S \to S \times S$ be the diagonal mapping on $S$.

We have that $\Delta \left({S}\right)$ consists of all the elements of $S \times S$ whose coordinates are equal.
 * $\Delta \left({S}\right) = \left\{{\left({x, x}\right) \in S \times S: x \in S}\right\} = \left\{{\left({x, y}\right) \in S \times S: x = y}\right\}$

By definition, $\Delta_S$ is the same set as $\Delta \left({S}\right)$.

Now consider $H := \complement_{S \times S} \left({\Delta \left({S}\right)}\right)$, its complement in $S \times S$.

We have that $H$ consists of all the elements of $S \times S$ whose coordinates are different:
 * $H = \left\{{\left({x, y}\right) \in S \times S: x \ne y}\right\}$

Let $\left({x, y}\right) \in H$.

Because $T$ is a $T_2$ space:
 * $\exists U, V \in \tau: x \in U, y \in V: U \cap V = \varnothing$

Because $U \cap V = \varnothing$ it follows that $U \times V \cap \Delta \left({S}\right) = \varnothing$.

That is:
 * $U \times V \subseteq H$

Now from the definition of the Tychonoff topology, we have that $U \times V$ is the element of the natural basis of $T^2 = \left({S \times S, \mathcal T}\right)$.

Hence $H$ is open in $T^2$.

Therefore, by definition, $\Delta_S$ is closed in $T^2 = \left({S \times S, \mathcal T}\right)$.

Now suppose $\Delta_S$ is closed in $T^2 = \left({S \times S, \mathcal T}\right)$.

Then $H = \left\{{\left({x, y}\right) \in S \times S: x \ne y}\right\}$ is open in $T^2$.

Let $\left({x, y}\right) \in H$.

We have that $x \ne y$ by the nature of $H$.

Then there exists an element $U \times V$ in the natural basis of $T^2$, and therefore open in $T^2$.

As $U \times V \subseteq H$ it follows that $U \cap V = \varnothing$.

By definition of the product topology, as $U \times V$ is open in $T^2$, then $U$ and $V$ are both open in $T$.

So, for any $\left({x, y}\right)$ we have $U, V \subseteq S$ such that $x \in U, y \in V, U \cap V = \varnothing$.

So $T$ is a $T_2$ (Hausdorff) space.