Let $\displaystyle X $ and $\displaystyle Y $ be metric spaces and let $\displaystyle D $ be a dense subset of $\displaystyle X $. Let $\displaystyle f: X \to Y $ and $\displaystyle g: X \to Y $ be continuous functions. Suppose that $\displaystyle f(r) = g(r) $ for all $\displaystyle r \in D $. Prove that $\displaystyle f = g $.

Proof.Let $\displaystyle r \in X \backslash D $. Then $\displaystyle r $ is a limit point of $\displaystyle D $ by the denseness of $\displaystyle D $. Pick a decreasing sequence of positive real numbers $\displaystyle (x_n) $. Then in each open ball $\displaystyle B_{x_{n}}(r) $, there is a point $\displaystyle q_n \neq r $ such that $\displaystyle q_n \in D $. Form these terms as a sequence $\displaystyle (q_n) $. Fix $\displaystyle \epsilon > 0 $. Since $\displaystyle x_n \to 0 $ any open ball centered at $\displaystyle 0 $ contains at least one $\displaystyle x_j $ for some $\displaystyle j \in \mathbb{N} $. So there is some $\displaystyle j $ such that $\displaystyle x_j \in B_{\epsilon}(0) $. Then for $\displaystyle n \geq j $, $\displaystyle q_{n} \in B_{\epsilon}(r) $. So $\displaystyle q_n \to r $. Then $\displaystyle g(r) = \lim_{n \to \infty} g(q_n) $. We know that $\displaystyle q_n \in D $ for $\displaystyle n \in \mathbb{N} $. Thus $\displaystyle f(q_n) = g(q_n) $ which implies $\displaystyle f(r) = g(r) $. Thus $\displaystyle f = g $. $\displaystyle \blacksquare $

Is this correct?