Proof of equicontinuous and pointwise bounded implies compact

I tried to prove the Arzela-Ascoli theorem:

Let $X$ be a compact Hausdorff space and let $C(X)$ denote the space of continuous functions $f: X \to \mathbb R$ endowed with the sup norm $\|\cdot \|_\infty$. Then $S \subseteq C(X)$ is relatively compact if and only if it is pointwise bounded and equicontinuous.

Could someone please help me finish my proof? I can’t seem to do it. Thank you in advance for your time.

Proof:

(this direction caused no problems)

$\implies$: Let $S\subseteq C(X)$ be relatively compact. Since $C(X)$ is a complete metric space (a Banach space, in fact)we may use the fact that a set is totally bounded if and only if it is relatively compact. Hence $S$ is totally bounded and hence bounded which implies pointwise bounded.

It remains to be shown that $S$ is equicontinuous. To this end, let $\varepsilon > 0$. Since $S$ it totally bounded it can be covered by a finite number of $\varepsilon/3$ balls. Let $f_1, \dots , f_n$ denote the centres of these balls. Since $f \in C(X)$ are uniformly continuous, for every $f_i$ there exists a $\delta_i >0$ such that $|x-y|<\delta_i$ implies $|f_i(x) – f_i(y)|<{\varepsilon \over 3}$. Let $\delta = \min_i \delta_i$. Then for $|x-y|<\delta$,
$$ |f(x)-f(y)| \le |f(x) – f_i(x)| + |f_i(x) – f_i (y)| + |f_i(y) -f(y)| < \varepsilon$$
where $f_i$ is such that $f$ is contained in the $\varepsilon/3$ ball with centre $f_i$.

This direction is causing the problem:

$\Longleftarrow$: Let $S \subseteq C(X)$ be equicontinuous and pointwise bounded. The goal is to show that $\overline{S}$ is compact. By the general Heine-Borel theorem for metric spaces a subset of a metric space is compact if and only if it is complete and totally bounded. Furthermore, closed subsets of complete metric spaces are complete hence it is enough to show that $\overline{S}$ is totally bounded.

To this end let $\varepsilon > 0$. Since $\overline{S}$ is equicontinuous there exists $\delta > 0$ such that $|x-y|<\delta$ implies $|f(x) – f(y) |< \varepsilon$. Since $X$ is compact it may be covered by finitely many $\delta$ balls. Let $x_1, \dots , x_n$ denote the centres of these balls. Since $\overline{S}$ is pointwise bounded for every $x_i$ there exists $K_i$ such that $\sup_{f \in \overline{S}} |f(x_i)| \le K_i$.

How to construct the finite collection of $\varepsilon $ balls that cover $\overline{S}$?

Solutions Collecting From Web of "Proof of equicontinuous and pointwise bounded implies compact"