# If a function is continuous everywhere and $f(x)=0$ for all rationals then prove that $f(x)=0$ for all reals.

A local book problem: A function $$f:\mathbb{R}\to\mathbb{R}$$ is continuous on $$\mathbb{R}$$ and $$f(x)=0$$ for all $$x\in\mathbb{Q}$$. Prove that $$f(x)=0$$ for all $$x\in\mathbb{R}$$. There was a hint in the book:Let $$c\in\mathbb{R}$$. Consider a sequence of rational point $${c_n}$$ converging to c. Use sequential criterion for continuity. I could not understand how to use the sequential criterion of continuity. I also have a question about the sequential criteria. Sequential criterion states that: Let $$D\subset\mathbb{R}$$ and $$f:D\to\mathbb{R}$$ be a function. Let $$c\in D\cap D^c$$. $$f$$ is continuous at $$c$$ if and only if for every sequence $${x_n}$$ in $$D$$ converging to $$c$$, the sequence $${f(x_n)}$$ converges to $$f(c)$$. I could not understand how can there be a common point between a set and it's complement set. Please help. Thanks in advance.

• Please mention the reason too for down voting so I could improve. – Mansi Mar 16 at 3:45

Let $$c\notin \mathbb Q$$. There is a sequence of rational $$(c_n)$$ s.t. $$c_n\to c$$ when $$n\to \infty$$. Now, $$f(c_n)=0.$$ By continuity, $$\lim_{n\to \infty }f(c_n)=f(c).$$ Since $$f(c_n)=0$$ for all $$n$$, we get, $$f(c)=0$$. Since $$c\in \mathbb R\setminus \mathbb Q$$ is unspecified, we get $$f(x)=0$$ for all $$x\in\mathbb R$$.