Q: A continuous, injective function $f:R→R$ is either strictly increasing or strictly decreasing. I saw this answer on this website in response to this question:
A continuous, injective function  $f:R→R$  is either strictly increasing or strictly decreasing.

Consider $g\colon \{(x,y)\mid x<y\}\mapsto\mathbb R$, defined by
  $g(x,y):=f(x)-f(y)$. Clearly $g$ is continuous.  Since the domain of
  $g$ is connected and $g$ has no zeroes, the image of $g$ is an
  interval not containing $0$.

I can see $g$ is continuous. I can see why domain is connected. I can also see why $g$ has no zeros. 
And since continuous image of a connected set is connected, image of $g$ is a connected set. Now connected set in $\mathbb{R}$ is either interval or singleton(not possible). 
So image of $g$ is an interval not containing zero.
But, how can I conclude that $f$ is monotonic?
Thanks for the help.
