# Nowhere Continuous Function [duplicate]

I was reading Dirichlet and Thomae's functions and got interested to know about functions which are continuous nowhere. Since these have a lot to do with rationals and irrationals, the next question that came to my mind is:

what about a function which is rational at all irrational points and irrational at all rational points?

Is this function continuous?

I will tell you a brief sketch of my approach. I first proved that if our function assumes a constant rational value for every irrational, but varying irrational values for the rationals, then by Sequential Criterion of Continuity, this function is not continuous. But what about the general case i.e. the function assumes varying irrational values for varying rationals and varying rational values for varying irrationals? I could not proceed further.

Any hint or help will be appreciated.

• See this. – David Mitra Sep 7 '14 at 14:57

## 1 Answer

Hint: If such continuous function existed, it couldn't be constant function, and by intermediate value theorem it would have to assume every irrational value on some open interval.

There are quite many irrationals.

• Thank you for the comment. Would you suggest me to think on this line? Because even after, I don't see any hope. Particularly, would you mind explaining how "There are quite many irrationals" will help me? – Landon Carter Sep 7 '14 at 14:51
• Well, there are uncountably many irrationals but only countably many rationals – gtrrebel Sep 7 '14 at 14:54
• You can use a proof by contradiction, by the reasons stated here, the function would be a map from the rationals to the irrationals. This requires them to be of equal cardinality and the rationals are proved to have a smaller cardinality than the irrationals by cantor's diagonal argument – Alice Ryhl Sep 7 '14 at 14:57