I think the following piecewise function satisfies the two criteria: when x is rational: f(x)=x
when x is irrational: f(x)=x*, where x* is the largest rational number smaller than x.
I think not. When x is irrational, there is no largest rational number less than x. No matter what rational number you pick, there is a larger one that is less than x. For example, between 3.1415926 and pi, there is 3.14159265.
The usual answer is the one given by Weierstrass, which is the sum of an infinite series of functions. The first term in the series is a periodic sawtooth (piecewise linear) function, which is = x from x=0 to x=1, and then descends back to 0 between x=1 and x=2 (i.e., it is = -x+2 in that interval). It repeats that pattern between x=2 and x=4, and so on. The second term is just like it, but with 1/10 the frequency and 1/10 the amplitude, and so on. The first function is continuous everywhere and differentiable except at x= an integer. The sum of the first 2 is continuous everywhere and differentiable except for the multiples of 1/10, and so on. It turns out that the series converges to a function that is continuous everywhere and differentiable nowhere.
By the way, if you can take the derivative of a function at a given point, it is said to be differentiable, not derivable at that point.
Chat with our AI personalities