$f: \mathbb{R} \to \mathbb{R}$ is continuous with $f(x)=0$ for all $x \in \mathbb{Q}$. Show that $f(x) = 0$ for all $x \in \mathbb{R}$.
Can anyone please point me in the right direction as to how I can go about answering this question?
$f: \mathbb{R} \to \mathbb{R}$ is continuous with $f(x)=0$ for all $x \in \mathbb{Q}$. Show that $f(x) = 0$ for all $x \in \mathbb{R}$.
Can anyone please point me in the right direction as to how I can go about answering this question?
Hint: The rationals are dense in the reals (with the usual notion of distance), so for every real number $x$, there exists a sequence $(x_{k})$ of rationals converging to $x$.
Hint: by contradiction. Assume there is a value $x$ with $f(x)=a\neq 0$. Every open interval containing $x$ contains a rational number. Use continuity to conclude.
Assume $f(x_0)=y$ with $y\neq 0$. Then there is $\delta>0$ so that if $x\in (x_0-\delta,x_0+\delta)$ then $|f(x_0)-f(x)|<|y|\implies |y-f(x)|<|y|\implies f(x)\neq 0$
Of course this interval contains rational numbers. So if we pick $x$ rational in the interval we get $f(x)\neq 0$, a contradiction. The contradiction stems from assuming an $x_0$ with $f(x_0)\neq 0$ existed.
Assume that $$ \exists q \in \mathbb{R} \setminus \mathbb{Q} : f(q) \not = 0$$ Now by trichotomy we have either $f(q) > 0$ or $f(q) < 0$. If we consider the first case, by continuity of $f$ we have $$ \exists \delta > 0 : f(x) > 0 : x \in (q - \delta, q + \delta)$$ (Proving this is a very useful exercise in itself). Can you see what the contradiction is now in the above statement? Remember the hypothesis.
Let $X$ be a metric space, with a dense subset $D$. If $f\colon X\to \mathbb{R}$ and $g\colon X\to \mathbb{R}$ are continuous functions such that $f(x)=g(x)$ for all $x\in D$, then $f=g$.
Proof. Consider the function $h(x)=f(x)-g(x)$. Then $D\subseteq h^{-1}(\{0\})$ and $h^{-1}(\{0\})$ is a closed subset. Therefore $h^{-1}(\{0\})=X$.
In your case $X=\mathbb{R}$, $D=\mathbb{Q}$ and $g$ is the zero constant function.