All about flooble | fun stuff | Get a free chatterbox | Free JavaScript | Avatars
 perplexus dot info

 Weird function challenge (Posted on 2006-08-15)
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.

 See The Solution Submitted by JLo Rating: 4.3000 (10 votes)

Comments: ( Back to comment list | You must be logged in to post comments.)
 Possible solution? | Comment 22 of 33 |

I have an idea.. but I'm not sure it works.  Shoot holes in it if you can...

There is a theorem that says every rational number between 0 and 1 is representable by the sum of a finite number of distinct unit fractions.  Although the choice of fractions for any given rational number isn't necessarily unique (e.g. 47/60 = 1/2 + 1/4 + 1/30 but it also = 1/3 + 1/4 + 1/5), we can use the "greedy algorithm" to get a unique representation for each rational. The greedy algorithm always chooses that largest possible unit fraction less than the number, subtracts it, and repeats until the remainder is 0.  (47/60 would be 1/2 + 1/4 + 1/30 in this case.)  I just read a proof that the greedy algorithm will terminate for any rational number.

Suppose we represent this unit-fraction representation using the greedy algorithm with a decimal point followed by a series of 1's and 0's that correspond to 1/2, 1/3, 1/4, 1/5, etc.  For example 2/3 = 1/2 + 1/6.  So it would be written as 0.10001 (followed by an infinite number of zeros).

For irrational numbers, obtain a similar sequence by applying the greedy algorithm in a similar, but non-ending, fashion.

For numbers outside the range 0 to 1, just prepend the integer portion before the decimal point.

Now, interpreting these numbers as ternary numbers, we should be able to do the same trick that we did with the w function, right?  That is, show that the function is discontinuous for all rationals, but continuous for the irrationals.

And it looks like the function is monotonic, right?

Does that do it??  It seems like it does, but I wouldn't necessarily call it "simple," as JLo claims the solution is.

Edited on August 31, 2006, 12:30 am
 Posted by Ken Haley on 2006-08-22 00:44:13

 Search: Search body:
Forums (0)