In Berkeley Problems in Mathematics (collection of their previous qualifying exam problems), problem 4.1.11 asks us to prove:
"Let $X$ and $Y$ are nonempty subsets of a metric space M. Define $$d(X, Y)=\inf\{d(x,y) | x\in X, y\in Y\}.$$
Suppose $X$ contains only one point $x$ and $Y$ is closed. Prove $$d(X, Y)=d(x,y)$$ for some $y\in Y$.
Suppose $X$ is compact and $Y$ is closed. Prove $$d(X, Y)=d(x,y)$$ for some $x\in X$ and $y\in Y$."
However, at least problem 2 seems to be false according to this old thread: If $A$ is compact and $B$ is closed, show $d(A,B)$ is achieved, where the counterexample using the space $M=\{0\}\cup (1, 2)$ was used.
Despite this, the Berkeley book provides a proof of the two above statements and I'm not sure of where these proofs fail. Could someone help me spot the error in this proof that fails, especially for a situation like the counterexample given in the old thread?
The Berkeley proof:
"1. Let $X = {x}$ and $(y_n)$ be a sequence in $Y$ such that $|x - y_n| < d(X, Y) + 1/n$. As $(y_n)$ is bounded, passing to a subsequence, we may assume that it converges, to $y$, say. As $Y$ is closed, $y \in Y$ and, by the continuity of the norm, $|x - y| = d(X, Y).$
- Let $(x_n)$ be a sequence in $X$ such that $d((x_n), Y) < d(X, Y) + 1/n.$ As $X$ is compact, by the Bolzano-Weierstrass Theorem [Rud87, p. 40], [MH93, p. 153], we may assume, passing to a subsequence, that $(x_n)$ converges, to $x$, say. We then have $d(X, Y) = d({x}, Y)$ and the result follows from Part 1."