Fermat's Theorem as relates to

calculus states that if f has a local

maximum or

minimum at c, and if f'(c) exists, then f'(c) = 0.

Proof by picture:

| _
| _ / \
| / \ / \
| / \_/
| /
---------------

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,

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

If h > 0,

__f(c) - f(c+h)__ >= 0
h

Taking the right-hand limit of both sides,

lim __(f(c)-f(c+h)__ >= lim 0 = 0
h->0^{+} h h->0^{+}

Similarly, if h < 0,

__f(c) - f(c+h)__ <= 0
h

Taking the left-hand limit of both sides,

lim __(f(c)-f(c+h)__ <= lim 0 = 0
h->0^{-} h h->0^{-}

Since f'(c) exists,

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

Therefore,

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

QED.

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