TITLE: Proof that the derivative of an extremum is $0$
QUESTION [5 upvotes]: My notes say that if $f(x_0)$ is an extremum then $f'(x_0)=0$, but i'm having trouble proving it.
I've shown that if 
$f'(x_0)>0$ then $\exists h>0$ such that
$\forall x_1 ,x_2 \in (x_0-h,x_0+h),\; x_1<x_0<x_2 \implies f(x_1)<f(x_0)<f(x_2)$
The result apparently follows trivially from this, but I can't do it. My first thought was to say that if $f(x_0)$ is a maximum then the right inequality doesn't hold and if $f(x_0)$ is a minimum then the left inequality doesn't hold, but I don't see how this implies that $f'(x_0) =0$.
Can anyone help?

REPLY [2 votes]: You say you have already proved that if $f'(x_0)>0$ then $f$ does not have an extremum at $x_0$. Well if that is so, then certainly if $f'(x_0)<0$ there is no extremum at $x_0$ either. (Repeat the argument or consider $-f$.) So if $x_0$ is an extremum and $f$ is differentiable at $x_0$ then $f'(x_0)=0$, since neither $f'(x_0)<0$ nor $f'(x_0)>0$. And that is all that you can hope to prove, since it is of course possible that a function is not differentiable at an extremum, consider for example $f(x)=\lvert x\rvert$.