if $f$ is continuous on $\mathbb{R}$ and $f(r)=0,r \in \mathbb{Q}$, then $f(x)=0,x \in \mathbb{R}$

Solution 1:

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.

Solution 2:

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$.