[Math] If $f:I\to\mathbb{R}$ is $1{-}1$ and continuous, then $f$ is strictly monotone on $I$.

real-analysis

Suppose that $I\subseteq\mathbb{R}$ is nonempty. If $f:I\to\mathbb{R}$ is $1{-}1$ and continuous, then $f$ is strictly monotone on $I$.

The answer in the back of the book$^1$, which I found after writing the following proof, says this is false (no explanation). However, I cannot find an error in my proof or think of a viable counterexample. What am I overlooking?

Suppose not, and there exists some $x_1,x_2,x_3\in I$ with $x_1<x_2<x_3$ such that $f(x_1)\leq f(x_2)$ and $f(x_2)\geq f(x_3)$, or $f(x_1)\geq f(x_2)$ and $f(x_2)\leq f(x_3)$. Without loss of generality, we may assume that $f(x_1)\leq f(x_2)$ and $f(x_2)\geq f(x_3)$.

If $f(x_1)=f(x_2)$ or $f(x_2)=f(x_3)$ then $f$ would not be $1{-}1$; thus, $f(x_1)<f(x_2)$ and $f(x_2)>f(x_3)$. We are left with two possible cases.

Case 1. Suppose $f(x_1)<f(x_3)$. Then $f(x_1)<f(x_3)<f(x_2)$. By the Intermediate Value Theorem, there exists point $x_0\in (x_1, x_2)$ such that $f(x_0)=f(x_3)$ with $x_0\neq x_3$ since $x_3\notin (x_1,x_2)$, a contradiction since $f$ is $1{-}1$.

Case 2. Suppose $f(x_1)>f(x_3)$. Then $f(x_3)<f(x_1)<f(x_2)$. By the Intermediate Value Theorem, there exists point $x_0\in (x_2,x_3)$ such that $f(x_0)=f(x_1)$ with $x_0\neq x_1$ since $x_1\notin (x_2,x_3)$, a contradiction since $f$ is $1{-}1$.

If we assume that $f(x_1)\geq f(x_2)$ and $f(x_2)\leq f(x_3)$ we are lead to similar contradictions; thus, $f$ is strictly monotone. $\blacksquare$

1: An Introduction to Analysis by William R. Wade, 4th edition

Best Answer

The trick in the text of this exercise that $I$ is not assumed to be an interval. Your proof is valid on an interval.

But, for example, let $I:=[0,1]\cup[2,3]$ and let $f(x):=\left\{\matrix{x,\ \text{ if }\,x\le 1\\5-x,\ \text{if }\, x\ge 2} \right.$.