# Interior extremum theorem

In mathematics, the interior extremum theorem, also known as Fermat's theorem, is a theorem which states that at the local extrema of a differentiable function, its derivative is always zero. It belongs to the mathematical field of real analysis and is named after French mathematician Pierre de Fermat.
By using the interior extremum theorem, the potential extrema of a function $f$, with derivative $f'$, can found by solving an equation involving $f'$. The interior extremum theorem gives only a necessary condition for extreme function values, as some stationary points are inflection points (not a maximum or minimum). The function's second derivative, if it exists, can sometimes be used to determine whether a stationary point is a maximum or minimum.

## History

Pierre de Fermat proposed in a collection of treatises titled Maxima et minima a method to find maximum or minimum, similar to the modern interior extremum theorem, albeit with the use of infinitesimals rather than derivatives.$^{:456–457}$$^{:2}$ After Marin Mersenne passed the treatises onto René Descartes, Descartes was doubtful, remarking "if [...] he speaks of wanting to send you still more papers, I beg of you to ask him to think them out more carefully than those preceding".$^{:3}$ Descartes later agreed that the method was valid.$^{:8}$

## Statement

One way to state the interior extremum theorem is that, if a function has a local extremum at some point and is differentiable there, then the function's derivative at that point must be zero. In precise mathematical language:
    Let $f\colon (a,b)\rightarrow \mathbb {R}$ be a function from an open interval ⁠$(a,b)$⁠ to ⁠$\mathbb {R}$⁠, and suppose that $x_{0}\in (a,b)$ is a point where $f$ has a local extremum. If $f$ is differentiable at $x_{0}$, then $f'(x_{0})=0$.$^{:377}$
Another way to understand the theorem is via the contrapositive statement: if the derivative of a function at any point is not zero, then there is not a local extremum at that point. Formally:
    If $f$ is differentiable at $x_{0}\in (a,b)$, and $f'(x_{0})\neq 0$, then $x_{0}$ is not a local extremum of $f$.

### Corollary

The global extrema of a function f on a domain A occur only at boundaries, non-differentiable points, and stationary points. If $x_{0}$ is a global extremum of f, then one of the following is true:$^{:1}$
* boundary: $x_{0}$ is in the boundary of A
* non-differentiable: f is not differentiable at $x_{0}$
* stationary point: $x_{0}$ is a stationary point of f

### Extension

A similar statement holds for the partial derivatives of multivariate functions. Suppose that some real-valued function of the real numbers $f=f(t_{1},t_{2},\ldots ,t_{k})$ has an extremum at a point $C$, defined by $C=(a_{1},a_{2},\ldots ,a_{k})$. If $f$ is differentiable at $C$, then:${\frac {\partial }{\partial t_{i}}}f(a_{i})=0$where $i=1,2,\ldots ,k$.$^{:16}$
The statement can also be extended to differentiable manifolds. If $f:M\to \mathbb {R}$ is a differentiable function on a manifold $M$, then its local extrema must be critical points of $f$, in particular points where the exterior derivative $df$ is zero.

## Applications

The interior extremum theorem is central for determining maxima and minima of piecewise differentiable functions of one variable: an extremum is either a stationary point (that is, a zero of the derivative), a non-differentiable point (that is a point where the function is not differentiable), or a boundary point of the domain of the function. Since the number of these points is typically finite, the computation of the values of the function at these points provide the maximum and the minimun, simply by comparing the obtained values.$^{:25}$$^{:1}$

## Proof

Suppose that $x_{0}$ is a local maximum. (A similar argument applies if $x_{0}$ is a local minimum.) Then there is some neighbourhood around $x_{0}$ such that $f(x_{0})\geq f(x)$ for all $x$ within that neighborhood. If $x>x_{0}$, then the difference quotient ${\frac {f(x)-f(x_{0})}{x-x_{0}}}$ is non-positive for $x$ in this neighborhood. This implies $\lim _{x\rightarrow x_{0}^{+}}{\frac {f(x)-f(x_{0})}{x-x_{0}}}\leq 0.$ Similarly, if $x<x_{0}$, then the difference quotient is non-negative, and so $\lim _{x\rightarrow x_{0}^{-}}{\frac {f(x)-f(x_{0})}{x-x_{0}}}\geq 0.$ Since $f$ is differentiable, the above limits must both be equal to $f'(x_{0})$. This is only possible if both limits are equal to 0, so $f'(x_{0})=0$.$^{:182}$