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

Problem:

Suppose $f$ and $g$ are two continuous functions such that $f: X \to Y$ and $g : X \to Y$. $Y$ is a a Hausdorff space. Suppose $f(x) = g(x)$ for all $x \in A \subseteq X$ where $A$ is dense in $X$, then $f(x) = g(x)$ for all $x \in X$.

Attempt at a solution:

Put $h(x) = f - g$. Therefore, $h: X \to Y$ is continuous and $Y$ is Hausdorff by hypothesis. Also we know $h(x) = 0$ for all $x \in A$ such that $A$ is dense in $X$. I want to show that $h(x)$ vanishes everywhere in $X$. We can show $h(x) = 0$ for all $x \in X \setminus A$. Suppose $h(x) > 0$ on $X \setminus A$. Pick points $y_1,y_2 \in Y$. Since $Y$ is Hausdorff, can find open set $O_1, O_2 \subseteq Y$ which are disjoint such that $y_1 \in O_1$ and $y_2 \in O_2$. By continuity, $f^{-1}(O_1), f^{-1}(O_2)$ are open in $X$.

I know that if I can show that one of the $f^{-1}(O_i)$ lies in $X \setminus A$, then we would have a contradiction since we have non-empty open set in $X \setminus A$ and this implies $A$ cannot be dense in $X$. But this is the part I am stuck. Any help would greatly be appreciated.

Also, Would be be possible to prove this without using the Hausdorff condition on $Y$?

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.

• Why there exists $a \in A \cap W$ ?? – ILoveMath Oct 29 '13 at 9:59
• Because $A$ is dense, it intersects every non-empty open set. – Prahlad Vaidyanathan Oct 29 '13 at 10:02
• I understand now! thanks a lot for your time. One last question. Is it necessary to have $Y$ haussdorf? IF we drop this condition, can we still have the result ? – ILoveMath Oct 29 '13 at 10:06
• @DonAnselmo: Consider $\Bbb R$ with the trivial topology as both $X$ and $Y$. Let $f$ be the function moving $1$ to $2$, and fixes everything else; and $g$ moving $1$ to $3$ and fixes everything else. It's not hard to see that these are continuous (every function into a trivial space is continuous), and they agree on a dense set: $\{0\}$, and in fact $\Bbb R\setminus\{1,2,3\}$. But $f\neq g$. – Asaf Karagila Oct 29 '13 at 18:08
• @user123: Every metric space is Hausdorff. Proving this will itself help you understand the reasons for the axioms of a metric. – Prahlad Vaidyanathan Dec 12 '16 at 9:35

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