[proofplan]
We prove both implications using only the metric definitions. Compactness first gives completeness by forcing every [Cauchy sequence](/page/Cauchy%20Sequence) to have a cluster point, and then the Cauchy property upgrades that cluster point to the limit of the whole sequence. Compactness also gives [total boundedness](/page/Total%20Boundedness) by applying the finite-subcover property to the open-ball cover of a fixed radius. Conversely, total boundedness lets us extract a Cauchy subsequence from every sequence by repeatedly passing to an infinite subsequence inside smaller and smaller balls; completeness makes that subsequence converge, and a final open-cover argument shows that [sequential compactness](/page/Sequential%20Compactness) in this metric sense implies compactness.
[/proofplan]
[step:Use compactness to force Cauchy sequences to converge]
Assume that $M$ is compact, and let $(x_k)_{k=1}^{\infty}$ be a Cauchy sequence in $M$. We use the open-ball notation $B(a,r)$ from the theorem statement. For each $n \in \mathbb{N}$, define the tail set
\begin{align*}
E_n := \{x_k \in M : k \geq n\}.
\end{align*}
Let $\overline{E_n}$ denote the closure of $E_n$ in the metric topology induced by $d$. The family $(\overline{E_n})_{n=1}^{\infty}$ is decreasing, and every finite subfamily has non-empty intersection because
\begin{align*}
E_N \subset \bigcap_{n=1}^{N} \overline{E_n}
\end{align*}
for each $N \in \mathbb{N}$. We derive the required finite-intersection consequence from open-cover compactness. If
\begin{align*}
\bigcap_{n=1}^{\infty} \overline{E_n} = \varnothing,
\end{align*}
then the open sets $M \setminus \overline{E_n}$ cover $M$. Compactness gives $N \in \mathbb{N}$ such that
\begin{align*}
M = \bigcup_{n=1}^{N} (M \setminus \overline{E_n}).
\end{align*}
Equivalently,
\begin{align*}
\bigcap_{n=1}^{N} \overline{E_n} = \varnothing,
\end{align*}
contradicting the non-empty finite intersection proved above. Hence
\begin{align*}
\bigcap_{n=1}^{\infty} \overline{E_n} \neq \varnothing.
\end{align*}
Choose $x \in \bigcap_{n=1}^{\infty} \overline{E_n}$.
We prove that $x_k \to x$ in $M$. Let $\varepsilon > 0$. Since $(x_k)_{k=1}^{\infty}$ is Cauchy, there exists $N \in \mathbb{N}$ such that
\begin{align*}
d(x_k,x_l) < \frac{\varepsilon}{2}
\end{align*}
for all $k,l \geq N$. Since $x \in \overline{E_N}$, the open ball $B(x,\varepsilon/2)$ intersects $E_N$. Hence there exists $l \geq N$ such that
\begin{align*}
d(x_l,x) < \frac{\varepsilon}{2}.
\end{align*}
For every $k \geq N$, the triangle inequality gives
\begin{align*}
d(x_k,x) \leq d(x_k,x_l) + d(x_l,x) < \varepsilon.
\end{align*}
Thus $x_k \to x$. Since every Cauchy sequence in $M$ converges to a point of $M$, the [metric space](/page/Metric%20Space) $(M,d)$ is complete.
[guided]
Assume that $M$ is compact, and let $(x_k)_{k=1}^{\infty}$ be a Cauchy sequence in $M$. The goal is to find a point $x \in M$ and then prove that the entire sequence converges to $x$. Compactness does not directly mention Cauchy sequences, so we first use it to produce a cluster point of the sequence. We use the open-ball notation $B(a,r)$ from the theorem statement.
For each $n \in \mathbb{N}$, define the tail set
\begin{align*}
E_n := \{x_k \in M : k \geq n\}.
\end{align*}
Let $\overline{E_n}$ be the closure of $E_n$ in the metric topology induced by $d$. The sets $\overline{E_n}$ are closed in $M$, and they are decreasing because $E_{n+1} \subset E_n$. Moreover, every finite subcollection intersects: if $N \in \mathbb{N}$, then every point of $E_N$ belongs to each $\overline{E_n}$ for $1 \leq n \leq N$, so
\begin{align*}
E_N \subset \bigcap_{n=1}^{N} \overline{E_n}.
\end{align*}
Since $E_N$ is non-empty, the finite intersection above is non-empty.
Compactness now enters through the open-cover definition. We prove the needed finite-intersection consequence instead of assuming it. Suppose, for contradiction, that
\begin{align*}
\bigcap_{n=1}^{\infty} \overline{E_n} = \varnothing.
\end{align*}
Then every point of $M$ fails to belong to at least one [closed set](/page/Closed%20Set) $\overline{E_n}$, so the open sets $M \setminus \overline{E_n}$ cover $M$. By compactness, finitely many of these open sets cover $M$, so there exists $N \in \mathbb{N}$ such that
\begin{align*}
M = \bigcup_{n=1}^{N} (M \setminus \overline{E_n}).
\end{align*}
Taking complements in $M$ gives
\begin{align*}
\bigcap_{n=1}^{N} \overline{E_n} = \varnothing.
\end{align*}
This contradicts the finite-intersection statement already proved from the non-empty tail $E_N$. Hence
\begin{align*}
\bigcap_{n=1}^{\infty} \overline{E_n} \neq \varnothing.
\end{align*}
Choose a point $x \in \bigcap_{n=1}^{\infty} \overline{E_n}$. This means that $x$ lies in the closure of every tail of the sequence.
Now we use the Cauchy property to show that this cluster point is the actual limit of the whole sequence. Let $\varepsilon > 0$. Since $(x_k)_{k=1}^{\infty}$ is Cauchy, there exists $N \in \mathbb{N}$ such that
\begin{align*}
d(x_k,x_l) < \frac{\varepsilon}{2}
\end{align*}
for all $k,l \geq N$. Since $x \in \overline{E_N}$, every open ball around $x$ intersects $E_N$; in particular, $B(x,\varepsilon/2)$ intersects $E_N$. Hence there exists $l \geq N$ such that
\begin{align*}
d(x_l,x) < \frac{\varepsilon}{2}.
\end{align*}
For every $k \geq N$, the triangle inequality gives
\begin{align*}
d(x_k,x) \leq d(x_k,x_l) + d(x_l,x) < \varepsilon.
\end{align*}
Thus $x_k \to x$ in $M$. Since the original Cauchy sequence was arbitrary, every Cauchy sequence in $M$ converges in $M$, so $(M,d)$ is complete.
[/guided]
[/step]
[step:Use compactness to extract finite epsilon nets]
Assume again that $M$ is compact. Let $\varepsilon > 0$. If $M = \varnothing$, then $M$ is covered by the empty finite family of open balls of radius $\varepsilon$. Now suppose $M \neq \varnothing$. The family
\begin{align*}
\mathcal{U}_\varepsilon := \{B(x,\varepsilon) : x \in M\}
\end{align*}
is an [open cover](/page/Open%20Cover) of $M$. By compactness, there exist $N \in \mathbb{N}$ and points $x_1,\dots,x_N \in M$ such that
\begin{align*}
M \subset \bigcup_{i=1}^{N} B(x_i,\varepsilon).
\end{align*}
Thus, for every $\varepsilon > 0$, the space $M$ is covered by finitely many open balls of radius $\varepsilon$. Therefore $M$ is [totally bounded](/page/Totally%20Bounded).
[/step]
[step:Extract a Cauchy subsequence from total boundedness]
Assume that $(M,d)$ is complete and totally bounded. Let $(x_k)_{k=1}^{\infty}$ be an arbitrary sequence in $M$.
We construct infinite subsets
\begin{align*}
I_m \subset \mathbb{N}
\end{align*}
and points
\begin{align*}
a_m \in M
\end{align*}
for $m \in \mathbb{N}$ such that $I_{m+1} \subset I_m$ and
\begin{align*}
x_k \in B(a_m,2^{-m})
\end{align*}
for every $k \in I_m$.
For $m=1$, total boundedness gives a finite cover of $M$ by balls of radius $2^{-1}$. Since infinitely many terms of the sequence are distributed among finitely many balls, at least one such ball contains $x_k$ for infinitely many indices $k$. Choose its centre as $a_1$ and let $I_1$ be the infinite set of those indices.
Assume $I_m$ has been constructed. Total boundedness gives a finite cover of $M$ by balls of radius $2^{-(m+1)}$. Since $I_m$ is infinite, at least one ball in this finite cover contains $x_k$ for infinitely many indices $k \in I_m$. Choose its centre as $a_{m+1}$ and let $I_{m+1}$ be the infinite set of such indices. This completes the induction.
Now choose indices $n_m \in I_m$ recursively so that
\begin{align*}
n_1 < n_2 < n_3 < \cdots.
\end{align*}
This is possible because every $I_m$ is infinite. We claim that the subsequence $(x_{n_m})_{m=1}^{\infty}$ is Cauchy. Let $\varepsilon > 0$. Choose $m_0 \in \mathbb{N}$ such that
\begin{align*}
2^{1-m_0} < \varepsilon.
\end{align*}
If $p,q \geq m_0$, then $n_p,n_q \in I_{m_0}$ because the sets $I_m$ are nested. Hence
\begin{align*}
d(x_{n_p},x_{n_q}) \leq d(x_{n_p},a_{m_0}) + d(a_{m_0},x_{n_q}) < 2^{-m_0} + 2^{-m_0} = 2^{1-m_0} < \varepsilon.
\end{align*}
Therefore $(x_{n_m})_{m=1}^{\infty}$ is Cauchy. Since $M$ is complete, there exists $x \in M$ such that
\begin{align*}
x_{n_m} \to x.
\end{align*}
Thus every sequence in $M$ has a convergent subsequence.
[/step]
[step:Convert sequential compactness into compactness]
We now prove that $M$ is compact. Let $\mathcal{U}$ be an arbitrary open cover of $M$. Suppose, toward a contradiction, that no finite subfamily of $\mathcal{U}$ covers $M$. For a non-empty subset $A \subset M$, define its diameter by
\begin{align*}
\operatorname{diam}(A) := \sup\{d(u,v) : u,v \in A\}.
\end{align*}
First we show that there exists $\delta > 0$ such that every subset of $M$ with diameter less than $\delta$ is contained in some member of $\mathcal{U}$. If not, then for every $m \in \mathbb{N}$ there exists a non-empty subset $A_m \subset M$ such that
\begin{align*}
\operatorname{diam}(A_m) < 2^{-m}
\end{align*}
and $A_m$ is not contained in any member of $\mathcal{U}$. Choose $y_m \in A_m$ for each $m \in \mathbb{N}$. By the sequential compactness proved in the previous step, the sequence $(y_m)_{m=1}^{\infty}$ has a convergent subsequence $(y_{m_j})_{j=1}^{\infty}$ with limit $y \in M$.
Since $\mathcal{U}$ covers $M$, choose $U \in \mathcal{U}$ such that $y \in U$. Because $U$ is open, there exists $r > 0$ such that
\begin{align*}
B(y,r) \subset U.
\end{align*}
Choose $j$ so large that
\begin{align*}
d(y_{m_j},y) < \frac{r}{2}
\end{align*}
and
\begin{align*}
2^{-m_j} < \frac{r}{2}.
\end{align*}
For every $z \in A_{m_j}$, the definition of diameter gives
\begin{align*}
d(z,y_{m_j}) \leq \operatorname{diam}(A_{m_j}) < 2^{-m_j}.
\end{align*}
Therefore
\begin{align*}
d(z,y) \leq d(z,y_{m_j}) + d(y_{m_j},y) < r.
\end{align*}
Thus $A_{m_j} \subset B(y,r) \subset U$, contradicting the choice of $A_{m_j}$. Hence such a number $\delta > 0$ exists.
Since $M$ is totally bounded, choose finitely many points $c_1,\dots,c_N \in M$ such that
\begin{align*}
M \subset \bigcup_{i=1}^{N} B(c_i,\delta/3).
\end{align*}
For each $i \in \{1,\dots,N\}$, define
\begin{align*}
C_i := M \cap B(c_i,\delta/3).
\end{align*}
Then
\begin{align*}
M = \bigcup_{i=1}^{N} C_i.
\end{align*}
If $u,v \in C_i$, then the triangle inequality gives
\begin{align*}
d(u,v) \leq d(u,c_i) + d(c_i,v) < \frac{2\delta}{3} < \delta.
\end{align*}
Hence $\operatorname{diam}(C_i) < \delta$ for every $i \in \{1,\dots,N\}$. By the defining property of $\delta$, for each $i \in \{1,\dots,N\}$ there exists $U_i \in \mathcal{U}$ such that
\begin{align*}
C_i \subset U_i.
\end{align*}
Consequently
\begin{align*}
M = \bigcup_{i=1}^{N} C_i \subset \bigcup_{i=1}^{N} U_i.
\end{align*}
Thus $U_1,\dots,U_N$ is a [finite subcover](/page/Finite%20Subcover) of $\mathcal{U}$, contradicting the assumption that $\mathcal{U}$ had no finite subcover. Therefore every open cover of $M$ has a finite subcover, so $M$ is compact.
[/step]
[step:Combine the two implications]
If $M$ is compact, the first step proves that $M$ is complete and the second step proves that $M$ is totally bounded. Conversely, if $M$ is complete and totally bounded, the third step proves that every sequence in $M$ has a convergent subsequence, and the fourth step proves from this and total boundedness that every open cover of $M$ has a finite subcover. Hence $M$ is compact if and only if it is complete and totally bounded.
[/step]