[Math] The converse of a corollary to the intermediate value theorem

continuityreal-analysis

A corollary to the Intermediate Value Theorem is that if $f(x)$ is a continuous real-valued function on an interval $I$, then the set $f(I)$ is also an interval or a single point.

Is the converse true? Suppose $f(x)$ is defined on an interval $I$ and that $f(I)$ is an interval. Is $f(x)$ continuous on $I$?

Would the answer change if $f(x)$ is one-to-one?

Best Answer

Here is a bad counterexample: Conway's base-$13$ function takes all values on any (non-degenerate) interval. (This is stronger than just asking that $f(I)$ is an interval: You get that $f(J)$ is an interval for all intervals $J$. Note that requiring this removes the counterexamples offered in the other answers.)

Related Question