- A subset of the real numbers
**R**is compact iff it is closed and bounded.

The theorem is true not only for the real numbers, but also for some other metric spaces: the complex numbers, the p-adic numbers, and Euclidean space **R**^{n}. However, it fails for the rational numbers and for infinite dimensional normed vector spaces.
The proper generalization to arbitrary metric spaces is:

- A subset of a metric space is compact if and only if it is complete and totally bounded.

- It is obvious that any compact set E is totally bounded.
- Let (x
_{n}) be an arbitrary Cauchy sequence in E; let F_{n}be the closure of the set {x_{k}: k >= n} in E and U_{n}:= E - F_{n}. If the intersection of all F_{n}would be empty, (U_{n}) would be an open cover of E, hence there would be a finite subcover (U_{nk}) of E, hence the intersection of the F_{nk}would be empty; this implies that F_{n}is empty for all n larger than any of the n_{k}, which is a contradiction. Hence, the intersection of all F_{n}is not empty, and any point in this intersection is an acculumation point of the sequence (x_{n}). - Any accumulation point of a Cauchy sequence is a limit point (x
_{n}); hence any Cauchy sequence in E converges in E, in other words: E is complete.

- If E would not be compact, there would exist a cover (U
_{l})_{l}of E having no finite subcover of E. Use the total boundedness of E to define inductively a sequence of balls (B_{n}) in E with- the radius of B
_{n}is 2^{-n}; - there is no finite subcover (U
_{l}∩B_{n})_{l}of B_{n}; - B
_{n+1}∩B_{n}is not empty.

- the radius of B
- Let x
_{n}be the center point of B_{n}and let y_{n}be any point in B_{n+1}∩B_{n}; hence we have d(x_{n+1},x_{n}) <= d(x_{n+1},y_{n})+d(y_{n},x_{n}) <= 2^{-n-1}+2^{-n}<= 2^{-n+1}. It follows for n <= p < q: d(x_{p},x_{q}) <= d(x_{p},x_{p+1}) + ... + d(x_{q-1},x_{q}) <= 2^{-p+1}+ ... + 2^{-q+2}<= 2^{-n+2}. Therefore, (x_{n}) is a Cauchy sequence in E, converging to some limit point a in E, because E is complete. - Let l
_{0}be an index such that U_{l0}contains a; since (x_{n}) converges to a and U_{l0}is open, there is a large n such that the ball B_{n}is a subset of U_{l0}- in contradiction to the construction of B_{n}.