The famous Thomae's function provides an example which is continuous only on irrationals. Similarly, can we have a function which is continuous only on rationals and nowhere else?
-
2$f\colon \mathbb{Q} \rightarrow \mathbb{Q}$ with $f(x)=0$ is continuous on the rationals and there is nowhere else. – Henry Oct 09 '15 at 07:06
-
Thanks for pointing it out. – Debdas Ghosh Oct 10 '15 at 07:52
2 Answers
No.
The Wikipedia article on Thomae's function gives an elegant proof of why this is impossible. It includes links to terms it uses. I'll present what it says here but I suggest you view it on Wikipedia.
A natural follow-up question one might ask is if there is a function which is continuous on the rational numbers and discontinuous on the irrational numbers.
This turns out to be impossible; the set of discontinuities of any function must be an Fσ set. If such a function existed, then the irrationals would be an Fσ set and hence, as they don't contain an interval, would also be a meager set.
It would follow that the real numbers, being a union of the irrationals and the rationals (which is evidently meager), would also be a meager set. This would contradict the Baire category theorem.