Does $dist(x, \partial A) \leq dist(x, \partial B)$ if $x \in A \subset B$? Let $(M,d)$ be a metric space, let $A \subset B \subset M$, and let $x \in A$. Does the inequality below hold?
$$
dist(x, \partial A) \leq dist(x, \partial B)
$$
Follow-up question: if not, does it hold if we add either/both of the following restrictions: 


*

*$A$ and $B$ are open

*$(M,d)$ is $\mathbb{R}^n$ with the usual distance


NOTE: for any set $E \subset M$, we define $dist(x, E) = \inf \{ d(x,z) : z \in E \}$
 A: This result is true for $\mathbb{R}^n$, without any conditions required on $A$ and $B$; see the proof below. In fact, the proof could easily be generalized to any normed vector space.
The result is not true for arbitrary metric spaces, even when imposing the condition that $A$ and $B$ are open; see the counterexample below.
Proving the result for $\mathbb{R}^n$
Let $x \in A \subset B \subset \mathbb{R}^n$. Let $z \in \partial B$. We consider two cases:
Case 1: $z \in \overline{A}$ 
If $z \in \overline{A}$, then we claim that in fact $z \in \partial A$. On one hand, there is a sequence in $A$ approaching $z$ since $z$ is in the closure. On the other hand, there is a sequence in $\mathbb{R}^n \backslash B$ approaching $B$ since $z \in \partial B$, and $\mathbb{R}^n \backslash B \subset \mathbb{R}^n \backslash A$ since $A \subset B$. Therefore $z \in \partial A$, and so $d(x,z) \geq dist(x, \partial A)$.
Case 2: $z \notin \overline{A}$
Here is where we'll need properties of $\mathbb{R}^n$. Consider the following value:
$$
\gamma = \sup \{ \lambda \in [0,1] : (1-\zeta) x + \zeta z \in A \text{ for each } \zeta \in [0, \lambda] \}
$$
This supremum is well-defined: $0$ is in this set since $x \in A$. Moreover, $\gamma < 1$ since $z \notin \overline{A}$. We claim that $(1-\gamma) x + \gamma z \in \partial A$. We know that for $\lambda \in [0,\gamma)$, $(1-\lambda) x + \lambda z \in A$, and moreover there exists a $\lambda \in [0, \gamma + \epsilon)$ such that $(1-\lambda) x + \lambda z \notin A$ for every $\epsilon > 0$ (since otherwise we'd get a contradiction with the supremum definition). Thus, we have two sequences approaching $(1-\gamma) x + \gamma z$: one contained in $A$, and one contained in $\mathbb{R}^n \backslash A$. So, $(1-\gamma) x + \gamma z \in \partial A$.
Finally, recall that in $\mathbb{R}^n$, $d(x,y)=\|x-y\|$. It is easy to check via norm properties that:
$$
d(x,z) = \|x-z\| = \|x - ((1-\gamma) x + \gamma z)\| + \|z - ((1-\gamma) x + \gamma z)\|
\\ \geq
d(x,(1-\gamma) x + \gamma z)) \geq dist(x, \partial A)
$$
Conclusion
We've therefore established that $d(x,z) \geq dist(x, \partial A)$ for any $z \in \partial B$. Taking the infimum, we conclude that $dist(x, \partial B) \geq dist(x, \partial A)$.
Counterexample for the general case
This counterexample was inspired by this question. Consider the metric space $\mathbb{R} \times \{ 0,1 \} $, with distance measured as the distance in $\mathbb{R}^2$ (we can view this space as two lines in $\mathbb{R}^2$). Consider:
$$
A= (-10, 10) \times \{0\},
\qquad
B = A \cup [(-1,1) \times \{1\}],
\qquad
x = (0,0)
$$
Then $dist(x,\partial A) = 10$, but $dist(x, \partial B) = \sqrt{2}$. Below is a visual aid.

Here, $M$ is in black, $A$ is in blue, $B$ is in red, $x$ is in green, $\partial A$ is in light blue, and $\partial B$ is in orange.
