Subspace of Complete Metric Space is Closed iff Complete

Theorem
Let $\struct {M, d}$ be a complete metric space.

Let $\struct {S, d}$ be a subspace of $\struct {M, d}$.

Then $S$ is closed $S$ is complete.

Necessary Condition
Suppose that $S$ is not complete.

Then there exists a Cauchy sequence $\sequence {x_n}$ in $S$ such that the limit $\displaystyle x = \lim_{n \mathop \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$:
 * $\map d {x, x_n} < \epsilon$

Hence $M \setminus S$ is not open.

Therefore, $S$ is not closed.

Sufficient Condition
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 $\map d {x, y} < \epsilon$.

So there exists a sequence $\langle {y_n} \rangle$ in $S$ such that for all $n \in \N$:
 * $\map d {x, y_n} < \dfrac 1 n$

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

Let $N \in \N$ be such that for all $n \ge N$:
 * $\map d {x, y_n} < \dfrac \epsilon 2$

Let $m, n \ge N$.

Then, by the triangle inequality:
 * $\map d {y_m, y_n} \le \map d {x, y_m} + \map d {x, y_n} < \epsilon$

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

Because $\struct {M, d}$ is a complete metric space by assumption, the limit $\displaystyle \lim_{n \mathop \to \infty} y_n$ exists and is in $M$.

Denote this limit by $y$.

By the definition of $\sequence {y_n}$:
 * $\displaystyle \lim_{n \mathop \to \infty} \map d {x, y_n} = 0$

Because a metric is continuous and the composition of two continuous mappings is continuous:
 * $\map d {x, y} = 0$

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

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