The reverse of the Intermediate Value Theorem

So, I was just teaching some calc students about the Intermediate Value Theorem: If a function is continuous, then for any a and b, and for every value in between f(a) and f(b), there’s some x in between a and b such that f(x) equals that value.

Now, I won’t go this deep into the weeds with high schoolers, but as I was talking about, I was wondering: Is the reverse true? That is to say: If I have some function such that, for any a and b, and for every value between f(a) and f(b) there is some x in between a and b such that f(x) equals that value, does all of that prove that the function must be continuous? Or is there some weird pathological function that meets those conditions, but fails to be continuous?

I know it can’t be anything as simple as jump discontinuities, because then, you could just pick an a and b very close to the jump, so there’s a gap in the range. But there are more things in Heaven and Earth than are dreamt of in piecewise functions.

Just make the function sufficiently wiggly, e.g., sin(1/x) for x≠0, 0 if x=0. For the weird pathological version, try Conway’s function. has a couple of examples

ETA - the examples provided above by someone faster than me

If a function is differentiable in an open interval, the derivative function need not be continuous, but it does always satisfy the IVT in that interval.


I don’t know if I’m fast; those are just standard textbook examples (certainly the first one, anyway). If you look in those real analysis textbooks you can find many related theorems in this vein: for instance, Darboux’s theorem that states the derivative of a differentiable function satisfies the conclusion of the intermediate-value theorem (so no jump discontinuities or anything like that), as already mentioned by a couple of people, and also the characterization of the possible points of discontinuity of the derivative as any meagre F[sub]σ[/sub] set (so there are some limitations on the set, but it can still be discontinuous at a whole bunch of points).

You remembered the standard examples fast, anyway. Back when I took classes in this kind of math, I might have remembered them that quickly too (but that was 30 years ago).

Trying to remember calculus from 40 years ago… A line with a corner is continuous, satisfies the IVT, but does not have a continuous derivative. (i.e. y=abs(x) ?)

You can construct a function that satisfies the IVT but is not continuous, Y=X for X>0, Y=X+1 for X<=0 but to me that’s cheating.

I don’t think this function satisfies the IVT. For a = -.1, and b=.1 f(a)=-.1 and f(b)=1.1.

0.25 is between f(a) and f(b), but there’s no x between a and b for which f(x) = 0.25 (unless I’m picturing this wrong).

In fact, every continuous function satisfies the Intermediate Value property; that may be worth remembering.

As for your proposed function, it will not have a derivative at the corner. (It will be differentiable everywhere else, of course.)

That’s what people mean by a “jump”. Anyway, you have to do something to construct an example; it’s not enough to consider a piecewise monotonic function, for instance.

Of course-- I should have thought of sin(1/x) (with the hole at the origin filled). That example came up as an example of a function that doesn’t even have a one-sided limit, and again in showing that a squeezed variant of it (such as x*sin(1/x)) nevertheless does.

Yes, I thought of “divide by zero” functions; but defining a second value/function for case x=0 is not any different, really, from defining a two-step function like a line with a corner. Otherwise, it’s discontinuous.

So as I understand it, the OP is asking if there are functions, not constructed from pieces, where there is a jump without a singularity at the jump point?

Sort of like y= ((2x+1)/(abs(x+1)+abs(x))) or something similar that never divides by zero?

I mean, by definition, if there is no jump point it is continuous unless it is fractal; but then a fractal line by definition is continuous too? The more you zoom in, the more the continuity is visible; it’s just dense, like sin(1/x)

OK, I’ve thought about some of these answers more, and I can’t come up with any example of an everywhere-differentiable function whose derivative is not continuous.

Just modify the example and make it x[sup]2[/sup] sin 1/x for instance.

But x^2*sin(1/x) is continuous.

Sure, but not its derivative.

d/dx ( x^2sin(1/x) ) = -cos(1/x)sin(1/x) + 2xsin(1/x) , unless I messed up the math. Which is continuous everywhere except at x=0, and the continuity at x=0 fails by virtue of it not existing there. In other words, x^2sin(1/x) is not everywhere differentiable, because it’s not differentiable at x=0.

Yes, there is a mistake there; it matters a little bit since we care what the derivative is. If you differentiate x^2 sin(1/x) you get 2 x sin(1/x) - cos(1/x), unless x = 0. At x = 0 you may as well calculate the value of the derivative directly from the usual definition, which gives lim[sub]x->0[/sub]x sin(1/x) = 0.

Therefore, the original function x^2 sin(1/x), completed at 0, is indeed differentiable at every real number as claimed. Now 2 x sin(1/x) - cos(1/x) does not tend to a limit as x goes to 0, so the derivative cannot be continuous there, even though it is defined.