# $A$ is compact and closed then prove …

I am taking an introductory real analysis course and I have difficulty understanding and solving the problem below .Is it trying to say that we have an infimum for the distance between every two points in $$A$$ and another arbitrary set? $$A$$ is compact and closed then prove there exist an $$a$$ member of $$A$$ and $$b$$ a member of $$B$$ such that $$d(a,b) = d(x,y)$$ ($$x$$ is a member of $$A$$ and $$y$$ a member of $$B$$).

For $$A,B$$ two non-empty sets, $$d(A,B):= \inf \{d(x,y): x \in A, y \in B\}$$ always exists, as we have a set of real numbers that is non-empty and bounded below (by $$0$$ trivially). The same holds for $$d(x,B) = \inf \{d(x,b); b \in B\}$$ as a special case.
However, we can note that the function $$f_B: x \to d(x,B)$$ is continuous for $$x \in X$$ (as $$|d(x,B) - d(x', B)| \le d(x,x')$$ by the triangle inequality, so the function is contractive hence uniformly continuous) and so $$f_B$$ assumes a minimum and maximum value on the compact subset $$A$$.
If we do not assume anything on $$B$$ we need not always have such $$a,b$$ as asked for: $$A = [0,1], B = (1,2)$$ is an example where $$d(A,B)=0$$ and $$A$$ is compact. If $$B$$ too is compact we do have such $$a,b$$, e.g. In many cases $$B$$ being closed is also sufficient besides $$A$$ compact.