My question is only concerning part (vi) of the question.

Sorry for posting the whole question, but I thought it might help someone to understand the context in which the question arises.

I got up to part (vi). I was wondering if the right track was to define $\displaystyle E_n:=\{x;d_E(x) < \frac{1}{n}\}

$, take the intersection of all the $\displaystyle E_n $, and prove that this new set is closed. If yes, I did not succeed, a little hint would be appreciated.

Let X be a metric space and let E be a nonempty subset of X. ($\displaystyle E \subset X

$) Define $\displaystyle d_E(x) = inf\{d(x,e);e \in E\}

$ .

(i) Use the triangle inequality to show that $\displaystyle d_E(x) \leq d(x,x') + d_E(x')

$.

(ii) Switching the roles of x and x′ and combining, show that $\displaystyle \left| d_E(x)-d_E(x') \right| \leq d(x,x')

$.

(iii) Deduce that $\displaystyle d_E : X \rightarrow [0, \infty[

$ is a continuous function.

(iv) If in addition E is a closed subset of X, show that $\displaystyle d_E(x)=0 \iff x \in E

$.

(v) Deduce from (iii) that for fixed t > 0, $\displaystyle \{x;d_E(x) < t\}

$ is an open subset of X containing E.

(vi) Choosing $\displaystyle t = \frac{1}{n}

$ , $\displaystyle n \in \mathbb{N}

$ in (v) show that every closed set of X can be written as the intersection of countably many open subsets of X.