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