************************************************
First solution (my original idea):
As is generally known, the set of all rational numbers Q is countable, so say Q={r1, r2,...}. Now define f as follows:
f(x) = sum 2-i, where we sum over all i such that ri<x
Obviously f is monotonic. It also has a jump discontinuity 2-i at every rational number ri. To see that it is continuous at every irrational number a, we have to find for every d>0 an e>0 such that from |x-a| < e follows |f(x)-f(a)|<d for all x. Let's do this:
First choose k such that sum 2-i (summing over all i with i>k) is smaller than delta. Now choose epsilon small enough, such that no rational number rj with j<=k is in the epsilon interval around a. Now |f(x)-f(a)| = sum 2-i (sum going over i such that a<=ri<x) < sum 2-i (sum going over i such that i>k) < d
Obviously the same approach works not only for the rational numbers, but for any countable infinite set of numbers. One can even prescribe arbitray jumps - we have chosen jumps 2-i - just as long as their sum converges in order to end up with something well-defined. Another choice of jumps that would work is e.g. the set of numbers p-2 with primes p.
Finally note that f(x) can be written as the infinite weighted sum of functions fr, where f(x)=0 for x<r and f(x)=1 otherwise: f(x) = sum 2-i fri, i.e. the desired function can be obtained by merely adding up the simplest monotonic functions one can think of.
************************************************
Second solution (See Ken's and Steve's postings):
Ken found a wonderful monotonic mapping from ]0,1] which is discontinous in exactly the rationals by using egyptian fractions . I like this solution better than the one above, because it does not rely on a rather arbitrary counting of the rational numbers; it is somewhat more natural, except maybe for the fact that one has to pick an arbitrary base for the positional number system (binary, decimal,...). Stitching this solution up to cover the domain of all real numbers is a simple exercise.
************************************************
Can we have more than "only" a countable set of discontinuities?
It is a known fact that no monotonic function can have jumps on a non-countable set of numbers. The summation of a non-countable number of jumps would immediately make the whole thing infinite, so to speak... Not that this is a rigorous proof, but the correct proof follows this idea. It is not too tough if you want to give it a try.
By the way, the "w-function" that is mentioned in the postings is nothing but the inverse of the famous Cantor Function . (OK, maybe only kind-of-inverse...) I found it would be a useful example to study because it provides a first example of a function which solves the problem on a dense subset of all real numbers, namely the set of all numbers with finite binary representation.
|