Real analysis: density and continuity I am supposed to prove that if two continuous functions $f:\mathbb R\rightarrow\mathbb R$ and $g:\mathbb R\rightarrow\mathbb R$ coincide on a dense subset $\\D$ of $\mathbb R$, then they coincide everywhere.
I know that since $\\f$ and $\\g$ are continuous at every point in $\mathbb R$, then the preimage of any open neighborhood of any real number $\\a$ must also be an open neighborhood of $\\f^{-1}(a)$.  But I'm lost on how to use that to get to the conclusion.  Do I have to use the concept of connected sets?
 A: Take any point $z\in\mathbb{R}$, you need to show that $f(z)=g(z)$.
$D$ is dense in $\mathbb{R}$, that is: for every point $y\in \mathbb{R}$ and $\epsilon>0$, one has
$$B_y(\epsilon)\cap D\not=\emptyset$$
where $B_y(\epsilon)=\{x\in\mathbb{R}:|x-y|<\epsilon\}$ is the usual open ball of radius $\epsilon$ in $y$.
Now $f$ and $g$ are continuos in $y$ so
$$\forall \varepsilon,\exists \delta':|x-y|<\delta'\implies |f(x)-f(y)|<\varepsilon$$
$$\forall \varepsilon,\exists \delta'':|x-y|<\delta''\implies |g(x)-g(y)|<\varepsilon$$
Fix a $\varepsilon>0$ and take a $\delta$ which satisfies both the inequalities above - just take $\delta=\max(\delta',\delta'')$. For density, there is an element $x$ in $B_z(\delta)\cap D$, that is $x\in D$ and $|x-z|<\delta$. Now
$$|f(z)-g(z)|\le|f(z)-f(x)|+|f(x)-g(x)|+|g(x)-g(z)|$$
simply using the triangle inequality. The first modulo is $<\varepsilon$ since $|z-x|<\delta$ and we can apply the definition of continuity, same goes for the third one. The middle modulo is $0$ as $f\equiv g$ on $D$ and $x\in D$, so we have
$$|f(z)-g(z)|<2\varepsilon$$
On the other hand $z$ is independent of $\varepsilon$, so taking $\varepsilon$ "small enough" you get that $f(z)=g(z)$.
