Find a function f:R->R (R the set of real numbers), such that

1. f has a discontinuity in every rational number, but is continous everywhere else, and

2. f is monotonic: x<y → f(x)<f(y)

Note: Textbooks frequently present examples of functions that meet only the first condition; requiring monotonicity makes for a slightly more challenging problem.

(In reply to

Bigger hint by JLo)

JLo:

Thanks, that's a huge hint, and a very wierd function.

I observe that every rational number has two decimal values in binary notation. For instance, 1/4 =

.010000000000... and .0011111111111...

In order for the function to be unambiguously well-defined, let's
define it to always use the decimal expansion which ends in zeroes.
Then f(1/4) = 1/9.

But I notice that the left limit and the right limit are different, and that the function is therefore discontinuous at 1/4.

From the right, the limit = .01 (base 3) = 1/9

From the left, the limit = .00111111111.. (base 3) = 1/6

In fact, the function is discontinuous (and has a jump) for every rational except 0 (which has only one binary representation).

And it is continuous for every irrational number (because they have only one binary representation).

And the function is strictly monotonic increasing, so JLo's function
(as defined to remove ambiguity) satisfies his two conditions on any
domain which does not contain zero as an interior point.

Very interesting puzzle, JLo! Thanks!

So, how do we fix up the problem at zero? Once again, nothing occurs
to me. In order to preserve monoticity, the function value must be
between the left and right limits. No matter what base we choose, zero
only has one representation in that base. So any function that uses
this approach will have a left limit at zero which is equal to the
right limit, and will be continuous if it is monotonic.

I think we should just redefine the original problem to have a domain equal to the Positive Real Numbers! :-)