Show that $f=g$ on $\mathbb{R}$, where $f=g$ on some dense set $U\subset\mathbb{R}$. The exact problem statement is,
Suppose that $f:\mathbb{R}\to\mathbb{R}$ and $g:\mathbb{R}\to\mathbb{R}$ are continuous on $\mathbb{R}$ and that $f(x)=g(x)$ for each $x\in U$ for some dense set $U\subset\mathbb{R}$. Prove that $f=g$ on all of $\mathbb{R}$.
My attempt at the proof is:
By way of contradiction, suppose the hypothesis and that there exists some $A\subset\mathbb{R}$ such that $f\neq g$ on $A$. Let us consider the function $f-g$, which is continuous on $\mathbb{R}$, since both $f$ and $g$ are continuous on $\mathbb{R}$. Notice that for each $a\in A$, $f(a)-g(a)\neq0$. Now, since $U$ is dense in $\mathbb{R}$, for each $x,y\in\mathbb{R}$ with $x<y$ there exists $u\in U$ such that $x<u<y$. Because $A\subset\mathbb{R}$, for each $a,b\in A$ with $a<b$ there exists $u\in U$ such that $a<u<b$, yet for every $u\in U$, $f(u)-g(u)=0$, implying $f-g$ is not continuous on $A\subset\mathbb{R}$, since $f-g\neq0$ on $A$.
I feel like I have the bulk of the proof down, but the last line I wrote doesn't sit right. Should I try to elaborate more or is that sufficient?
Is my approach even right or is there a simpler one?
Thanks for any help or feedback!
 A: What you have doesn’t work as stated, because you’re using $u$ for many different things at once. Here’s a fairly simple argument that generalizes to other settings besides $\Bbb R$.

Suppose that $f\ne g$; then there is an $x\in\Bbb R$ such that $f(x)\ne g(x)$. Let $V$ and $W$ be disjoint open nbhds of $f(x)$ and $g(x)$, respectively. Then $f^{-1}[V]$ and $g^{-1}[W]$ are open nbhds of $x$, since $f$ and $g$ are continuous. Let $G=f^{-1}[V]\cap g^{-1}[W]$; $W$ is an open nbhd of $x$, so there is some $u\in U\cap G$. But then $f(u)\in V$, and $g(u)\in W$, and $V\cap W=\varnothing$, so $f(u)\ne g(u)$, contradicting the hypothesis that $f\upharpoonright U=g\upharpoonright U$. Thus, $f=g$.

For something more along the lines that you had in mind, let $h=f-g$, and let $x\in\Bbb R$ be arbitrary. $U$ is dense in $\Bbb R$, so there is a sequence $\langle u_n:n\in\Bbb N\rangle$ in $U$ that converges to $x$. The function $h$ is continuous, so $\langle f(u_n):n\in\Bbb N\rangle=f(x)$. But $f(x_n)=0$ for each $n\in\Bbb N$, so $f(x)=0$.
A: It probably doesn't sit right because you haven't used continuity in a straightforward way: Why should "for each $a,b\in A,\ a<b,$ there exists $u\in U$ such that $f(u)-g(u) = 0$ but $f(a)-g(a)\neq 0 \neq f(b)-g(b)$" contradict continuity?
I would suggest two strategies. 
First, your (good!) trick of examining $f-g$ instead of $f$ and $g$ should lead you to ask

If $f$ is continuous and $f = 0$ on some dense subset $U\subset\mathbb{R}$, can I prove that $f = 0$ everywhere on $\mathbb{R}$?

If so, your proof is done. (Why?)
Second, consider working directly instead of via contradiction. In this setting, continuity is most intuitively expressed in terms of sequences. What does $U$ dense in $\mathbb{R}$ tell you about sequences in $U$ vis-a-vis points in $\mathbb{R}$? Can you use that to directly show that $f-g = 0$ everywhere without going through a contradiction?
A: The ending has problems. For one thing, $A$ might be a singleton. The beginning is fine. Let $h(x)=f(x)-g(x)$. We show that $h(x)$ is identically $0$. 
Suppose to the contrary that $h(a)=c\ne 0$. Since $h$ is continuous at $a$, there  is a $\delta\gt 0$ such that if $|x-a|\lt \delta$, then $|f(x)-f(a)|\lt |c|/2$. In particular, $f(x)\ne 0$ in the interval $a-\delta\lt x\lt a+\delta$. 
This is impossible, since there is an element of $U$ in this interval.
