Is there a metric space $(X,d)$, a compact set $K\subset X$ and a point $x \in X$ such that the distance $d(x,K)$ is NOT achieved on the boundary? Here, I'm defining $d(x,K) = \inf_{z\in K} d(x,z)$. Since $d$ is continuous and $K$ compact, them there is a point $z\in K$ such that $d(x,K) = d(x,z)$. I know that if $(X,d)$ have the structure of a Length Space with $d$ intrinsic to the length functional, then we can easily show that $z \in \partial K$. My question is: if $(X,d)$ have no such structure, can this be false? Is it possible to have an interior point $z \in K$ that is the minimum?
I'm more interested in the case of a closed ball in $X$ that is compact by hypothesis. Is it possible to construct a compact closed ball in which this happens?
Thank you very much.
 A: Start with $X$ obtained from $\mathbb R^2$ by removing the interior of the square $[-1,+1] \times [-1,+1]$:
\begin{align*}
X &= \{(x,y) \in \mathbb R^2 \mid |x| \ge 1, |y| \ge 1\} \\
K &= [1,2] \times [-1,+1] \\
p &= (-1,0)
\end{align*}
The point $q = (+1,0) \in K$ is the unique point of $K$ that minimizes the distance to $p$. But $q$ is an interior point of $K$ in the space $X$.
Note that the distance is indeed NOT intrinsic to the length functional: the distance between $p$ and $q$ in $X$ is $2$ but the shortest path in $X$ from $p$ to $q$ has length $4$, going around the periphery of the square $[-1,+1] \times [-1,+1]$.
As for your question regarding a closed ball, do you mean that you want $K$ to be a closed ball? If so then we can modify $K$ easily: take $K$ to be the closed ball in $X$ with center $(1.1,0)$ and radius $.2$. Instead of a rectangular shape as in the $K$ above, this $K$ would be the closed Euclidean disc with that same center and radius, with a portion cut off that is bounded by the chord where that disc intersects the line $x=1$. All interior points of that chord, including $(+1,0)$, will be interior points of $K$.
