Let $f : X → Y$ be a continuous function between two topological spaces $X$ and $Y$, and suppose that $Y$ is Hausdorff.
Show that $C :=\{(x_1, x_2) : f(x_1) = f(x_2)\}$ is a closed subset of $X × X$.
My attempt:
To show that $C$ is closed, we show that $C^c$, its complement, is open. So, $C^c := \{(x_1,x_2) : f(x_1) \not= f(x_2)\}.$ Let $f(x_1) := y_1$,and $f(x_2) := y_2$. Since $y_1$ and $y_2$ are distinct points of $Y$, and since $Y$ is Hausdorff, then there exists open sets $U$ and $V$ such that $y_1 \in U$ and $y_2 \in V$, and $U \cap V = \phi$. Since $\phi$ is open, then its complement is closed, so $(U \cap V)^c = \phi^c$ is closed. So $C$ is closed.
Is my attempt correct? Any help please?
Pick a point $(x_1,x_2)\in C^c$. Then $f(x_1)\not=f(x_2)$, so there are open sets $U,V\in Y$ with $f(x_1)\in U$ and $f(x_2)\in V$ and $U\cap V=\varnothing$ (this is because $Y$ is Hausdorff). Then $f^{-1}(U)$ is open in $X$ (since $f$ is continuous) and contains $x_1$, and $f^{-1}(V)$ is open in $X$ and contains $x_2$, and we have $f^{-1}(U)\cap f^{-1}(V)=f^{-1}(U\cap V)=f^{-1}(\varnothing)=\varnothing$, so $f^{-1}(U)\times f^{-1}(V)$ is an open subset of $C^c$ containing $(x_1,x_2)$. Thus $(x_1,x_2)$ is an interior point, so $C^c$ is open, hence $C$ is closed.