question in metric space completion properties

Dear all I was given this question in topology which I would really appreciate help with: I am asked to prove that for every metric space we have that the space itself is totally bounded if and only if its completion is compact. Here is what I have done so far: compactness in metric spaces is equivalent to completeness and it being totally bounded. Here is the thing I know by definition that any completion we take (all isometric so no matter which) is complete so all that I must show is that any metric space X is totally bounded if and only if its completion is totally bounded which I know sounds true but I cannot actually prove this. Could someone help a novice with this proof please? Thank you

One direction is easy: if $\overline{X}$ is compact, then $\overline{X}$ is totally bounded, so that $X \subset \overline{X}$ is totally bounded.

For the other direction, suppose $X$ is totally bounded.

Then $\overline{X}$ is clearly complete, so all we need to do is to prove that $\overline{X}$ is totally bounded.

Pick some $\varepsilon>0$. Choose $x_1, ..., x_n \in X$ such that $X = \bigcup_1^n B(x_j, \varepsilon/3)$.

I claim that $\overline{X} = \bigcup_1^n B(x_j,\varepsilon)$. This is true because given $u \in \overline{X}$, we can find a sequence $(u_k)$ of points of $X$ which converge to $u$. This $u_n$ forms a Cauchy sequence, and so there exists some $N$ such that $d(u_k,u_m) < \varepsilon/3$ whenever $k,m \geq N$. Pick some $1\leq i \leq n$ such that $u_N \in B(x_i, \varepsilon/3)$; we can do this since $u_N \in X = \bigcup_1^n B(x_j, \varepsilon/3)$. Whenever $k \geq N$, we see that $d(u_k,x_i) \leq d(u_k,u_N)+d(u_N,x_i) < 2\varepsilon/3$. Therefore $$d(u,x_i) = \lim_{k \to \infty} d(u_k,x_i) \leq \frac{2\varepsilon}{3}<\varepsilon$$

Therefore $u \in B(x_i, \varepsilon)$. Since $u \in \overline{X}$ was arbitrary, it follows that $\overline{X} = \bigcup_1^n B(x_j,\varepsilon)$. Since $\varepsilon$ was arbitrary, it follows that $\overline{X}$ is totally bounded.

Edit: Okay, the above answer is more complicated than it has to be. A much better answer was given by Brian M. Scott, but he deleted it for some reason so I'm "reinstating" it as part of this edit.

$\overline{X}$ is clearly complete, so all we need to do is to prove that $\overline{X}$ is totally bounded.

Pick some $\varepsilon>0$. Choose $x_1, ..., x_n \in X$ such that $X = \bigcup_1^n B(x_j, \varepsilon/2)$.

Pick arbitrary $u \in \overline{X}$. Since $X$ is dense in $\overline{X}$, it follows that there exists some $x \in X$ such that $d(u,x)<\varepsilon/2$. Since $x \in X$, it follows that $x \in B(x_i,\varepsilon/2)$ for some $1 \leq i \leq n$.

Then it follows that $u \in B(x_i,\varepsilon)$, since $d(u,x_i) \leq d(u,x)+d(x,x_i) < \varepsilon$.

Therefore $u \in B(x_i, \varepsilon)$. Since $u \in \overline{X}$ was arbitrary, it follows that $\overline{X} = \bigcup_1^n B(x_j,\varepsilon)$. Since $\varepsilon$ was arbitrary, it follows that $\overline{X}$ is totally bounded.

• Awesome pure awesome @Shalop thank you very much indeed – kroner May 16 '15 at 21:05
• @zbigniew2015: I noticed that you accepted my answer almost immediately after I posted it. I do appreciate it, but I do seem to wonder whether you carefully examined it before accepting it? In general it's good to take time to thoroughly read answers before accepting them :) – Shalop May 16 '15 at 21:20
• yes @Shalop I most certainly did as you basically filled in the blanks where I was stuck (I wasn't completely stuck) going over it again just to be sure I got it fully Thanks for your concern – kroner May 16 '15 at 21:24