Closed but not compact in a metric space Below is an exercise in the set of lecture notes I'm working through, but I believe it to be false. First, this is the definition of compact I'm working with.

A metric space $X$ is said to be compact if every sequence $\{x_n\}$ of points in $X$ has a convergent subsequence.

The exercise is then:

Let $X$ be compact, and let $V \subset X$ be a subset. Show that $V$ is compact if and only if it is closed.

I believe this result is false, but my counterexample doesn't use the above definition. In $\mathbb{R}^n$, compactness is equivalent to closed and bounded (by the Heine-Borel theorem). So take $\mathbb{R}$ with the Euclidean metric. Then $[0, \infty)$ is closed, but not bounded (above) and therefore not compact.
Have I done something wrong, or is this above result not true?
 A: Note that your exercise is imposing the condition that the ambient space ($X$, or $\mathbb{R}$ in your example) is compact. As $\mathbb{R}$ is not compact, your example is not a counterexample for the exercise.
A: $(X, d) $ compact. $Y\subseteq X$ is compact iff $Y\subseteq X$ is closed.
Proof:
$Y\subseteq X$ and $(Y, d_Y) $ is compact.
Suppose, $(y_n) \subseteq Y$ be any sequence with $(y_n)\to x $ in $(X, d) $.
Since,  $(Y, d_Y) $ is compact, $\exists (y_{n_k}) $ a convergent subsequence of $(y_n) $ in the space $(Y, d_Y) $
Then, $(y_{n_k})\to x \leftarrow (x_n) $
This implies , $x\in Y$
Hence, $Y\subset X$ is closed.
Conversely.
$Y\subset X$ is closed.
To show, $(Y, d_Y) $ is compact.
Let, $(x_n) \subseteq Y$ be any sequence.
Then, $(x_n) \subseteq X$ and due to compactness of $(X, d) $ , there exists a subsequence $(x_{n_k}) $ such that $(x_{n_k}) \to x $ in $(X, d) $
Since, $(x_{n_k}) \subseteq Y $ and $Y\subseteq X $ is closed implies $x\in Y$.
Hence, every sequence in $(Y, d_Y) $ has a convergent subsequence and this implies  $(Y, d_Y) $ is compact.
Hence, such counter example what you have tried to find, is not possible.
