if $f$ is continuous on $\mathbb{R}$ and $f(r)=0,r \in \mathbb{Q}$, then $f(x)=0,x \in \mathbb{R}$ Suppose that $f:\mathbb{R} \rightarrow \mathbb{R}$ is continuous on $\mathbb{R}$ and that $f(r)=0$ for all $r \in \mathbb{Q}$. Prove that $f(x)=0$ for all $x \in \mathbb{R}$. 
My attempt: Define a sequence $(x_n)$ where $x_n \in \mathbb{Q}$ for all $n \in \mathbb{N}$ and assume that $(x_n) \rightarrow a \not\in \mathbb{Q}$. Since $f$ is continuous, we have $\lim_n{f(x_n)}=f(a)=0$. Since $a$ is arbitrary irrational number, we have $f(a)=0$ for all $a \not\in \mathbb{Q}$. Hence, we proved the statement.
Is my proof valid? or is there any flaw ? 
 A: Maybe you should be more explicit why it works (mentioning that every irrational number is a limit of a sequence of rationals (taking decimal digits will be the canonical way)). 
Every irrational has a unique decimal expansion (if we avoid recurring (?) 9). So when $x$ is irrational we know 
$$x=\sum_{k=-m}^\infty a_k 10^{-k}$$ 
with $a_k \in \{ 0,1,2,3,4,5,6,7,8,9\}$, and $m \in \mathbb{N}$
When we take the sequence 
$$b_n=\sum_{k=-m}^n a_k 10^{-k} $$ 
with the same $a_k$ as in $x$ we see that $b_n$ converges to $x$. But every $b_n$ is an rational.
Yeah it does work, but it would be even easier using intermediate value theorem, as between two irrational is always an rational and vice versa all values must be zero.
A: As long as you know that you can define such a sequence, then your argument is perfect.
Perhaps an easier way to go is to note that since $f$ is continuous, then the preimage of any closed set is closed. In particular, the preimage of $\{0\}$ is closed, and the only closed set of reals containing the rationals is the whole real line. Hence, $f\equiv 0$.
A: Assume $f$ is not identically zero, so there must exist some irrational $s$ such that $f(s) \neq0$, By continuity there is some neighbourhood of $s$ where $f \neq0$, but since $\mathbb Q$ is dense in $\mathbb R$, this is not possible. And you have your result.
