[proofplan]
We first prove existence of a maximum point. The [Boundedness Theorem](/theorems/181) gives a finite [supremum](/page/Supremum%20and%20Infimum) for the values of $f$ on $[a,b]$, and the definition of supremum gives a [sequence](/page/Sequence) whose function values approach that supremum. The [Bolzano-Weierstrass Theorem](/theorems/171) supplies a convergent subsequence in the interval, and [continuity](/page/Continuity%20%28Real%20Analysis%29) transfers convergence through $f$. The minimum follows by applying the same maximum argument to the continuous function $-f$.
[/proofplan]
[step:Construct a sequence whose values approach the supremum of $f$]
Define the value set $S \subset \mathbb{R}$ by
\begin{align*}
S := \{f(x) : x \in [a,b]\}.
\end{align*}
Since $a \in [a,b]$, the set $S$ is nonempty. Since $f: [a,b] \to \mathbb{R}$ is continuous and $a < b$, the Boundedness Theorem applies to $f$ on the closed interval $[a,b]$, so $S$ is bounded above and below. Define
\begin{align*}
M := \sup S.
\end{align*}
Then $M \in \mathbb{R}$. For each $n \in \mathbb{N}$, the number $M - \frac{1}{n}$ is not an upper bound for $S$. Therefore there exists $x_n \in [a,b]$ such that
\begin{align*}
M - \frac{1}{n} < f(x_n) \leq M.
\end{align*}
This defines a sequence $(x_n)_{n=1}^{\infty}$ in $[a,b]$.
[/step]
[step:Extract a subsequential limit inside $[a,b]$]
The sequence $(x_n)_{n=1}^{\infty}$ is bounded in $\mathbb{R}$ because $a \leq x_n \leq b$ for every $n \in \mathbb{N}$. By the [Bolzano-Weierstrass Theorem](/theorems/628), there exists a strictly increasing sequence of indices $(n_j)_{j=1}^{\infty}$ in $\mathbb{N}$ and a point $d \in \mathbb{R}$ such that
\begin{align*}
\lim_{j \to \infty} x_{n_j} = d.
\end{align*}
Since $a \leq x_{n_j} \leq b$ for every $j \in \mathbb{N}$, the Order Limit Theorem gives
\begin{align*}
a \leq d \leq b.
\end{align*}
Hence $d \in [a,b]$.
[guided]
We need a point of the interval at which the supremum might be attained. The sequence $(x_n)_{n=1}^{\infty}$ lies in $[a,b]$, so it satisfies
\begin{align*}
a \leq x_n \leq b \quad \text{for every } n \in \mathbb{N}.
\end{align*}
In particular, $(x_n)_{n=1}^{\infty}$ is bounded in $\mathbb{R}$. The Bolzano-Weierstrass Theorem applies to bounded real sequences, so there exists a convergent subsequence. Thus there are a strictly increasing sequence of indices $(n_j)_{j=1}^{\infty}$ in $\mathbb{N}$ and a point $d \in \mathbb{R}$ such that
\begin{align*}
\lim_{j \to \infty} x_{n_j} = d.
\end{align*}
It remains to verify that this limiting point has not left the interval. For every $j \in \mathbb{N}$, we still have
\begin{align*}
a \leq x_{n_j} \leq b.
\end{align*}
Passing to the limit in these two inequalities by the Order Limit Theorem yields
\begin{align*}
a \leq d \leq b.
\end{align*}
Therefore $d \in [a,b]$. This is where closedness of the interval matters: the subsequential limit remains an admissible point for evaluating $f$.
[/guided]
[/step]
[step:Use continuity to identify the subsequential limit as a maximum point]
Because $d \in [a,b]$ and $f$ is continuous on $[a,b]$, $f$ is continuous at $d$. Hence
\begin{align*}
\lim_{j \to \infty} f(x_{n_j}) = f(d).
\end{align*}
For every $j \in \mathbb{N}$, the construction of $x_{n_j}$ gives
\begin{align*}
M - \frac{1}{n_j} < f(x_{n_j}) \leq M.
\end{align*}
Since $n_j \to \infty$, we have
\begin{align*}
\lim_{j \to \infty} \left(M - \frac{1}{n_j}\right) = M.
\end{align*}
The [Squeeze Theorem](/theorems/627) gives
\begin{align*}
\lim_{j \to \infty} f(x_{n_j}) = M.
\end{align*}
By [uniqueness of limits](/theorems/625) in $\mathbb{R}$,
\begin{align*}
f(d) = M.
\end{align*}
Since $M = \sup S$, every $x \in [a,b]$ satisfies $f(x) \leq M = f(d)$.
[guided]
Now we show that the limit point $d$ actually attains the supremum. The reason for choosing the sequence $(x_n)_{n=1}^{\infty}$ was that its values approach $M$ from below:
\begin{align*}
M - \frac{1}{n} < f(x_n) \leq M \quad \text{for every } n \in \mathbb{N}.
\end{align*}
Restricting this inequality to the subsequence gives
\begin{align*}
M - \frac{1}{n_j} < f(x_{n_j}) \leq M \quad \text{for every } j \in \mathbb{N}.
\end{align*}
Since $(n_j)_{j=1}^{\infty}$ is strictly increasing, $n_j \to \infty$, and therefore
\begin{align*}
\lim_{j \to \infty} \left(M - \frac{1}{n_j}\right) = M.
\end{align*}
The right endpoint of the inequality is the constant sequence with value $M$, so it also converges to $M$. By the Squeeze Theorem,
\begin{align*}
\lim_{j \to \infty} f(x_{n_j}) = M.
\end{align*}
On the other hand, the preceding step proved $x_{n_j} \to d$ with $d \in [a,b]$. Since $f$ is continuous on $[a,b]$, it is continuous at $d$, and continuity gives
\begin{align*}
\lim_{j \to \infty} f(x_{n_j}) = f(d).
\end{align*}
Both displayed limits are limits of the same real sequence $(f(x_{n_j}))_{j=1}^{\infty}$. By [uniqueness of limits](/theorems/742) in $\mathbb{R}$,
\begin{align*}
f(d) = M.
\end{align*}
Because $M$ was defined as $\sup S$ and $S = \{f(x) : x \in [a,b]\}$, every $x \in [a,b]$ satisfies
\begin{align*}
f(x) \leq M = f(d).
\end{align*}
Thus $d$ is a global maximum point of $f$ on $[a,b]$.
[/guided]
[/step]
[step:Apply the maximum argument to $-f$ to obtain a minimum point]
Define the function
\begin{align*}
g: [a,b] &\to \mathbb{R} \\
x &\mapsto -f(x).
\end{align*}
Since $f$ is continuous on $[a,b]$, the function $g$ is continuous on $[a,b]$. Applying the maximum result proved above to $g$, there exists $c \in [a,b]$ such that
\begin{align*}
g(x) \leq g(c) \quad \text{for every } x \in [a,b].
\end{align*}
Substituting $g(x) = -f(x)$ gives
\begin{align*}
-f(x) \leq -f(c) \quad \text{for every } x \in [a,b].
\end{align*}
Multiplying by $-1$ reverses the inequality, so
\begin{align*}
f(c) \leq f(x) \quad \text{for every } x \in [a,b].
\end{align*}
Combining this with the maximum point $d \in [a,b]$ constructed above gives
\begin{align*}
f(c) \leq f(x) \leq f(d) \quad \text{for every } x \in [a,b].
\end{align*}
Therefore $f$ attains its global minimum at $c$ and its global maximum at $d$ on $[a,b]$.
[/step]