Exercise 4.6. A subset $S \subseteq X$ is dense in $X$ if $cl(S) = X$. Let $f, g : X → Y$ be continuous. If $f_{|S} = g_{|S}$ on some dense subset $S$ of $X$ then $f = g$.
I've seem this topic $f,g$ continuous from $X$ to $Y$. if they are agree on a dense set $A$ of $X$ then they agree on $X$ but in my class we have not formaly defined Hausdorff spaces. So I attempt a proof.
Attempted proof:
Proof: Let $f, g: X \rightarrow Y$ be continuous. If $S$ is closed, $cl(S) = X = S$ and $X - S$ = $\emptyset$ so the result follows trivially. Assume that S is not closed. Let $x_0 \in X - S$ such that $f(x_0) \neq g(x_0)$.
Fix $\varepsilon > 0$ small enough such that $|f(x_0) - g(x_0)| > 2\varepsilon$. Then $B_y(f(x), \varepsilon) \bigcap B_y(g(x), \varepsilon) = \emptyset$. Observe that $x_0$ belongs to the pre-images of both balls. Since $f,g$ are continuous, define $\delta := min(\delta_{f}, \delta_{g})$ where $\delta_{f}, \delta_{g}$ are such that
$B_x(x, \delta_{f}) \subseteq f^{-1} B_y(f(x), \varepsilon)$ and $B_x(x, \delta_{g}) \subseteq g^{-1} B_y(g(x), \varepsilon)$.
Since $x \in cl(S)$, we have that $A = (B_x(x, \delta) \bigcap S) \neq \emptyset$. Then $\exists y \in A$ s.t. $f(y) \neq g(y)$. This is a contradiction since $y \in f^{-1} B_y(f(x), \varepsilon)$ and $y \in g^{-1} B_y(g(x), \varepsilon)$ implies that $f(y) \in B_y(f(x), \varepsilon)$ and $g(y) \in B_y(g(x),\varepsilon$), but $f(y) = g(y)$ and these two sets are disjoint.
Is it ok? Anything I could enhance? Language, more straightforwardness?
P.S. "Since $x \in cl(S)$..." in this part I used the property that if $x$ belongs to the closure of a set, then any open ball in $x$ must intersect the set.
Thanks!