Question 13b of chapter 7 in Spivak's Calculus (which I've been slowly working through over the last few months) says this:
'Suppose that f satisfies the conclusion of the Intermediate Value Theorem, and that f takes on each value only once. Prove that f is continuous.'
What I think he means by this is that if, for some $f$ defined on [a,b] and for all $u$, if $f(a)\leq u \leq f(b)$, then there is one and only one $c$ in $[a,b]$ such that $f(c) = u$. If this is true then $f$ is continuous.
I spent a few minutes trying to prove this, but in the end created a 'counterexample'. Right now I'm just wondering where I've gone wrong...
$ f(x) = \begin{cases} x+\frac{1}{2} & \text{if } 0 \leq x \leq\frac{1}{2} \\ 1-x & \text{if } \frac{1}{2} < x \leq 1 \end{cases} $
$f$ is not continuous on $[0,1]$ but the IVT definitely holds over this interval and, furthermore, there's a 1-1 correspondence between $x$ values and $f(x)$ values over this interval.
Where have I gone wrong???
Thanks