0

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.

Alan
  • 2,801
  • 2
    Not really. The statement is correct. –  Jul 02 '15 at 19:14
  • 2
    Just use the intermediate value theorem, along with the fact that there is always an irrational between two rationals. This means that $f$ must be constant. Your example doesn't work because your function isn't continuous. – Alex R. Jul 02 '15 at 19:22

4 Answers4

2

Your solution is not correct. For any rational number $a$ that is not itself an integer, observe that $f(a)=a$, but that for any $\epsilon<\lceil a\rceil-a$, there is no $\delta>0$ with the property that $$|x-a|<\delta\implies|f(x)-f(a)|=|f(x)-a|<\epsilon$$ because there exist irrational numbers $x$ arbitrarily close to $a$ with $f(x)=\lceil a\rceil $. Therefore $$\lim_{x\to a}f(x)\neq f(a) $$ (in fact the limit doesn't exist), so that $f$ is not continuous at $a$, and therefore $f$ is not continuous.

Zev Chonoles
  • 132,937
2

Here is my attempt to prove the statement is true: Assume $f$ is a non constant continuous function. Then we can find $x_{1}$ and $x_{2}$ $x_{1}<x_{2}$, such that $f(x_{1}) \not = f(x_{2})$. So $f$ is continuous on $[x_{1},x_{2}]$ so $f([x_{1},x_{2}])=[m,M]$, where $m<M$ are real numbers. Between any two distinct real numbers, we can find an irrational $a$. By Bolzano intermediate value theorem, we can find an element $x_{0} \in [x_{1},x_{2}]$ such that $f(x_{0})=a$.

mich95
  • 8,935
1

$\mathbb{Q}$ is disconnected while $\mathbb{R}$ is connected. Since the connection is a topological property (i.e. continuous functions preserve connection), a function $f\in C^0(\mathbb{R})$ such that $f(\mathbb{R})\subseteq\mathbb{Q}$ must be constant.

As an alternative, consider that continuous function have the Darboux (intermediate values) property, so assuming that two different rational numbers $q_1,q_2$ belong to the range of $f$, so does $\frac{q_1+q_2\sqrt{2}}{1+\sqrt{2}}\not\in\mathbb{Q}$, but that leads to a contradiction.

Jack D'Aurizio
  • 361,689
1

Since $\mathbb R$ is connected, if $f$ is continuous then $f(\mathbb R)$ is connected. Suppose $f(\mathbb R)\subset\mathbb Q$ and $f$ is not constant. Then there are at least two distinct rational numbers $q,r\in f(\mathbb R)$ (assume WLOG $q<r$. Because $\mathbb Q$ is dense in $\mathbb R$, we can find an irrational number $x$ with $q<x<r$. Then $x\notin f(\mathbb R)$, so $$f(\mathbb R) = ((-\infty,x)\cap f(\mathbb R))\cup ((x,\infty)\cap f(\mathbb R)), $$ the union of two nonempty disjoint open sets. Hence $f(\mathbb R)$ is not connected, a contradiction.

Math1000
  • 38,041