Distance between compact sets in a metric space. 
Let $K_1$ and $K_2$ be two disjoint compact sets in a metric space $(X,d).$ Show that $$a = \inf_{x_1 \in K_1, x_2 \in K_2} d(x_1, x_2) > 0.$$
  Moreover, show that there are $x \in K_1$ and $y \in K_2$ such that $a = d(x,y)$.

For the first part, suppose to the contrary that $\inf d(x_1, x_2) = 0$. Then $\epsilon$ is not a lower bound, so $d(x_1, x_2) < \epsilon$ for all $\epsilon > 0$. Since $K_1$ and $K_2$ are compact subsets of a metric space, they are closed and bounded. So, then $B(x_1, \epsilon) \cap K_2 \neq \emptyset$. Thus, $x_1$ is an adherent point to $K_2$. Since $K_2$ is closed, this means $x_1 \in K_2$, a contradiction.
I'm stuck on the moreover part. I tried supposing to the contrary that $d(x,y) > a$, but I did not get far. 

As hint, I will leave you with a result and its corollary. See if you can use the corollary to prove the "moreover" part of the question.

Theorem: Let $f$ be a continuous function mapping from a compact set $X$ to a topological space $Y$. The image $f(Y)$ is compact.
Corollary: Let $f$ be a continuous function mapping from a compact set $X$ to $\mathbb{R}$. $f(X)$ is a compact subset of $\mathbb{R}$,
  and hence there exists $x\in X$ such that $f(x) = \inf f(X)$.

It's also a good exercise to prove the theorem above. To do so, use the characterization that $f$ is continuous if and only if its inverse image $f^{-1}$ maps open sets to open sets.
