Proving f(x)=0 for all x in [a,b] when we only know that f is continuous and f(x)=0 when x is rational. The question is as follows
a.) Let $f(x)$ be continuous function on an interval [a,b] and suppose that $f(x)=0$ for each rational value $x$ in [a,b]. Prove that $f(x) = 0$ for all $x \in [a,b]$.
b.) Let $f(x)$ and $g(x)$ be continuous functions such that $f(x)=g(x)$ for each rational value of $x \in [a,b]$. Prove that $f(x)=g(x)$ for any $x \in [a,b].$
To prove the first part I thought that since we know $f(x)$ to be continuous, by the definition of continuity we can show $|f(x)-f(a)|< \epsilon$ when $|x-a|< \delta$. Then I was going to show that there is a irrational within each epsilon of a rational. It this the right thought process? 
I also thought it might be possible to use the limit definition of continuity along with the fact that each rational is the limit of a set of irrationals to show $f(x)=0$ for all $x \in [a,b]$. 
Anyways help would be greatly appreciated. 
 A: Towards a). Note that this is not necessarily true if $a=b$ are irrational. But if $a < b$, it is true:
Suppose, towards a contradiction, that there is an $x \in [a,b]$ with $f(x) \neq 0$. As $f$ is continuous, there is for $\epsilon = \frac{|f(x)|}{2}$ some $\delta > 0$ such that for all $x' \in [a,b]$ with $| x-x' | < \delta$ it follows that $| f(x)-f(x') | < \epsilon$. As $a < b$, there is however a rational $x' \in [a,b]$ with $| x-x'| < \delta$. But now $| f(x) - \underbrace{f(x')}_{=0} | = |f(x)| > \frac{|f(x)|}{2} = \epsilon.$ Contradiction!
To prove b) note that $f(x)-g(x)$ is a continuous function such that $f(x)-g(x) = 0$ for all rational $x \in [a,b]$. Now use a) to conclude that $f(x) = g(x)$ for all $x \in [a,b]$.
A: Let $l$ be any point of the domain. Then for any sequence $x_{n}$ in $[a,b]$ such that $x_{n}\rightarrow l$ we have by definition of continuity $f(x_{n})\rightarrow f(l).$ Now let $x_{n}$ be any sequence of rationals in $[a,b]$ which converges to $l$ then $f(x_{n})=0$ which gives $f(l)=0.$i.e. $f(x)=0$ for all $x\in [a,b].$ To prove second part use the same  concept on the continuous function $f-g.$
A: Part b) is similar to part a), so here's part a), following your second suggestion. Let $x\in[a,b]$, and let $\{q_n\}$ be a sequence of rational numbers, such that $q_n\to x$. By continuity of $f$, we have
$$f(x) = f\left(\lim_{n\to\infty}q_n\right) = \lim_{n\to\infty} f(q_n) = \lim_{n\to\infty} 0 = 0.$$
Thus $f$ is $0$ on all real numbers $x\in [a,b]$.
