| _ | _ / \ | / \ / \ | / \_/ | / ---------------Clearly, at the local maximums and minimums, the tangent line is horizontal, and f'(c) = 0. Much as you'd like it to be good enough, however, most professors refuse to accept the proof by picture argument. So, the real one follows:

Suppose f has a local maximum at c. Then it follows that f(c) >= f(x) if x is sufficiently close to c. This implies that if h is sufficiently close to 0, f(c) >= f(c+h). Therefore,

If h > 0,f(c) >= f(c+h) f(c) - f(c+h) >= 0

Taking the right-hand limit of both sides,f(c) - f(c+h)>= 0 h

Similarly, if h < 0,lim(f(c)-f(c+h)>= lim 0 = 0 h->0^{+}h h->0^{+}

Taking the left-hand limit of both sides,f(c) - f(c+h)<= 0 h

Since f'(c) exists,lim(f(c)-f(c+h)<= lim 0 = 0 h->0^{-}h h->0^{-}

Therefore,f'(c) = lim(f(c)-f(c+h)= lim(f(c)-f(c+h)h->0^{+}h h->0^{-}h

QED.f'(c) >= 0 and f'(c) <= 0 f'(c) = 0.

A virtually identical argument can be written down to prove that this is also true if f has a minimum at c.