Can we construct a function that is continuous at each rational point and discontinuous at uncountably many irrational points?

Some functions on $$\mathbb{R}$$ are continuous at every irrational and discontinuous at every rational, but there aren't any functions that are continuous at every rational and discontinuous at every irrational. Additionally, it is easy to come up with a function that is continuous at every rational and discontinuous at countably many irrationals. Now, I am wondering if there are any functions from $$\mathbb{R}$$ to $$\mathbb{R}$$ that are continuous at every rational point, but discontinuous at uncountably many irrational points. If so, could you give me some examples?

• no you can't since the rationals are not a $G_\delta$ set or rather it's not the intersection of countably many open sets.
– MIO
Mar 15, 2021 at 20:53
• Yes, you can. Let $K$ be a compact of positive measure which is a subset of $\mathbb{R}\backslash \mathbb{Q}$. Then consider the indicator function $f$ of $\mathbb{R}\backslash K$. As $K$ has empty interior, $f$ is discontinuous precisely at the points of $K$, which are all irrational and uncountably many. Mar 15, 2021 at 21:45
• @aldodecristo The question doesn't require the set of points of continuity to be exactly $\mathbb{Q}$, just to contain $\mathbb{Q}$ and miss uncountably many irrationals. Mar 15, 2021 at 23:00

I’m turning my comment into an answer. We know that, as $$\mathbb{Q}$$ has measure zero, there is an open subset $$U \subset \mathbb{R}$$ with arbitrary small measure containing $$\mathbb{Q}$$. We just assume that the Lebesgue measure of $$U$$ is finite.
Let $$f$$ be the indicator of $$U$$. Clearly, $$f$$ is continuous at any point in $$U$$. Since $$U$$ is dense, $$f$$ cannot be continuous at any point outside $$U$$, so the set of discontinuities of $$f$$ is $$\mathbb{R} \backslash U$$ m, which contains only irrationals and has infinite Lebesgue measure (and in particular is uncountable).