As I'm preparing for my exam I have to solve the following question:
Determine if the following is correct:
Let $f$ be a continuous function is $\Bbb R$. If $f$ recieves only rational values, thus $f(x)\in\Bbb Q$ for all $x\in\Bbb R$, then $f$ is a constant function.
My solution:
The statement is not correct. Let $f$ be the following functoin: $f(x) = \begin{cases}x & x\in\Bbb Q \\ \lceil x \rceil & x \notin\Bbb Q \end{cases}$
$f$ is continuous since $$\lim_{x\to x_{0}} f(x)=f(x_0)$$and certainly is not constant.
Is my solution correct?
Thanks.