0

I was just wondering if it's possible for a function $f$ to not be continuous when it's domain is $\mathbb{R}$, but continuous in let's say $\mathbb{Q}$. If so - what would be the reasoning behind this?

1 Answers1

1

Yes, in fact the Dirichlet function

$$f \colon \mathbb{R} \to \{0,1\},\ \ f(x)=\begin{cases} 1, & \text{if }x\text{ rational,}\\ 0, & \text{if }x\text{ irrational.} \end{cases}$$

provides a famous example of a function which is discontinuous on its domain $\mathbb{R}$ but continuous when restricted to $\mathbb{Q}$.

The reasoning behind this is the following: When you have a continous function on $\mathbb{Q}$ there is at most one way to extend it to a continuous function on $\mathbb{R}$, as we know from the characterization of continuous functions via the convergence of sequences: For any irrational number $x$, we can define a sequence $(x_n)_{n\in\mathbb{N}}$ with members in $\mathbb{Q}$ that converges to $x$ (seen as a sequence in $\mathbb{R}$). Now if the function can be extended to a continuous function on $\mathbb{R}$, then this requires that the sequence $(f(x_n))_{n\in\mathbb{N}}$ converges to $f(x)$, i.e. the limes $\lim_{n\to\infty}f(x_n)$ must exist and be equal to $f(x)$, so that in this case $f(x)$ is uniquely determined (for any irrational number $x$). This extension is not always possible, since for instance $f(x)=\frac{1}{x-\sqrt{2}}$ is continuous on $\mathbb{Q}$ but cannot be extended to a function on $\mathbb{R}$ that is continuous at $\sqrt{2}$ (I took this example from here).

In summary, if a function $f$ that is continuous on $\mathbb{Q}$ can be extended to a continuous function on $\mathbb{R}$, then the extension is uniquely determined. Note that the set of irrational numbers is (uncountably) infinite, so of course there is far more possible extensions for $f$ to a function on $\mathbb{R}$ that is not continuous.

For another easy way to construct such a function, take any continuous function on $\mathbb{R}$ and change its value at an irrational number. The result will be a function that is continuous when restricted to $\mathbb{Q}$ but not on $\mathbb{R}$.

lattice
  • 805
  • I edited my post and added an explanation on the reasoning behind this (i.e. why such functions exist), which helps more than just some example function, I hope. – lattice Jun 04 '16 at 15:37
  • But would it be the same case for a function such as f(x) = 1 if x < c and f(x) =0 > c, if c is an irrational number and the function's domain is Q? Is that what the statement in your last paragraph means? – geomquestion Jun 04 '16 at 21:36
  • You are welcome! That function cannot be extended to a continuous function on $\mathbb{R}$, since there will be a so called jump at $c$, no matter how you define $f(c)$. This means, the one-sided limits at $c$ would both exist but not be equal. Check here for more on the classification of discontinuities of functions. – lattice Jun 05 '16 at 06:07
  • My last paragraph meant to change the value of a continuous function on $\mathbb{R}$ only at a single irrational point. For example, take $f(x)=0$ which is continuous on $\mathbb{R}$ and now define a function $g$ by $g(x)=f(x)$ for $x\neq\sqrt{2}$ and $g(\sqrt{2})=1$. Then $g$ differs from $f$ only at one irrational point, so $g$ is continuous when restricted to $\mathbb{Q}$ but not on $\mathbb{R}$. – lattice Jun 05 '16 at 06:09
  • Thanks a lot! Would still be continuous in $\mathbb{Q}$ if it had different values on both sides of $\sqrt{2}$? Or would this still be considered as a "jump"/ – geomquestion Jun 05 '16 at 18:35
  • Hmm this is confusing me a bit, but that function should still be continuous. For any rational number $q\in\mathbb{Q}$ you can find an $\epsilon > 0$ such that the open ball $B_\epsilon(q)={p\in\mathbb{Q}|d(p,q)<\epsilon}$ contains rational numbers that are all on the same side of $\sqrt{2}$ (i.e. all are either smaller or larger than $\sqrt{2}$). Now use the epsilon-delta characterization of continuous functions to conclude that a jump at a irrational number does not cause a problem for continuity. – lattice Jun 06 '16 at 06:44
  • But I find this an interesting question! Maybe you should ask it in another thread to get better answers! If such jumps are possible, then how can continuous functions on $\mathbb{Q}$ be characterized? – lattice Jun 06 '16 at 06:48