Continuous Functions from $\mathbb{R}$ to $\mathbb{Q}$
The following is not a homework problem. I am doing it for self study.
Prove that any continuous function from $\mathbb{R}$ to $\mathbb{Q}$ is constant.
Here is my proof:
Let $f:\mathbb{R}\rightarrow \mathbb{Q}$ be such a function.
? We first show that $\mathbb{Q}$ is disconnected. Let $p$ be an irrational number. Then we can write $\mathbb{Q}$ as $$ \big( \mathbb{Q} \cap (-\infty,p) \big) \cup \big( \mathbb{Q} \cap (p,\infty) \big), $$ which is a disconnection of $\mathbb{Q}$.
Moreover, $\mathbb{Q}$ is also totally disconnected, as any open subset $U$ of $\mathbb{Q}$ must contain two rational numbers and there is always an irrational number between the two, and we can use that rational number to create a disconnection. Therefore the only connected subsets of $\mathbb{Q}$ are the singleton sets $\{q\}$, where $q \in \mathbb{Q}$, which are closed.
We will show that $f(\mathbb{R})$ must be connected. Assume not, then $$ f(\mathbb{R})= U\cup V, $$ where $U$ and $V$ are nonempty open subsets of $\mathbb{Q}$ such that $$ U \cap V= \emptyset .$$ This implies $$ \mathbb{R} = f^{-1} \big( U \cup V \big) = f^{-1}(U)\cup f^{-1}(V), $$ where $f^{-1}(U),f^{-1}(V)$ are nonempty, nonintersecting subsets of $\mathbb{R}$. This, however, is a contradiction, as $\mathbb{R}$ is connected. Therefore no such set $U$ and $V$ can exist.
As we have already shown, the only connected subsets of $\mathbb{Q}$ are the singleton sets $\{q\}$, so $f(\mathbb{R})$ must be such a set.
Something about this does not seem quite satisfactory, as if I am missing something. Could anyone tell me a flaw in my logic? Also, is there a more satisfactory way to prove this theorem?
Solution 1:
Your argument is correct. Perhaps what is unsatisfying is that you're actually making an argument which applies much more generally. You seem to be proving the following theorem:
Suppose $X,Y$ are topological spaces and $f:X\to Y$ is a continuous map. If $X$ is connected, then $f(X)$ is connected.
If you are comfortable simply quoting this, then you're done once you've shown that $\mathbb{Q}$ is totally disconnected and $\mathbb{R}$ is connected: the image of $\mathbb{R}$ under any continuous map must be connected and the only connected subspaces of $\mathbb{Q}$ are singletons, so the image of $\mathbb{R}$ under any continuous map is a singleton.
If not, simply modify your argument to prove the theorem I stated. Your proof is correct: a disconnecting pair of open sets in the range will pull back to a disconnecting pair of open sets in the domain, giving a contradiction. The only modification you need is removing reference to $\mathbb{R}$ and $\mathbb{Q}$ and replacing them with general topological spaces.
Solution 2:
Suppose you know that
- Every continuous function from $\mathbb{R}$ to $\mathbb{Q}$ is a continuous function from $\mathbb{R}$ to $\mathbb{R}$.
- The intermediate value theorem holds.
- The irrationals are dense in $\mathbb{R}$.
Then a nonconstant continuous function would have to pass through the irrational numbers between any two of its values.
So then I suppose I would ask which of the three bulleted points were already established and which to prove as lemmas.
Nobody should ever write "Prove that any continuous function from whatever to whatever is constant." That could be understood as "Pick any continuous function from whatever to whatever and prove that it's constant", but what is more likely intended is "Prove that every continuous function from whatever to whatever is constant." Merely changing "any" to "every" eliminates all ambiguity.
Solution 3:
The topology on $\mathbb Q$ is the one induced on $\mathbb Q$ as a subset of $\mathbb R$. Thus, for every open set $U_{\mathbb R}$ of $\mathbb R$ the set $U_{\mathbb Q}=U_{\mathbb R}\cap \mathbb Q$ is open in $\mathbb Q$. If $f:\mathbb{R}\rightarrow \mathbb{Q}$ is continuous, the preimage $f^{-1}(U_{\mathbb Q})$ of every open set $U_{\mathbb Q}$ of $\mathbb Q$ is open in $\mathbb R$. But then we can consider $f$ as a function from $\mathbb R$ to $\mathbb R$, and by the above the preimage of every open set will still be open, so this is a continuous function from $\mathbb R$ to $\mathbb R$ that takes only rational values. Since there are irrational numbers between any two rational numbers, such a function must be constant by the intermediate value theorem.