If
\(a=b\text{,}\) then
\([a,b]=\{a\}\) is compact since
\(a\) is necessarily an element of some set in an open cover, and thus is covered by a subcover consisting of a single set.
Henceforth, assume
\(a\lt b\) and let
\(\mathscr U = \{U_i\mid i\in I\}\) be an open cover of
\([a,b]\text{.}\) The reader may check the following assertion:
Let
\(x\in [a,b)\text{.}\) Then there is an element
\(y\in (x,b]\) and an element
\(i\in I\) for which
\([x,y]\subseteq U_i\text{.}\)
Now let
\begin{equation*}
C := \{y\in [a,b]\mid [a,y]\text{ can be finitely covered by elements of }\mathscr U\}.
\end{equation*}
We employ topological induction to prove that \(C = [a,b]\text{,}\) whence \([a,b]\) is compact. The above assertion applied to \(x=a\) reveals that \(a\in C\text{.}\) Downward closure is similarly straightforward: if \(y\in C\) and \(a\le z\le y\text{,}\) then \(z\in C\) because a finite subcover of \([a,y]\) is automatically a finite subcover of \([a,z]\text{.}\)
For the topological induction step, suppose that
\(y\in C\text{,}\) meaning that
\([a,y]\) can be finitely covered by elements of
\(\mathscr U\text{.}\) Fix a finite subcover of
\([a,y]\text{.}\) Then
\(y\) is in some
\(U_i\) within the finite subcover. But
\(U_i\) is open, so
\(y+\varepsilon\) is in
\(U_i\) for some
\(\varepsilon \gt 0\text{.}\)
Our final task is to show that \(\sup C\in C\text{.}\) We already know that \(C = [a,\sup C)\) or \([a,\sup C]\text{.}\) Since \(\mathscr U\) is an open cover of \([a,b]\text{,}\) there is some index \(i_0\in I\) for which \(\sup C \in U_{i_0}\text{.}\) By openness of \(U_{i_0}\text{,}\) there exists \(z\in [a,\sup C)\) such that \((z,\sup C]\subseteq U_{i_0}\text{.}\) By definition of \(C\text{,}\) \([a,z]\) is finitely covered by \(\mathscr U\text{.}\) This means there is a finite subset \(S\subseteq I\) for which
\begin{equation*}
[a,z]\subseteq \bigcup_{i\in S} U_i.
\end{equation*}
Thus
\begin{equation*}
[a,\sup C] = [a,z]\cup (z,\sup C]\subseteq \bigg(\bigcup_{i\in S}U_i\bigg)\cup U_{i_0}.
\end{equation*}
In particular, \([a,\sup C]\) is finitely covered by \(\mathscr U\text{,}\) so \(\sup C\in C\text{.}\) By topological induction, \(C=[a,b]\text{,}\) which concludes our proof.