For 2 sets $A,B \subseteq \Bbb R^n$ such that $A \cap B$ = $\emptyset$, denote: $d(A,B):=$ inf$\{||x-y|| : x\in A, y \in B \}$.
Show that if $A$ is compact and $B$ is closed, then there exists $a^* \in A, b^* \in B$ such that $||a^*-b^*|| = d(A,B).$
I'm trying to prove it using extreme value theorem. I thought about something like defining $f:A \to B, f(a)= \inf\{||a-b|| : b \in B \}$, but I don't know whether this function is even continous. Any ideas? other options of proof are great too.
Show the function $\phi(a) = \inf_{b \in B} \|a-b\|$ is continuous.
$\|a'-b\| \le \|a-b\| + \|a'-a\|$, so $\phi(a') \le \|a-b\| + \|a'-a\|$ and then $\phi(a') \le \phi(a) + \|a'-a\|$. Reversing the rôles of $a,a'$ shows that $\phi$ is Lipschitz of rank 1.
Hence there is some $a^*$ such that $\phi(a^*) = \min_{a \in A} \phi(a)$ and so $\inf_{b' \in B} \|a^*-b'\| \le \|a-b\|$ for all $a \in A, b \in B$.
Now choose any $\tilde{b} \in B$ and let $R = \|a^*- \tilde{b}\|$, then we have $\inf_{b \in B} \|a^*-b\| = \inf_{b' \in B \cap \overline{B}(a^*, L)} \|a^*-b'\| $ and since $B \cap \overline{B}(a^*,L) \subset \mathbb{R}^n$ is compact (because it is closed & bounded) we see that there is some $b^*\in B$ such that $\|a^*-b^*\| = \phi(a^*) \le \|a-b\|$ for all $a \in A, b \in B$.
Aside: The result relies on the fact that a closed bounded set in $\mathbb{R}^n$ is compact which is not always true in a Banach space. See Ex. 4 in Ch. 5 of Rudin's "Real & Complex Analysis". It describes a closed convex set which has no point of minimal norm (so you would take $A = \{0\}$).