Extreme value

An extreme value, or extremum (plural extrema), is the smallest (minimum) or largest (maximum) value of a function, either in an arbitrarily small neighborhood of a point in the function's domain — in which case it is called a relative or local extremum — or on a given set contained in the domain (perhaps all of it) — in which case it is called an absolute or global extremum (the latter term is common when the set is all of the domain).

As a special case, an extremum that would otherwise be considered a relative/local extremum but occurs at an endpoint (or more generally a boundary) of the function's domain is sometimes called an endpoint or boundary extremum and is not considered a relative/local extremum, although it may be an absolute/global one.

Note that in the case of relative/local extrema, it is common to concentrate on where the extrema occur (i.e., the "$$x$$-values") rather than what the extreme values actually are (the "$$y$$-values"), whereas in the case of absolute/global extrema it is common to concentrate on the extreme value itself (the "$$y$$-value"). However, in either case both values may be given — e.g., $$f(2)=5$$ if the extreme value 5 occurs at $$x=2$$.

Extrema can be found by taking the derivative of a function and setting it to equal zero. If the second derivative at this point is positive, it is a minimum, and vice versa..

For a real-valued function of a single real variable
Given $$f:\R\to\R$$ ,
 * $$f$$ achieves a relative maximum (or local maximum) at $$x_0$$ if there is some open interval $$I$$ containing $$x_0$$ for which $$f(x)\le f(x_0)$$ for all $$x\in I$$
 * $$f$$ achieves a relative minimum (or local minimum) at $$x_0$$ if there is some open interval $$I$$ containing $$x_0$$ for which $$f(x)\ge f(x_0)$$ for all $$x\in I$$
 * $$f$$ achieves its absolute maximum (or global maximum) value $$f(x_0)$$ on a set $$D$$ if $$\vec x_0\in D$$ and $$f(x)\le f(x_0)$$ for all $$x\in D$$
 * $$f$$ achieves its absolute minimum (or global minimum) value $$f(x_0)$$ on a set $$D$$ if $$\vec x_0\in D$$ and $$f(x)\ge f(x_0)$$ for all $$x\in D$$

Note also that a relative/local extremum cannot happen at an endpoint of the function's domain.

For a real-valued function of more than one real variable
Given $$f:\R^n\to\R$$, for some integer $$n>1$$ ,
 * $$f$$ achieves a relative maximum (or local maximum) at $$\vec x_0$$ if there is some open ball $$B$$ containing $$\vec x_0$$ for which $$f(\vec x)\le f(\vec x_0)$$ for all $$\vec x\in B$$
 * $$f$$ achieves a relative minimum (or local minimum) at $$\vec x_0$$ if there is some open ball $$B$$ containing $$\vec x_0$$ for which $$f(\vec x)\ge f(\vec x_0)$$ for all $$\vec x\in B$$
 * $$f$$ achieves its absolute maximum (or global maximum) value $$f(\vec x_0)$$ on a set $$D$$ if $$\vec x_0\in D$$ and $$f(\vec x)\le f(\vec x_0)$$ for all $$\vec x\in D$$
 * $$f$$ achieves its absolute minimum (or global minimum) value $$f(\vec x_0)$$ on a set $$D$$ if $$\vec x_0\in D$$ and $$f(\vec x)\ge f(\vec x_0)$$ for all $$\vec x\in D$$

Here $$\vec x$$ is a vector representing the n-tuple $$(x_1,\ldots,x_n)\in\text{dom}f$$.

Note that a relative/local extremum cannot happen on the boundary of the function's domain.

Single-variable functions
The simplest way to find extrema of single variable functions is to take the derivative and find the stationary points, or the points at which the derivative is equal to 0 (at extrema, with the exception of endpoints on a closed interval, the slope of the tangent line is 0). The second derivative test will determine the concavity of the function at the point; if the second derivative is negative, the function will be concave down, and it will have a maximum. On a closed interval, the value of the endpoints must also be found.

Multivariable functions
For a multivariable function, the points to be tested are those on which all the partial derivatives are equal to 0. To determine whether a point is maximum, minimum, or saddle point, one must take every possible second derivative and construct a matrix, known as a Hessian matrix. For example, with a function of two variables, the Hessian matrix is
 * $$\begin{bmatrix}f_{xx}&f_{xy}\\f_{xy}&f_{yy}\end{bmatrix}$$

For three variables, this becomes
 * $$\begin{bmatrix}f_{xx}&f_{xy}&f_{xz}\\f_{yx}&f_{yy}&f_{yz}\\f_{zx}&f_{zy}&f_{zz}\end{bmatrix}$$

If the determinant of the Hessian positive, it will be a maximum if $$f_{xx}$$, $$f_{yy}$$ , or $$f_{zz}$$ is negative and a minimum if these second derivatives are positive. If it is negative, there will be a saddle point. If it is zero, another test must be used.