How to show that continuous functions between metric spaces agree on a closed set Let $(X,d)$ and $(Y,d')$ be metric spaces, and let $D$ be a dense subset of $X$. Show that:

If $f:X\to Y$ and $g:X\to Y$ be continuous, then the set $\{x\in X\mid f(x)=g(x)\}$ is closed.

 A: Where does the set $D$ come into picture? This is an irrelevant piece of information needed to prove the question. Below is a hint.
HINT
Using the fact that continuity implies sequential continuity, try to prove that the set $\{x \in X \vert f(x) = g(x)\}$ contain its limit points.
A: In a metric space $X$ we have


*

*$S\subseteq X$ is closed iff it is closed under limit of sequences, i.e., for all sequences $(s_n)\subseteq S$, $\ \exists\lim(s_n)\Rightarrow \lim(s_n)\in S$.

*$f:X\to Y$ is continuous iff it is sequentially continuous (i.e., preserves limits of sequences).


Now, let $S:=\{x\in X\,\mid\,f(x)=g(x)\}$, and let $(s_n)\subseteq S$ be a convergent sequence, say $s_n\to x\in X$. Then, by continuity, we have
$$f(x)=\lim f(s_n)=\lim g(s_n)=g(x)\,.$$
So, $x\in S$.
A: One of the axioms of a metric space is $d(a,b)=0$ if, and only if, $a=b$. 
Define a map $\phi : X \to \mathbb{R}$ as follows: $\phi : x \mapsto d'(f(x),g(x))$. Clearly, $\phi(x)=0$ if, and only if, $f(x)=g(x)$. The aim is to show that $\phi^{-1}(0)$ is closed in $X$. By assumption, $f$ and $g$ are continuous. As with any metric space $d' : Y \times Y \to \mathbb{R}$ is (uniformaly) continuous. Hence $\phi$ is the composite of two continuous maps.
\begin{array}{ccccc}
X &\stackrel{f\times g}{\longrightarrow}& Y \times Y &\stackrel{d'}{\longrightarrow}& \mathbb{R} \\
\\
x &\longmapsto& (f(x),g(x)) &\longmapsto& d'(f(x),g(x))
\end{array}
Since $\{0\}$ is closed in $\mathbb{R}$ it follows that $\phi^{-1}(0) \subseteq X$ is closed in $X$.
A: A Hausdorff space (also called a $T_2$ space). is a topological space $S$ in which any two distinct points $x,y\in S$ have disjoint neighborhoods: There are open sets $U,V$ with $x\in U,\;y\in V$ and $U\cap V=\phi.$
THEOREM: If $Y$ is Hausdorff and $f:X\to y,\;g:X\to Y$ are continuous then $A=\{p\in X:f(p)=g(p)\}$ is closed in $X.$
PROOF:Suppose not. Let $p\in (Cl_X A)\backslash A.$ So $f(p)\ne g(p).$ Let $U,V$ be disjoint open sets in $Y$ with $f(p)\in U$ and $g(p)\in V.$
Since $f$ and $g$ are continuous there are open sets $U^*,\; V^*$ in $X$, with $p\in U^*,\;  p\in V^*$, satisfying $f(U^*)\subset U$ and $g(V^*)\subset V.$
Now for any $q\in U^*\cap V^*$ we have $f(q)\ne g(q)$ because $f(q)\in U,\;  g(q)\in V$ and $U\cap V=\phi.\;$
So $ U^*\cap V^*$ is disjoint from $A,$ and is open in $X,$ and contains $p.$ But this implies $p\not \in Cl_X A,$ a contradiction.QED.
Observe that a metric space $(Y,d')$ is Hausdorff ,for if $x,y$ are distinct points of $Y,$ let $U=B_{d'}(x,r)$ and $V=B_{d'}(y,r)$ where $r=d'(x,y)/2.$
COROLLARY: If $Y$ is Hausdorff and $f:X\to Y,\; g:X\to Y$ are continuous, and if $A=\{p:f(p)=g(p)\}$ is dense in $X,$ then $f=g.$ Becuase, by the theorem we have $ Cl_X A=A$ and by the hypothesis of denseness we also have $Cl_X A=X.$
