The distance between a point $a \in \mathbb{R}$ and a set $X \subset \mathbb{R}$ is defined as $d(a,X) := \inf\{|x-a|: x \in X\}.$ How to prove if $X$ is closed, then there is a $b \in X$ such that $d(a,X) = |b-a|$?
I've constructed a decreasing sequence converging to $d$ as follows: Given $r > d(a,X)$, there is a $x \in X$ such that $|x-a| < r$. Repeating the process with $r_{n+1} := \frac{d+r_n}{2}$ we get the inequality:
$d \leq |x_n-a| < r_n$
It's easy to prove that $r_n \mapsto d$, and therefore $|x_n-a| \mapsto d$. If i could show the set $A := \{|x-a|: x\in X\}$ is closed, the result would be immediate. This is somehow my second question, is true that for every closed set $X$, the set $|X| := \{|x|: x\in X\}$ is closed?
Be free to contribute alternative proofs, i would appreciate.