could someone please explain to me the following question:
Let $f,g$ be continuous functions from $\mathbb{R}$ to $\mathbb{R}$ and suppose that $f(r) = g(r)$ for all $r \in \mathbb{Q}$. Is it true that $f(x) = g(x)$ for all $x \in \mathbb{R}$?
My claim is that it should be true since $f$ and $g$ are continuous from $\mathbb{R}$ to $\mathbb{R}$, so if $f(x) \neq g(x)$ for all $x \in \mathbb{R}$ then it cant be continuous on $\mathbb{R}$?
So, is my claim correct and if it is how am I supposed to prove it (please give me some hints) Also, if my claim is wrong, could you please explain to me as to why its wrong`
Yes, the functions coincide :). If you wish, you can use the following fact from topology: if $f,g:X\to Y$, where $Y$ is Hausdorff ($X$ and $Y$ are topological spaces of course), are continuous, then the set $\{x\in X| \ f(x) = g(x)\}$ is closed in $X$. How to apply it here? Note that if $f(q) = g(q)$ for all rational $q$, then the set $\{x\in \mathbb{R}| \ f(x) = g(x)\}$ contains $\mathbb{Q}$ and at the same time must be closed... Hence it coincides with $\mathbb{R}$ (clearly $\mathbb{R}$ is Hausdorff)! ;)
If you don't want to use this fact from topology, you can proceed as follows. Take any $x\in\mathbb{R}\backslash\mathbb{Q}$. Take any sequence of rational numbers $\{q_n\}_{n\in\mathbb{N}}$ with $\lim_{n\to\infty} q_n = x$ (such sequence can clearly be chosen). Then according to your condition, $f(q_n) = g(q_n)$ for all $n$. Hence, $f(x) = f(\lim_{n\to\infty} q_n) = \lim_{n\to\infty} f(q_n) = \lim_{n\to\infty} g(q_n) = g(\lim_{n\to\infty} q_n) = g(x)$ (the first and the last equalities are due to continuity of $f$ and $g$...). And you're done.