Extreme value theorem (source code)

= Extreme value theorem
{wiki}

A <real-valued function> that is <continuous> on a nonempty <compact space> attains both a <global minimum> and a <global maximum>. In particular, for a <continuous function> $f:[a,b]\to\mathbb R$ on a nonempty <closed interval>, there are points $x_{\min},x_{\max}\in[a,b]$ such that
$$
f(x_{\min})\leq f(x)\leq f(x_{\max})
\qquad\text{for every }x\in[a,b].
$$
The important word is “attains”: the best values occur at actual allowed inputs, rather than merely being approached. The interval version is https://jirilebl.github.io/ra/html/sec_minmaxint.html[Jiří Lebl, Basic Analysis I, theorem 3.3.2]{ref}.

For a worked example, take $f(x)=(x-1)^2$ on $[-1,2]$. Its <global minimum> is $f(1)=0$, and its <global maximum> is $f(-1)=4$. Nonnegativity gives the first answer; $|x-1|\leq2$ on the specified <closed interval> gives the second. The endpoint $x=-1$ is essential: looking only for a zero <derivative> would find the minimum and miss the maximum.

\Image[/extreme-value-theorem-attainment.png]
{title=An attained minimum and maximum on a closed interval, compared with excluded endpoints and a discontinuous endpoint value}

For comparison, the <continuous function> $g(x)=x$ on the <open interval> $(0,1)$ has <infimum> $0$ and <supremum> $1$, but neither is a value of $g$. Even a closed domain is insufficient without <continuity>: define $h(x)=x$ for $0\leq x<1$, and $h(1)=0$. On $[0,1]$, its <supremum> is $1$, approached by $x_n=1-1/n$ for $n\geq2$, but every function value is strictly less than $1$. This endpoint change makes $h$ <discontinuous>, preventing attainment. On the unbounded <real line>, the <continuous function> $x\mapsto x$ has neither a <global minimum> nor a <global maximum>. These examples show what can fail when a hypothesis is dropped; functions outside the hypotheses may still have extrema.

The <extreme value theorem> is an existence tool for <optimization>: first establish that a <continuous> <objective function> on a nonempty <compact> <feasible set> has a best value, then investigate where it occurs. It neither locates the optimizing point nor promises uniqueness or <differentiability>. For example, the <absolute value> function $|x|$ on $[-1,2]$ has its <global minimum> at zero although no <derivative> exists there; a <constant function> has every input as a <minimizer>. This role in <optimization> is explained in https://www.math.utoronto.ca/courses/mat237y1/20189/notes/Chapter1/S1.4.html[University of Toronto MAT237 notes, section 1.4: compactness and the extreme value theorem].

A short proof outline identifies the mechanism. The <continuous image of a compact space> is <compact>; a nonempty <compact subset> of the <real line> contains its <infimum> and <supremum>. For a <closed interval>, one can instead choose inputs whose outputs approach the <supremum>, extract a convergent <subsequence> by the <Bolzano-Weierstrass theorem>, and use <continuity> to make its limiting output equal that <supremum>. The <closed interval> retains the limiting input. Repeating the argument for the <infimum> supplies the minimum.