Fermat's Theorem
Theorem 1. If $f$ has a local maximum or minimum at $c$, and if $f'(c)$ exists, then $f'(c) = 0$.
Proof. Without loss of generality, suppose that $f$ has a local maximum at $c$. This means that $f(c) \geq f(c+h)$ for $h$ which is sufficiently close to $0$. If $h > 0$, we have $$\frac{f(c+h) - f(c)}{h} \leq 0 \\ \Longrightarrow \lim_{h \rightarrow 0^+} \frac{f(c+h)-f(c)}{h} = f'(c) \leq 0$$ and so we have shown that $f'(c) \leq 0$. Similarly, we can show that $f'(c) \geq 0$ if $h < 0$. Since both of these inequalities must be true, the only possibility is that $f'(c) = 0$. $\blacksquare$
Critical Number
Definition 1. A critical number of a function $f$ is a number $c$ in the domain of $f$ such that either $f'(c) = 0$ or $f'(c)$ does not exist.
Remark. We can rephrase Fermat's theorem in terms of critical numbers as follows:
If $f$ has a local maximum or minimum at $c$, then $c$ is a critical number of $f$.