TITLE: Prove that if a continuous function is injective, then it is monotonic
QUESTION [9 upvotes]: It is intuitive and it seems very obvious that if a function $f : X \rightarrow Y$ is continuous on whole $X$ and it's injective, then it must be monotonic, but I can't come up with any neat proof for that. Could you maybe help me?

REPLY [3 votes]: I assumed that $X$ and $Y$ are parts of $\mathbb{R}$. 
If $X$ is not connected, Hagen von Eitzen gave a counterexample; otherwise, you can use the intermediate value theorem to prove the statement.