A problem in metric space $\mathbb{R}^n$ Let $\Omega$ be a open subset of $\mathbb{R}^n$,and $K$ be compact set contains in it.
Now show,given $d = dist(\partial\Omega,K)$,  we have $K\subset \bigcup_{x\in K}B(x,\frac{d}{2})\subset\subset \Omega$
I try to prove as follows:First compactification of $\mathbb{R}^n$ to compact Hausdorff space denoted it $E$.then $E-\Omega$ is a compact set so there are disjoint neighborhood contains $x\in K$ and $E-\Omega$.The question here is how to choose this neighborhood based on $d = dist(\partial\Omega,K)$?so the intermediate set is of the form $\bigcup_{x\in K}B(x,\frac{d}{2})$
(Following the idea from here)
 A: You can just set $V=\cup_{x\in K}B(x,\frac{2}{3}d)$, then holds
$$\cup_{x\in K}B(x,\frac{1}{2}d)\subset V\subset \overline{V}\subset\Omega. $$
We suffice to show that $\overline{V}\subset \Omega$.
For any $y\in \overline{V}$, choose a sequence in $V$ which converges to $y$:
$y_n\in V$ and $y_n\to y$ as $n\to +\infty$.
Then $\text{dist}(y,K)=\lim_n \text{dist}(y_n,K)\leqslant \frac{2}{3}d$. Hence $y\in \Omega$.
I list some propositions that may help here.
(i) If $x\in\mathbb{R}^n$ and $\text{dist}(x,K)<d$, then $x\in \Omega$.
(ii) $\phi:\mathbb{R}^n\to\mathbb{R}, \phi(x)=\text{dist}(x,K)$ is continuous.
Proof of (i):
It is sufficient to prove that $B(x,d)\subset \Omega$ for all $x\in K$.
Note that $\forall y\in B(x,d)$, it holds that $y\notin \partial \Omega$, since $\text{dist}(y,K)<d$.
$\forall y\in B(x,d)$, set $x_t=(1-t)x+ty$, $t\in[0,1]$. Hence $x_0=x, x_1=y$, and $x_t\in B(x,d),~\forall t\in[0,1]$.
Since $x\in \Omega$ open, there $\exists t_0\in(0,1)$, such that $x_t\in\Omega, \forall t\in[0,t_0]$.
Let
$$
t^*=\sup \{t\in[0,1];\forall \tau\in[0,t], x_{\tau}\in\Omega\}.
$$
The right hand side is non-empty since $t_0$ is in it. Thus $t^*$ is well-defined, and $1\geqslant t_*\geqslant t_0>0$. Then $$x_t\in \Omega,~\forall t\in[0,t^*)\quad\quad(\star).$$
If $x_{t*}\notin \Omega$, then $x_{t^*}\in (\overline\Omega)^{\text{C}}$, as stated before.
Notice that $(\overline\Omega)^{\text{C}}$ is open, then there $\exists \delta>0$, such that $x_t\in (\overline\Omega)^{\text{C}}$, $\forall t\in B(t^*,\delta)\cap[0,1]$. This conflicts with $(\star)$.
Thus $x_{t^*}\in \Omega$.
If $t_*<1$, then with $x_{t^*}\in\Omega$ open in mind, again there exist $t_1\in(t_*,1)$, such that $x_t\in \Omega,~\forall t\in[t_*,t_1]$. Then $x_t\in \Omega,~\forall t\in[0,t_1]$ with $t_1>t_*$, which conflicts the supremacy of $t^*$.
QED.
Another Proof of (i):
For any $x\in K$, $B(x,d)\cap \partial\Omega=\emptyset$, thus $B(x,d)\subset \Omega\cup (\overline{\Omega})^{\text{C}}$. Notice that $B(x,d)$ is connected and open, $\Omega, (\overline{\Omega})^{\text{C}}$ are open, and $\Omega, (\overline{\Omega})^{\text{C}}$ are disjoint.
Then we get that one of $B(x,d)\cap\Omega$, $B(x,d)\cap(\overline{\Omega})^{\text{C}}$ must be emptyset. Since $x\in \Omega$, then $B(x,d)\cap(\overline{\Omega})^{\text{C}}=\emptyset$. QED.
Proof of (ii):
For any $x,y,z\in\mathbb{R}^n$,
$$\text{dist}(x,z)\leqslant \text{dist}(y,z)+\text{dist}(x,y).$$
Take the infimum for $z\in K$ at the both sides one gets
$$
\text{dist}(x,K)\leqslant \text{dist}(y,K)+\text{dist}(x,y).
$$
Thus $\text{dist}(x,K)-\text{dist}(y,K)\leqslant \text{dist}(x,y)$.
Similarly, $\text{dist}(y,K)-\text{dist}(x,K)\leqslant \text{dist}(x,y)$, leading to the conclution as $|\text{dist}(y,K)-\text{dist}(x,K)|\leqslant \text{dist}(x,y)$.   QED.
