$f,g$ continuous from $X$ to $Y$. if they are agree on a dense set $A$ of $X$ then they agree on $X$

Suppose $f(x_0) \neq g(x_0)$, then since $Y$ is Hausdorff, there are open sets $U,V \subset Y$ such that $$ f(x_0) \in U, g(x_0) \in V, \text{ and } U\cap V = \emptyset $$ Now $$ x_0\in f^{-1}(U)\cap g^{-1}(V) =: W $$ and $W$ is open, and hence $\exists a\in A\cap W$, whence $$ f(a) = g(a) \in U\cap V \Rightarrow U\cap V \neq \emptyset $$ This contradiction proves the result.


One can do that using nets and prove directly. If $x$ is in the dense set, then clearly $f(x)=g(x)$. Suppose $x$ is outside the dense set, let $x_i$ be a net converging to $x$, whose elements are all from the dense set.

Then $f(x_i)=g(x_i)$ is a net in $Y$. Since $Y$ is Hausdorff we have to have $\lim f(x_i)=\lim g(x_i)$ (recall that being Hausdorff is equivalent to the statement that converging nets have a unique limit point). But now by continuity we finish as the following holds: $$f(x)=f\left(\lim x_i\right)=\lim f(x_i)=\lim g(x_i)=g\left(\lim x_i\right)=g(x).$$


I'm just going to add a short proof to this question, since this proof wasn't listed, and this question seems to be the version all duplicates are directed towards.

Setting up notation: Let $f,g : X\to Y$ be continuous functions, with $Y$ Hausdorff. Let $f,g$ agree on a dense subset $A$ of $X$. Let $\Delta_X : X\to X\times X$ denote the diagonal map and let $D_Y\subset Y\times Y$ denote the diagonal as a subset of $Y\times Y$, finally let $(f,g)$ denote the product map from $X\times X\to Y\times Y$.

Proof: It is a standard fact that $Y$ is Hausdorff if and only if $D_Y$ is closed, so $D_Y$ is closed. Therefore the set of points at which $f$ and $g$ agree, $((f,g)\circ \Delta_X)^{-1}(D_Y),$ is a closed subset of $X$. However, we know this set also contains a dense subset, so it must be all of $X$. Thus $f=g$.