Problem. Let $(X,\mathcal{T}_X)$ and $(Y,\mathcal{T}_Y)$ be two topological spaces and $f,g:X\to Y$ such that $f$ and $g$ both are continuous on $X$. Show that the set $E:=\{x:f(x)=g(x)\}$ is closed in $X$.
My Attempt
Let $\mathscr{S}:=\{V:(V\ \text{is closed in}\ Y)\land ((f(x)=g(x))\implies f(x)\in V)\}$. If $\mathscr{S}=\emptyset$ then we have nothing to prove since then $E=\emptyset$ and is indeed closed in $X$. So let $\mathscr{S}\ne \emptyset$. Then observe that,
$\displaystyle\bigcap_{\alpha\in \mathscr{S}}V_\alpha$ is the smallest closed set in $\mathscr{S}$.
$\displaystyle\bigcap_{\alpha\in \mathscr{S}}V_\alpha\subseteq f(X)$
Now observe that, $$f(x)\in f(E)\implies f(x)=g(x)\implies f(x)\in \displaystyle\bigcap_{\alpha\in \mathscr{S}}V_\alpha$$
At this point I am stuck. I actually wanted to show that $f(E)=\displaystyle\bigcap_{\alpha\in \mathscr{S}}V_\alpha$ but I am unable to do that. So my questions are,
Is there any way to show that $f(E)=\displaystyle\bigcap_{\alpha\in \mathscr{S}}V_\alpha$?
If not, then can some other way of proving this result be suggested?
Give $Y$, this statement is true for all $X,f,g$ if and only if $Y$ is Hausdorff.
Let $\Delta =\{(y_1,y_2)\in Y\times Y\mid y_1=y_2\}$ be the diagonal. When is $\Delta$ closed in $Y\times Y$?
If it is not closed, we can let $X_1=Y\times Y$ and $f,g:X_1\to Y$ by $f(y_1,y_2)=y_1$ and $g(y_1,y_2)=y_2$, and then $\Delta = \{x\in X_1\mid f(x)=g(x)\}$ is not closed, so the above theorem is not true.
If, on the other hand, $\Delta$ is closed, show that $h(x)=(f(x),g(x)):X\to Y\times Y$ is continuous, and that thus $\{x\mid f(x)=g(x)\}=h^{-1}(\Delta)$ is closed.
Now you just need to prove:
It's a good usage of point-set topology definitions. Easier to prove that $Y\times Y\setminus\Delta$ is open in $Y\times Y$ if and only if $Y$ is Hausdorff:
Proof: If $Y$ is Hausdorff, let $(y_1,y_2)\in Y\times Y\setminus\Delta$. Then, since $y_1\neq y_2$, you have open sets $U,V\subset Y$ so that $y_1\in U,y_2\in V$ and $U\cap V=\emptyset$. But that means $U\times V\subseteq Y\times Y\setminus\Delta$. Thus a neighborhood of $(y_1,y_2)$ is in our set, so $Y\times Y\setminus\Delta$ is open.
On the other hand, if $Y\times Y\setminus\Delta$ is open, then, by the definition of the product topology, we can find an expression:
$$Y\times Y\setminus\Delta = \bigcup_{i\in I} U_i\times V_i$$
with the $U_i,V_i$ being pairs of open sets. We can see that $U_i\cap V_i$ must be empty (or $U_i\times V_i$ contains an element of $\Delta$.)
For $y_1\neq y_2$, then, $(y_1,y_2)\in Y\times Y\setminus\Delta$, and thus there are a pair of disjoint open sets $U_i,V_i$ with $y_1\in U_i$ and $y_2\in V_i$. Hence $Y$ is Hausdorff.
So we've learned: