# Prove that there exists a point $a$ in $A$ such that $| c-a | =\inf \{| c-x |: x \in A \}$?

Let $A$ be a nonempty compact subset of $\mathbb{R}$ and $c \in \mathbb{R}$.

Prove that there exists a point $a$ in $A$ such that $| c-a | =\inf \{| c-x |: x \in A \}$?

Hint. For every $n\in\mathbb{N}$ there exists $x_n\in A$ such that $$\inf\{|c-x|\mid x\in A\} \leq |c-x_n|\lt \inf\{|c-x|\mid x\in A\}+\frac{1}{n}.$$ What do you know about sequences contained in a compact subset of $\mathbb{R}$?
Another approach: If you have learned more general result that any continuous function on a compact space attains its supremum and infimum (see Extreme value theorem at Wikipedia or this question), then it suffices to show that the function $f\colon\mathbb R\to\mathbb R$ defined by $f(x)=|x-c|$ is continuous (for any given $c$).