Supposed X and Y are metric spaces and $f:X \rightarrow Y$ and $g:X \rightarrow Y$ are continuous prove $\{x \in X:f(x)=g(x)\} $ is a closed set Supposed X and Y are metric spaces and $f:X \rightarrow Y$ and $g:X \rightarrow Y$ are continuous prove $\{x \in X:f(x)=g(x)\} $ is a closed set
I don't have any idea where to start. Any suggestions?
 A: Suppose that $x^*\in X$ is in the closure of $\{x\in X\,|\,f(x)=g(x)\}$. Then, there exists a sequence $(x_n)_{n\in\mathbb N}\subseteq X$ converging to $x^*$ such that $f(x_n)=g(x_n)$ for all $n\in\mathbb N$. Using the triangle inequality for the metric on $Y$, $d_Y:Y\times Y\to[0,\infty)$, $$d_Y(f(x^*),g(x^*))\leq d_Y(f(x^*),f(x_n))+d_Y(f(x_n),g(x_n))+d_Y(g(x_n),g(x^*))$$
for any $n\in\mathbb N$. The second term is zero and the first and third terms can be made arbitrarily small since $x_n\to x^*$, and $f$ and $g$ are both continuous. It follows that $d_Y(f(x^*),g(x^*))=0$ or $f(x^*)=g(x^*)$, so that $x^*\in\{x\in X\,|\,f(x)=g(x)\}$. That is, the closure of $\{x\in X\,|\,f(x)=g(x)\}$ is contained in $\{x\in X\,|\,f(x)=g(x)\}$, so this set is closed.
A: The map $X → Y × Y,\; x ↦ (f(x),g(x))$ is continuous (why?) and, since the metric space $Y$ is hausdorff, the diagonal $Δ = \{(y,y);\; y ∈ Y\}$ is closed in $Y × Y$.
A: Let $x\in X$ and assume $f(x)\ne g(x)$. Since $Y$ is Hausdorff, there are neighborhoods $U$ and $V$ of $f(x)$ and $g(x)$ respectively such that $U\cap V=\emptyset$.
Since $f$ and $g$ are continuous, $f^{-1}(U)$ and $g^{-1}(V)$ are neighborhoods of $x$. Let $W=f^{-1}(U)\cap g^{-1}(V)$, which is a neighborhood of $x$. If $x'\in W$, then $f(x')\in U$ and $g(x')\in V$, so $f(x')\ne g(x')$.
Therefore $\{x\in X:f(x)\ne g(x)\}$ is open in $X$, because it contains a neighborhood of each of its points.
Notice that the proof assumes only $X$ and $Y$ are topological spaces and that $Y$ is Hausdorff.
