# The converse of a corollary to the intermediate value theorem

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?

-
A single point is an interval, albeit degenerate. – lhf Dec 18 '13 at 1:45

The conclusion is not true even if $f$ is one to one. Consider the function on $[-1,1]$ defined by $f(x) = x$ for $x \not=-1,0,1$, and $f(-1) = 0, f(0) = 1, f(1)=-1$. Then this function is not continuous, but is one to one and the range $f(I)$ is the interval $[-1,1]$.

-

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.)

-

Here is one converse:

If $f$ is monotone and $f(I)$ is an interval, then $f$ is continuous.

-

No to both! Define $f:[0,1]\rightarrow \Bbb{R}$, $f(x)=x$ for $x\in [0,\frac{1}{2})$, and $f(x)=\frac{3}{2}-x$ for $x\in[\frac{1}{2},1]$. $f$ is injective and $f([0,1])$ is an interval, but $f$ is not continuous.

-
I am not quite sure whether the function is continuous. Would you mind explaining why? – user97554 Dec 18 '13 at 1:52
The function is not continuous at $x=\frac{1}{2}$. $\lim_{x\rightarrow\frac{1}{2}^-}f(x)=1/2$, but $\lim_{x\rightarrow\frac{1}{2}^+}f(x)=1$. – Nick D. Dec 18 '13 at 1:54
O I see. I misread. – user97554 Dec 18 '13 at 1:59