next up previous
Next: A continuousnowhere differentiable Up: First semester calculus Previous: A function with a

A function continuous at all irrationals, discontinuous at all rationals.

Define f(x) by tex2html_wrap_inline263 if tex2html_wrap_inline265 is a rational number expressed in lowest terms, and f(x)=0 for irrational x. (I've sometimes heard this called the ``ruler'' function, since its graph vaguely resembles the markings on a ruler.) Then f has the surprising property that it is continuous at all irrationals and discontinuous at all rationals. It's easy to believe that f is discontinuous at all rationals, since for a rational number tex2html_wrap_inline265 , there are irrational numbers x arbitrarily close to tex2html_wrap_inline265 , but f(x)=0 is not getting close to tex2html_wrap_inline263 .

It's a bit harder to see that f is continuous at any irrational x. Roughly speaking, there's no way that rational numbers can approach an irrational number x without their denominators going to infinity, so that f approaches 0. More formally, take any tex2html_wrap_inline293 . There is an integer q with tex2html_wrap_inline297 . Look at all the rational numbers of the form tex2html_wrap_inline299 . Since x is irrational, it is not one of these numbers. Because of the way the numbers tex2html_wrap_inline299 , p=0, tex2html_wrap_inline307 , tex2html_wrap_inline309 , tex2html_wrap_inline311 appear on the number line, there is a closest number in this set to x (a careful proof of this fact uses properties of the integers). Take tex2html_wrap_inline315 to be smaller than the distance from x to the closest number of the form tex2html_wrap_inline299 . Then no rational number within tex2html_wrap_inline321 of x may be written as a fraction with denominator less than or equal to q, so all numbers with tex2html_wrap_inline321 of x must have their function values within tex2html_wrap_inline331 of f(x), so f is continuous at any irrational x.

Tom Vogel
Mon May 5 12:53:33 CDT 1997