TITLE: If two continuous maps into a Hausdorff space agree on a dense subset, they are identically equal
QUESTION [7 upvotes]: Let $f, g : X \to Y$ be continuous functions. Assume that $Y$ is Hausdorff and that there exists a dense subset $D$ of $X$ such that $f(x) = g(x)$ for all $x \in D$. Prove that $f(x) = g(x)$ for all $x \in X$.
Here is what I have so far,
Proof:
Let $f : X \to Y$ and $g : X \to Y$ be continuous and suppose that $f(x)=g(x)$ for some dense $D\subset  X$. Let $x  \in X$, since $D$ is a dense subset of $X$, $x  \in \mathrm{Cl}(D)$. I'm unsure how to proceed from here.

REPLY [8 votes]: When we have that $f(x)\neq g(x)$ then there exists opens $U_f$ and $U_g$ such that $U_f\cap U_g=\emptyset$, here we use the Hausdorff condition. Now $A:=f^{-1}(U_f)\cap g^{-1}(U_g)$ is an open since $f,g$ are continuous. Then we have that on $A$ the functions do not coincide. This contradicts the fact that they coincide on a dense subspace. 
Edit: 
Here we have that $U_f$ is an open containing $f(x)$ and similarly $U_g$ contains $g(x)$.