Extreme Value Theorem/Real Function

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 {x_n} > N$

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

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

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

which by definition satisfies:
 * $\ds \lim_{n \mathop \to \infty} \map f {x_n} = \infty$

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

$\sequence {x_n}$ is bounded:
 * bounded above by $b$
 * bounded below by $a$.

By the Bolzano-Weierstrass Theorem there exists a subsequence of $\sequence {x_n}$, call it $\sequence {g_n}$, which converges to a point in $\closedint a b$.

So, let $g_n \to d$ with $d \in \closedint a b$.

We have that $f$ is continuous on $\closedint a b$

Hence by Continuity of Mapping between Metric Spaces by Convergent Sequence:
 * $\ds \lim_{n \mathop \to \infty} \map f {g_n} = \map f d$

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

From Limit of Subsequence equals Limit of Real Sequence:
 * $\ds \lim_{n \mathop \to \infty} \sequence {\map f {g_n} } = \ds \lim_{n \mathop \to \infty} \sequence {\map f {x_n} }$

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

which is necessarily finite.

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$