# 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?

• I would tackle this by trying to show that the complement is open – MPW Mar 9 '14 at 0:47

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.

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$.

• Although my professor did mention them briefly in class, Hausdorff spaces aren't mentioned in our textbook up to this point, so I probably can't use them for the homework. thanks though – chris Mar 8 '14 at 23:07
• You can prove nonetheless that $Δ$ is closed in $Y × Y$. Take $(y_1,y_2) ∈ Δ^c$, i.e. $y_1 ≠ y_2$. Then take $r = d(y_1,y_2)/2$. The $r$-balls $B_r(y_1)$ and $B_r(y_2)$ around $y_1$ and $y_2$ are now disjoint by the triangle inequality. Therefore $B_r(y_1) × B_r(y_2) ⊂ Δ^c$ (as the balls don’t contain a common point), so $Δ^c$ is open and $Δ ⊂ Y × Y$ is closed. Do you know about product spaces? – k.stm Mar 8 '14 at 23:16

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.

• Although my professor did mention them briefly in class, Hausdorff spaces aren't mentioned in our textbook up to this point, so I probably can't use them for the homework. thanks though – chris Mar 8 '14 at 23:08
• @chris Just use the fact that two distinct points in a metric space have disjoint neighborhoods, which is what “Hausdorff space” means; this is granted in metric spaces, isn't it? Instead of $U$ and $V$ you can use two spheres having no common point. – egreg Mar 8 '14 at 23:13