Weierstrass Extreme Value Theorem

Theorem
Let $f$ be continuous in a closed real interval $\left[{a \,.\,.\, b}\right]$.

Then:
 * $\forall x \in \left[{a \,.\,.\, b}\right]: \exists x_s \in \left[{a \,.\,.\, b}\right]: f \left({x_s}\right) \le f \left({x}\right)$


 * $\forall x \in \left[{a \,.\,.\, b}\right]: \exists x_n \in \left[{a \,.\,.\, b}\right]: f \left({x_n}\right) \ge f \left({x}\right)$

Proof
First it is shown that $f \left({x}\right)$ is bounded in the closed real interval $\left[{a \,.\,.\, b}\right]$.

$f \left({x}\right)$ has no upper bound.

Then for all $x \in \left[{a \,.\,.\, b}\right]$:
 * $\forall N \in \R: \exists x_n \in \left[{a \,.\,.\, b}\right]: f \left({\left \langle {x_n} \right \rangle}\right) > N$

We have that:
 * $\N \subset \R$

, we can consider $N \in \N$.

Consider the sequence:
 * $\left \langle {f \left({\left \langle {x_n} \right \rangle}\right)} \right \rangle_{n \in \N}$

and the sequence:
 * $\left \langle {N} \right \rangle_{N \mathop \in \N}$

Because:
 * $f \left({\left \langle {x_n} \right \rangle}\right) > N$

and:
 * $\left \langle {N} \right \rangle_{N \mathop \in \N} \to \infty$

it follows that:
 * $\left\langle {f \left({\left \langle {x_n} \right \rangle}\right)} \right \rangle_{n \mathop \in \N} > \infty \implies \left \langle {f \left({\left \langle {x_n} \right \rangle}\right)} \right \rangle_{n \in \N} \to \infty$

Consider the sequence:
 * $\left \langle {x_n} \right \rangle \in \left[{a \,.\,.\, b}\right]$

It is bounded: bounded above by $b$ and bounded below by $a$.

So by the Bolzano-Weierstrass Theorem there exists a subsequence of $\left \langle {x_n} \right \rangle $:
 * $\left \langle {g_n} \right \rangle \to d$

Since $\left[{a \,.\,.\, b}\right]$ is closed:
 * $d \in \left[{a \,.\,.\, b}\right]$

By Continuity of Mapping between Metric Spaces by Convergent Sequence, then:
 * $f \left({x}\right)$ is continuous in $d$

and:
 * $f \left({\left \langle {g_n} \right \rangle}\right) = f \left({d}\right)$

But our first conlusion indicates that:
 * $\left \langle {f \left({x_n}\right)} \right \rangle_{n \in \N} \to \infty$

which contradicts:
 * $\left \langle {f \left({g_n}\right)} \right \rangle_{n \in \N} \to d$

A similar argument can be used to prove the lower bound.

It remains to be proved that:
 * $\exists d \in \left[{a \,.\,.\, b}\right]: f \left({x}\right) \le f \left({d}\right)$

where $f \left({d}\right) = N$ (the maximum).

It will be shown that:
 * $\forall n \in \R_{\ne 0}: N - 1/n < f \left({\left \langle {x_n} \right \rangle }\right) \le N$

as follows;

, consider $n \in \N$.

Let $I$ denote the codomain of $f \left[{a \,.\,.\, b}\right]$.

Because $N$ is its maximum and $N - 1/n < N$:
 * $\forall n \in \N: \exists y_n \in \left[{a \,.\,.\, b}\right]: N - 1/n < y_n < N$

But $y_n \in I$, so:
 * $\forall n \in \N: \exists x_n \in \left[{a \,.\,.\, b}\right]$

That means:
 * $f \left({\left \langle {x_n} \right \rangle}\right) = y_n \implies N - 1/n < f \left({x_n}\right) \le \ N$

It follows that:
 * $\left \langle {f \left({\left \langle {x_n} \right \rangle}\right)} \right \rangle \to N$

Considering:
 * $\left \langle {N - 1/n} \right \rangle \to \ N$ as $n \to \infty$

and:
 * $\forall n \in \N: \left \langle {N} \right \rangle \to N$

by:
 * $\left \langle {N - 1/n} \right \rangle < \left \langle {f \left({\left \langle {x_n} \right \rangle}\right)} \right \rangle \le N \implies \left \langle {f \left({\left \langle {x_n} \right \rangle}\right)} \right \rangle \to \left \langle {N} \right \rangle$

Consider $\left \langle {x_n} \right \rangle$.

Because it is bounded, by Bolzano-Weierstrass Theorem there exists a subsequence:
 * $\left \langle {s_n} \right \rangle$

that converges.

Let it converge to $l$.

Because $\left \langle {s_n} \right \rangle \in \left[{a \,.\,.\, b}\right]$ it follows that:
 * $l \in \left[{a \,.\,.\, b}\right]$.

Finally, $f \left({x}\right) $ is continuous in $\left[{a \,.\,.\, b}\right]$.

So, by Continuity of Mapping between Metric Spaces by Convergent Sequence:
 * $\left \langle {s_n} \right \rangle \to d \implies f \left({\left \langle {s_n} \right \rangle}\right) \to f \left({d}\right)$

But:
 * $\left \langle {f \left({x_n}\right)} \right \rangle \to N \implies \left \langle {f \left({s_n}\right)} \right \rangle_{n \in \N} \to N \iff f \left({d}\right) = N$