A example of closed and bounded does not imply compactnesss in metric Space

Your metric generates the discrete space where every subset of $X$ is open (and thus also closed). It is bounded, because each point lies within a distance $1$ of some point $x_0$ (any will do). It is not compact, because $\{\{x\} \mid x \in X\}$ is an open cover of $X$, but you won't be able to pick finite subcover, because $X$ is infinite.

I hope this helps ;-)


Here is a simple example. Denote by $\ell^\infty$ the set of all bounded sequences of real numbers; put $$d(x,y) = \sup_n |x_n - y_n|.$$ Then all sequences of distance $\le 1$ from the zero sequence is closed, bounded but it is not compact.


By Riesz's lemma, we know that the unit ball which is closed and bounded of an infinite-dimensional normed space (which is a particular case of metric space) is never compact.