I drastically need help with these questions. I have been working on this last problem for hours and do not even know where to start or what I am doing. The questions are:
a) Let $K$ be a compact subset of $\mathbb{R}$ and $p \in \mathbb{R} \setminus K.$ Prove that there exist points $a, b \in K$ such that $|a - p| =$ inf$\{|x - p| : x \in K\}$ and $|b - p| =$ sup$\{|x - p| : x \in K\}.$
b) Are either of the above true if $K$ is only closed?
There is a sequence $x_n \in K$ such that $|x_n - p| \to\ \mathrm{inf} \{|x - p| : x \in K \}$.
As $K$ is compact, every Cauchy sequence in $K$ converges within $K$. So $x_n$ converges to some $x$.
Similarly for the supremum.
It does not work for closed sets, because for example the supremum can be infinite.