The Weierstrass theorem studies continuous functions on closed intervals, proving they attain maximum and minimum values.
The Weierstrass theorem guarantees that a continuous function on a closed and bounded interval actually attains a maximum and a minimum value. It seems obvious, but it is the property that ensures optimization problems have solutions and that the search for extrema is well-posed [1].
If $f : [a, b] \to \mathbb{R}$ is continuous, there exist $x_m, x_M \in [a, b]$ such that $f(x_m) \le f(x) \le f(x_M)$ for every $x \in [a, b]$. More generally, it holds for a continuous function on a compact set (see the line on compactness and the one on the Heine-Borel theorem) [1][2].
- Without continuity: $f(x) = 1/x$ for $x \neq 0$ and $f(0) = 0$ on $[-1, 1]$ is unbounded.
- Without closedness: $f(x) = x$ on $(0, 1)$ is continuous and bounded but does not attain either maximum or minimum; $f(x) = 1/x$ on $(0, 1]$ is continuous but unbounded.
- Without boundedness: $f(x) = x$ on $[0, \infty)$ is continuous but has no maximum.
For $f(x) = x^2 - 4x + 1$ on $[0, 5]$ (values taken), the derivative $2x - 4$ vanishes at $x = 2$. Comparing $f(0) = 1$, $f(2) = -3$ and $f(5) = 6$ one finds minimum $-3$ at $x = 2$ and maximum $6$ at $x = 5$ (calculation). For $g(x) = x^3 - 3x$ on $[-2, 3]$, the stationary points are $\pm 1$ and the values to compare are $g(-2) = -2$, $g(-1) = 2$, $g(1) = -2$, $g(3) = 18$: minimum $-2$ (attained at two points) and maximum $18$ at $x = 3$ (calculation). The theorem ensures that this comparison between extrema and stationary points is sufficient (see the line on Fermat’s theorem).
First it is shown that $f$ is bounded: otherwise there exists a sequence $x_n$ with $f(x_n) \to \infty$; by Bolzano-Weierstrass there exists a subsequence converging to a point $c \in [a, b]$ and by continuity $f(x_{n_k}) \to f(c)$, absurd (see the line on the Bolzano-Weierstrass theorem). Then one takes a sequence realizing the supremum and repeats the same argument.
A different theorem, with the same name, states that every continuous function on $[a, b]$ is the uniform limit of polynomials (see the line on uniform convergence): it can be approximated by polynomials as closely as desired.
Existence of the minimum in optimization problems (see the line on optimization), least squares problems and optimal parameter choice in engineering and economics (general observation).
The theorem says that extrema exist, but not where. If the domain is not compact, a coercivity argument is needed: a continuous function such that $f(x) \to \infty$ for $|x| \to \infty$ has a minimum on $\mathbb{R}$.
[1] Wikipedia (it): Teorema di Weierstrass
[2] Wikipedia (en): Extreme value theorem
Generating summary…