Subspace of Complete Metric Space is Closed iff Complete

Theorem
Let $\left( {M, d} \right)$ be a complete metric space.

Let $\left( {S, d} \right)$ be a subspace of $\left( {M, d} \right)$.

Then $S$ is closed if and only if $S$ is complete.

If $S$ is not complete, then $S$ is not closed
Suppose that $S$ is not complete.

Then there exists a Cauchy sequence $\langle {x_n} \rangle$ in $S$ such that the limit $\displaystyle x = \lim_{n\to\infty} x_n$, which exists in the complete metric space $M$, is not a member of $S$.

For all $\epsilon > 0$, there exists an $N \in \N$ such that for all $n \ge N$, $d \left( {x, x_n} \right) < \epsilon$.

Hence $M\setminus S$ is not open.

Therefore, $S$ is not closed.

If $S$ is not closed, then $S$ is not complete
Suppose that $S$ is not closed.

Then $M \setminus S$ is not open.

Therefore, there exists a $x \in M \setminus S$ such that for all $\epsilon > 0$, there exists a $y \in S$ such that $d \left( {x, y} \right) < \epsilon$.

So there exists a sequence $\langle {y_n} \rangle$ in $S$ such that for all $n \in \N$, $\displaystyle d \left( {x, y_n} \right) < \frac 1 n$.

Now, we show that $\langle {y_n} \rangle$ is a Cauchy sequence.

Let $N \in \N$ be such that for all $n \ge N$, $\displaystyle d \left( {x, y_n} \right) < \frac \epsilon 2$.

Let $m, n \ge N$. Then, by the triangle inequality, $d \left( {y_m, y_n} \right) \le d \left( {x, y_m} \right) + d \left( {x, y_n} \right) < \epsilon$.

Hence $\langle {y_n} \rangle$ is a Cauchy sequence.

Because $\left( {M, d} \right)$ is a complete metric space by assumption, the limit $\displaystyle \lim_{n\to\infty} y_n$ exists and is in $M$. Denote this limit by $y$.

By the definition of $\langle {y_n} \rangle$, $\displaystyle \lim_{n\to\infty} d \left( {x, y_n} \right) = 0$.

Because a metric is continuous and the composition of two continuous functions is continuous, $d \left( {x, y} \right) = 0$.

By the definition of a metric, this implies that $x = y$.

Since $y \notin S$, $S$ is not complete.