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?

$\endgroup$
  • $\begingroup$ On the other hand, the second function listed on that MathWorld page is a good example of a function continuous at each irrational and discontinuous at the rationals. It's harder to prove that the reverse situation cannot occur. $\endgroup$ – Dylan Moreland Sep 6 '11 at 1:03
  • 1
    $\begingroup$ Here's an article for those interested in (but not familiar with) @Dylan's statement: maa.org/mathdl/MM/0025570x.di021166.02p0055m.pdf $\endgroup$ – Tyler Sep 6 '11 at 1:11
  • 1
    $\begingroup$ Please. Read this: Wikipedia:Manual of Style/Mathematics/Why you should never use \mbox within Wikipedia This does not apply ONLY to Wikipedia. $\endgroup$ – Michael Hardy Sep 6 '11 at 1:27
  • 1
    $\begingroup$ 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). $\endgroup$ – Ilmari Karonen Sep 6 '11 at 10:59
8
$\begingroup$

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.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ 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. $\endgroup$ – t.b. Sep 6 '11 at 1:47
5
$\begingroup$

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.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Another way is to use the fact that a function $f$ is continuous at $x$ iff for all sequences $x_n \to x$, the sequence $f(x_n) \to f(x)$. Any $x$ can be approached by both rational and irrational sequences $x_n$; the corresponding limits of $f(x_n)$ then are equal to $x$ and $0$ respectively. For continuity, we require $x = 0$. $\endgroup$ – Srivatsan Sep 6 '11 at 1:08
  • 1
    $\begingroup$ That works, too -- but for the purpose of convincing an errant teacher to mend his ways, I think it is useful to go as close to the definitions as practically possible. (I think epsilon-delta definitions are more common at the elementary calculus level than sequential continuity, but I may be wrong in the instant case, of course). $\endgroup$ – hmakholm left over Monica Sep 6 '11 at 1:31
  • $\begingroup$ 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. $\endgroup$ – Srivatsan Sep 6 '11 at 1:39
5
$\begingroup$

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

| cite | improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.