0
$\begingroup$

Note Do not close this question like It was done earlier. Question is different so I am asking a new question. l am not supposed to use connectedness here Mine is a basic real analysis course. Thanks.

Question

Does there exist a continuous function $f:\mathbb{R} \to \mathbb{R}$ satisfying $$f\left(x\right) \in\mathbb{Q} \text{ for all } x \in \mathbb{R}-\mathbb{Q}$$ and $$f\left(x\right) \in \mathbb{R}-\mathbb{Q} \text{ for all } x \in \mathbb{Q}$$??

Attempt I do not really know what to do. I don't know whether to prove or to disprove

$\endgroup$
5
$\begingroup$

Hint: show that such a function takes only countably many values. But the Intermediate Value Theorem says ...

$\endgroup$
  • $\begingroup$ Function takes both rational and irrational values. I am not able to figure you what you want to say. I tried to analyse using you hint. Do you mean that f being a function from $f:\mathbb{R} \to \mathbb{R}$ takes all values because it continuous. It cannot take $ \mathbb{Q} \to \mathbb{R}-\mathbb{Q}$ because Domain is countable and Range is uncountable? If correct can you provide a stronger argument $\endgroup$ – user581912 Aug 12 '18 at 5:11
  • $\begingroup$ There are countably many values $f(x)$ for $x \in \mathbb Q$, and countably many values $f(x)$ for $x \notin Q$ (because then $f(x) \in \mathbb Q$), so countably many in total. A continuous function that takes values $a$ and $b$ takes all values between $a$ and $b$. $\endgroup$ – Robert Israel Aug 12 '18 at 6:03
0
$\begingroup$

We can show by a counter example that such a function cannot exist. Lets do proof by contradiction, let say there exists a continuous function which has this property, lets say it graph is $ y = f(x) $ which has a domain over all reals as you have given. Now, lets draw the graph $y = px$ (p being rational, chosen such that this could cross f(x)), now as the function assumed $f(x)$ is continuous this would definitely intersect somewhere with $y = f(x)$ for some p, lets say this point is $x = k$, now as the line is $y = px$ this implies $f(k) = pk$ but this is a contradiction as we know when $pk$ is rational $f(k)$ has to be irrational and vice-versa, and rational and irrational can never be equal so such a function $f(x)$ cannot exist.

Additionally, we can extend this by drawing $y = mx$ instead of $y = x$ and with m being rational and noting that rational multiplied with rational is rational and irrational multiplied with rational irrational, that, we cannot even have a piece-wise continuous function with such property, as we can set m such that we can cross each piece-wise continuous part and show continuity cannot exist as x and y co-ordinates both have to be rational at once or irrational at once same as the initial argument proposed!

$\endgroup$
  • $\begingroup$ I didn't get why f(x) will interdect with y=x somewhere because of continuity. Please elaborate $\endgroup$ – user581912 Aug 10 '18 at 1:22
  • $\begingroup$ If the graph of a function is continuous over whole $R$, then there are no jumps from where the line $y= x$ can escape (say we extend it till infinity on both sides) more like if you can imagine because the function is continuous we have boundedness in some compact space and if you extend the line upto infinity there are points of the line which are above and some below and as the line it itself is continuous as well, it has to cross $f(x)$ somewhere in between. $\endgroup$ – Multigrid Aug 10 '18 at 8:51
  • $\begingroup$ If i say, consider the continuous function f(x)=x-2. It is continuous over whole R but does not cross y=x. I am still not clear why is it so? $\endgroup$ – user581912 Aug 10 '18 at 12:00
  • $\begingroup$ True this is very peculiar case. But there exists an m for every continuous function such that $y= mx$ can cross the same continuous function. So , in my second part of answer I have generalized the idea taking $y = mx$. $\endgroup$ – Multigrid Aug 10 '18 at 12:35
  • $\begingroup$ I should change in the first part of answer that we choose some m being rational, which makes $y=mx$ cross the continuous function $\endgroup$ – Multigrid Aug 10 '18 at 12:37

Not the answer you're looking for? Browse other questions tagged or ask your own question.