For a dense subset D of R, f, g : R → R are functions such that f(q) = g(q) for every q ∈ D. Show the following:
(1) If f is continuous and g is monotone, then f(x) = g(x) for every x ∈ R.
(2) If f and g are both continuous, then f(x) = g(x) for every x ∈ R.
So I proved 2 by assuming for any x in R, since D is dense for R there exists a sequence x that goes to x0. Since f and g are both continuous, f(x) and g(x) go to f(x0) and g(x0). Since f(q)=g(q) f(x)=g(x) and by uniqueness of limits f(x0)=g(x0). I don't know how to prove (1)... any help? Thanks in advance!
WLOG we assume that $g$ is non-decreasing. For any $x\in\mathbb R$ we can find $\{x_n\}\subset D$ and $\{y_n\}\subset D$ such that $x_n\uparrow x$ and $y_n\downarrow x$. Hence $$f(x_n)=g(x_n)\leq g(x)\leq g(y_n) =f(y_n).$$ Letting $n\to\infty$ and using the continuity of $f$ give the desired result.