I have a homework problem where I need to prove that a continuous function $f:\mathbb R\to \mathbb R$ is injective if and only if it has no extrema (local or global).
So far what I have is:
We'll assume that $f$ is injective and assume that it has an extrema, $(x_{0}, f(x_{0}))$. Since $x_0$ is an extrema, there is a neighborhood of $x_0$ such that for each $x$ in the neighborhood, $f(x)\leq f(x_0)$ or $f(x)\geq f(x_0)$. This is where I got stuck. Intuitively I understand that that on each side of $x_0$, there have to be two points whose values are the same, which contradicts the assumption that $f$ is injective - I'm having extreme difficulty proving it, though.
If we assume that $f$ has no extrema, then I've tried to show that it is also a strictly monotonic function, but I'm having difficulty proving this as well.
I'd appreciate any help.