# The metric space containing a compact subset is separable

Let (X,d) be a metric space and K be a cpt subset of X. If it is possible to derive 'X is compact', then since compact metric space is separable, X is separable. But I'm not sure that X is compact. Do I have to prove that X is compact?, or Is there another method I don't know?

• Just because $X$ has a compact subspace does not mean that $X$ is itself compact. For example, take $(X,d)=(\mathbb{R},|\cdot|)$, the real line with the Euclidean metric. Here, $[0,1]$ is a compact subspace, but certainly $\mathbb{R}$ is not compact. – Hayden May 20 '14 at 1:48
• Yes, it's very helpful, thanks! – Hobin. J May 20 '14 at 2:13

No, $\Bbb R$ is not compact in the usual metric, and $[0,1]$ is compact. The claim is certainly false in general, since any singleton is compact in any metric space of your liking, but there exist non-separable metric spaces.