If $f(x)$ is differentiable on the interval I, and $f'(x)\neq0$ for all $x\in I$, prove that $f(x)$ is strictly monotonic on I.
My solution was to say that if $f'(x)\neq0$, then $f'(x)>0$ or $f'(x)<0$ , then $f(x)$ is either strictly monotonic decreasing or increasing, but I think my logic is flawed-- can anyone provide a correct solution? Or if the statement is wrong, providing a counterexample would be nice! Thanks!
HINT.-Let $I=[a,b]$ and assume lenght of $I$ is finite. Take $a\lt x_1\lt x_2\lt b$. Over the compact $[x_1,x_2]$ the function $f$ take its maximun and minimun (global). Since $f'(x)\ne0$ these extremes should be taken in $x_1$ and $x_2$ then the function $f$ is strictly monotonic on $[x_1,x_2]$
You can end by letting $x_1$ and $x_2$ tend to $a$ and $b$ respectively.
Similarly you can do when the lenght of $I$ is infinite.