# Thread: Function Continuous on Rationals but not on Rationals

1. ## Function Continuous on Rationals but not on Rationals

So we all know of a function that's continuous on the irrationals but discontinuous on the rationals, but what about this:

Are there functions $\displaystyle f : [0, 1] \rightarrow \mathbb{R}$
continuous on $\displaystyle \mathbb{Q}$ and discontinuous on $\displaystyle \mathbb{R} \backslash \mathbb{Q}$? Justify.

I'm quite sure the answer's no, but not entirely sure on how to prove it.

Any help would be much appreciated, thanks!

2. Originally Posted by h2osprey
So we all know of a function that's continuous on the irrationals but discontinuous on the rationals, but what about this:

Are there functions $\displaystyle f : [0, 1] \rightarrow \mathbb{R}$
continuous on $\displaystyle \mathbb{Q}$ and discontinuous on $\displaystyle \mathbb{R} \backslash \mathbb{Q}$? Justify.

I'm quite sure the answer's no, but not entirely sure on how to prove it.

Any help would be much appreciated, thanks!
Consider $\displaystyle f: [0,1] \to \mathbb{R}$ defined by $\displaystyle f(x) = \begin{cases} 0 \ \ \text{if} \ x \ \text{is irrational} \\ \frac{1}{n} \ \ \text{if} \ x \in \mathbb{Q} \ \text{and} \ x = \frac{m}{n} \ \text{in lowest terms} \end{cases}$

This is continuous on the irrationals and discontinuous on the rationals. You can find a sequence $\displaystyle (a_n)$ such that $\displaystyle a_n \to x$ but $\displaystyle f(a_n) \not \to f(x)$ where $\displaystyle x \in \mathbb{Q}$.

3. The answer is no.

There is a theorem that states the points where a function f is continuous is a $\displaystyle G_{\delta}$ set.
A $\displaystyle G_{\delta}$ set, is a set that is the countable intersection of open sets. So the irrations can be written as $\displaystyle \bigcap Q_n$, where $\displaystyle Q_n=\mathbb{R}\backslash q_n$, with $\displaystyle \{q_n\}$ being an enumeration of the rationals.

I'll leave it to you to show that $\displaystyle \mathbb{Q}$ isn't a $\displaystyle G_{\delta}$ set.

4. Originally Posted by Sampras
Consider $\displaystyle f: [0,1] \to \mathbb{R}$ defined by $\displaystyle f(x) = \begin{cases} 0 \ \ \text{if} \ x \ \text{is irrational} \\ \frac{1}{n} \ \ \text{if} \ x \in \mathbb{Q} \ \text{and} \ x = \frac{m}{n} \ \text{in lowest terms} \end{cases}$

This is continuous on the irrationals and discontinuous on the rationals. You can find a sequence $\displaystyle (a_n)$ such that $\displaystyle a_n \to x$ but $\displaystyle f(a_n) \not \to f(x)$ where $\displaystyle x \in \mathbb{Q}$.
Also the function in this example is continuous at x=0, which is a rational so it doesn't satisfy the necessary condition.

5. Originally Posted by putnam120
Also the function in this example is continuous at x=0, which is a rational so it doesn't satisfy the necessary condition.
Let $\displaystyle a_n = \frac{\sqrt{2}}{n}$. Then $\displaystyle a_n \to 0$. And $\displaystyle f(a_n) \to 0$. But $\displaystyle f(0) \neq 0$. Because $\displaystyle 0 = \frac{0}{1} = \frac{0}{2} = \cdots = \frac{0}{n}$ for $\displaystyle n \neq 0$.

And if you fix $\displaystyle t \in \mathbb{R}$ and $\displaystyle n \in \mathbb{N}$ you can show that $\displaystyle f$ maps finitely many elements of $\displaystyle \left(t- \frac{1}{2}, t+ \frac{1}{2} \right)$ to $\displaystyle \frac{1}{n}$. And we can use this to prove that $\displaystyle f$ is continuous at every irrational number.

6. Oops, thanks for the clarification. However, I still stand by the fact that the function isn't what he is asking about. What he wants a function that is continuous on $\displaystyle \mathbb{Q}$ and discontinuous everywhere else. (The example you gave is not continuous at the $\displaystyle x=0$ so right there it fails)

7. But $\displaystyle 0$ is rational! And he edited his question. Before it was the other way around.

8. Ah sorry, didn't know that he had changed the question.

9. Originally Posted by Sampras
But $\displaystyle 0$ is rational! And he edited his question. Before it was the other way around.
Actually, I edited it to change the Latex which was showing an error, otherwise it's unchanged. I do know about the function continuous on irrationals but discontinuous on rationals - and the title's a typo sorry.

Thanks anyway!

10. I'll leave it to you to show that isn't a set.
Can you show me how to do this? I haven't encountered these before and I would like to see what they're like!

11. Originally Posted by Showcase_22
Can you show me how to do this? I haven't encountered these before and I would like to see what they're like!
Once you've shown that the irrationals are a G-delta set, you can prove by contradiction.

Assume the the rationals are a G-delta set (say an intersection of countably many$\displaystyle A_n$. Since the rationals are dense in the reals, each $\displaystyle A_n$ is dense in the reals. Applying the same argument to the irrationals, we get that the intersection of the rationals and the irrationals (which is $\displaystyle \emptyset$) is a countable intersection of open dense sets. This violates the Baire category theorem, which states that any such intersection is non-empty (since the reals are complete).

And this completes the proof!

12. Once you've shown that the irrationals are a G-delta set, you can prove by contradiction.
How do you do that part?

(sorry but i'm a first year maths student and i've only encountered these 5 mins ago when I read this post! However, they sound really interesting. Plus, I tihnk I may be able to use them to help me with some continuity proofs that i'm not super happy with).

13. putnam120 mentioned it earlier:

Originally Posted by putnam120
The answer is no.

There is a theorem that states the points where a function f is continuous is a $\displaystyle G_{\delta}$ set.
A $\displaystyle G_{\delta}$ set, is a set that is the countable intersection of open sets. So the irrations can be written as $\displaystyle \bigcap Q_n$, where $\displaystyle Q_n=\mathbb{R}\backslash q_n$, with $\displaystyle \{q_n\}$ being an enumeration of the rationals.

I'll leave it to you to show that $\displaystyle \mathbb{Q}$ isn't a $\displaystyle G_{\delta}$ set.
Hope this helps!