Weierstrass Extreme Value Theorem

Theorem
Let $f$ be a real function which is continuous in a closed real interval $\closedint a b$.

Then:
 * $\forall x \in \closedint a b: \exists x_n \in \closedint a b: \map f {x_n} \le \map f x$


 * $\forall x \in \closedint a b: \exists x_n \in \closedint a b: \map f {x_n} \ge \map f x$

Proof
First it is shown that $\map f x$ is bounded in the closed real interval $\closedint a b$.

$\map f x$ has no upper bound.

Then for all $x \in \closedint a b$:
 * $\forall N \in \R: \exists x_n \in \closedint a b: \map f {\sequence {x_n} } > N$

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

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

Consider the sequence:
 * $\sequence {\map f {\sequence {x_n} } }_{n \mathop \in \N}$

and the sequence:
 * $\sequence N_{N \mathop \in \N}$

Because:
 * $\map f {\sequence {x_n} } > N$

and:
 * $\sequence N_{N \mathop \in \N} \to \infty$

it follows that:
 * $\sequence {\map f {\sequence {x_n} } }_{n \mathop \in \N} > \infty \implies \sequence {\map f {\sequence {x_n} } }_{n \mathop \in \N} \to \infty$

Consider the sequence:
 * $\sequence {x_n} \in \closedint a b$

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

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

Since $\closedint a b$ is closed:
 * $d \in \closedint a b$

By Continuity of Mapping between Metric Spaces by Convergent Sequence, then:
 * $\map f x$ is continuous in $d$

and:
 * $\map f {\sequence {g_n} } = \map f d$

But our first conlusion indicates that:
 * $\sequence {\map f {x_n} }_{n \mathop \in \N} \to \infty$

which contradicts:
 * $\sequence {\map f {g_n} }_{n \mathop \in \N} \to d$

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

It remains to be proved that:
 * $\exists d \in \closedint a b: \map f x \le \map f d$

where $\map f d = N$ (the maximum).

It will be shown that:
 * $\forall n \in \R_{\ne 0}: N - 1/n < \map f {\sequence {x_n} } \le N$

as follows;

, consider $n \in \N$.

Let $I$ denote the codomain of $f \closedint a b$.

Because $N$ is its maximum and $N - 1/n < N$:
 * $\forall n \in \N: \exists y_n \in \closedint a b: N - 1/n < y_n < N$

But $y_n \in I$, so:
 * $\forall n \in \N: \exists x_n \in \closedint a b$

That means:
 * $\map f {\sequence {x_n} } = y_n \implies N - 1/n < \map f {x_n} \le \ N$

It follows that:
 * $\sequence {\map f {\sequence {x_n} } } \to N$

Considering:
 * $\sequence {N - 1 / n} \to \ N$ as $n \to \infty$

and:
 * $\forall n \in \N: \sequence N \to N$

by:
 * $\sequence {N - 1 / n} < \sequence {\map f {\sequence {x_n} } } \le N \implies \sequence {\map f {\sequence {x_n} } } \to \sequence N$

Consider $\sequence {x_n}$.

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

that converges.

Let it converge to $l$.

Because $\sequence {s_n} \in \closedint a b$ it follows that:
 * $l \in \closedint a b$.

Finally, $\map f x$ is continuous in $\closedint a b$.

So, by Continuity of Mapping between Metric Spaces by Convergent Sequence:
 * $\sequence {s_n} \to d \implies \map f {\sequence {s_n} } \to \map f d$

But:
 * $\sequence {\map f {x_n} } \to N \implies \sequence {\map f {s_n} }_{n \mathop \in \N} \to N \iff \map f d = N$