Suppose f is a differentiable function on an interval (a,b) and that f′ takes on both positive and negative values on (a,b). Prove that f′ must take on the value 0 as well.
According to a hint, the idea is to show that there exist a minimum or a maximum between the points f(x) and f(y) which are the points whose derivative takes on positive and negative values. Assume WLOG that $f'(x)>0$ and $f'(y)<0$ and $a<x<y<b$. Now the issue I am running into is that I can't say that there is a neighbour of f(x) that it is increasing since it is possible that f(x) can have a positive derivative at a point without it increasing in a neighbour of that point. How can I proceed?