6
$\begingroup$

My teacher showed us this function and told us it was continuous at all non-$\mathbb{Q}$ points:

$ f(x) = \begin{cases} x & \text{ if } x\in\mathbb{Q} \\\\ 0 & \text{ if }x\notin\mathbb{Q} \end{cases} $

However, Wolfram MathWorld says the Dirichlet function, which is very similar, is discontinuous at all points. Why is one continuous and the other not?

  • 1
    The function your teacher showed you is not continuous at all irrationals (nor is it discontinuous at all rationals). It is, however, a nice example of a function which is continuous only at a single point (namely 0).2011-09-06

3 Answers 3

8

As other answers have Henning's answer has explained already, your teacher is wrong. However, my guess is that s/he was confusing your function with this related one: $ f(x) = \begin{cases} 0, &\text{ if $x$ is irrational}, \\\\ 1/b, &\text{ if $x = a/b$ with $\gcd(a,b)=1$}. \end{cases} $ This function does have the property that it is continuous at all irrational points, and discontinuous at the rationals.

Source: Look at the "modified Dirichlet function" $D_M(x)$ in the Mathworld article on the Dirichlet function.

Edit: It turns out that @lhf posted the same answer independently, but he links to the Wikipedia page of the function: click here.

Terminology: I just learned1 that this function is usually called Thomae's function, and not the modified Dirichlet function. I have known this example for some time, but not by any specific name. Wikipedia lists a number of other interesting names as well: the Riemann function, the popcorn function, the Stars over Babylon, the raindrop function, and the ruler function.


1In the post what functions or classes of functions are Riemann non-integrable but Lebesgue integrable, Hans Lundmark's comment (under Jonas Meyer's answer) gives the name of the function and the wikipedia link. Thanks to Theo Buehler for sharing the post.

  • 0
    That's a very nice answer now! However, I don't really deserve any credit, but rather Hans Lundmark, see the comment thread to Jonas's answer [here](http://math.stackexchange.com/questions/18388).2011-09-06
5

Your teacher is wrong. Every neighborhood of any real number contains both rational and non-rational points, so the function is continuous at 0 only.

More specifically, let $\alpha$ be a positive irrational number (in particular $\alpha\ne0$, and the argument for negative irrationals is almost the same). Let's check whether $f$ is continuous at $\alpha$. For this to hold, then for every $\epsilon>0$ there must be a $\delta$ such that $ |x-\alpha|<\delta \Rightarrow |f(x)-f(\alpha)|<\epsilon $ Since $f(\alpha)=0$, the right-hand side of this is equivalent to $|f(x)|<\epsilon$.

As I'm going to prove that $f$ is not continuous at $\alpha$, I have the right to select $\epsilon$, and then I must prove that there's no $\delta$ that works for it. I choose $\epsilon=\alpha/2$. Now, for every possible positive $\delta$, the interval $(\alpha, \alpha+\delta)$ is open and therefore contains at least one rational number, which we can call $R$. Then, setting $x=R$ we get $|R-\alpha|<\delta$ (by construction), but $|f(R)|=R>\alpha$ is certainly larger than $\epsilon$, which was $\alpha/2$. Thus, $\delta$ fails to work, as promised.

  • 0
    You are right, I do not think they do sequential continuity in the elementary calculus classes. I just pointed it out for completeness sake; I am not claiming any one way is easier than the other.2011-09-06
5

Perhaps your teacher meant Thomae's function, which is continuous at all irrational numbers and discontinuous at all rational numbers.