Tutorials › Topology (Undergraduate) › Separating Closed Sets in Metric Spaces

Regular and Normal Spaces · Tutorial 335 of 799

Separating Closed Sets in Metric Spaces

Use distance functions to build disjoint open neighborhoods of closed sets, even when no positive uniform gap separates them.

Advanced 9 min read

What You'll Learn

  • Define distance from a point to a nonempty set and establish its continuity.
  • Separate disjoint closed sets using strict comparisons of their distance functions.
  • Distinguish pointwise positive distances from a positive distance between sets.
  • Identify when fixed-radius neighborhoods give a valid separation.
  • Diagnose common errors involving zero distance and nonclosed sets.

Distance to a Set as a Local Measure

In a metric space, closed sets can be separated by disjoint open neighborhoods. A tempting approach is to put a fixed-radius neighborhood around each set. That works when the sets have a positive gap, but disjoint closed sets need not have one: they may come arbitrarily close in different parts of the space. Distance-to-set functions give a more flexible construction, because their comparison is made separately at each point.

Throughout, \((X,d)\) is a metric space with its metric topology. For a nonempty subset \(A\subseteq X\), define the distance from \(x\in X\) to \(A\) by \(d(x,A)=\inf\{d(x,a):a\in A\}\). The distance between two nonempty subsets is \(d(A,B)=\inf\{d(a,b):a\in A,\ b\in B\}\). These are infima, not necessarily attained minima. In particular, \(d(A,B)=0\) does not by itself imply that \(A\) and \(B\) intersect.

Definition: For \(r>0\), the open \(r\)-neighborhood of a nonempty set \(A\) is \(N_r(A)=\{x\in X:d(x,A)<r\}\). The strict inequality matters: points at distance exactly \(r\) are not included.

The basic estimate behind the method is that distance to a fixed nonempty set changes by at most the distance between the points.

Proposition: If \(A\ne\varnothing\), then for all \(x,y\in X\), \(\lvert d(x,A)-d(y,A)\rvert\le d(x,y)\). Consequently, \(x\mapsto d(x,A)\) is continuous.

Proof. For any \(a\in A\), the triangle inequality gives \(d(x,a)\le d(x,y)+d(y,a)\). Taking the infimum over \(a\in A\) yields \(d(x,A)\le d(x,y)+d(y,A)\). Interchanging \(x\) and \(y\) gives \(d(y,A)\le d(x,y)+d(x,A)\). Together these inequalities give the stated absolute-value bound. To verify continuity at \(x\), let \(\varepsilon>0\). If \(d(x,y)<\varepsilon\), the bound implies \(\lvert d(x,A)-d(y,A)\rvert<\varepsilon\), which is the metric definition of continuity. \(\square\)

Closedness supplies another crucial fact. If \(C\) is closed and \(x\notin C\), then \(d(x,C)>0\), provided \(C\ne\varnothing\). Indeed, \(X\setminus C\) is open and contains \(x\), so some open ball \(B_d(x,r)\) is contained in \(X\setminus C\). Every \(c\in C\) therefore satisfies \(d(x,c)\ge r\), giving \(d(x,C)\ge r>0\). This is a pointwise statement: the positive lower bound \(r\) may depend on \(x\).

Constructing Disjoint Open Neighborhoods

Theorem: Let \(A\) and \(B\) be disjoint closed subsets of a metric space \((X,d)\). There exist disjoint open sets \(U,V\subseteq X\) with \(A\subseteq U\) and \(B\subseteq V\).

Proof. If \(A=\varnothing\), take \(U=\varnothing\) and \(V=X\); these are disjoint open sets containing \(A\) and \(B\), respectively. If \(B=\varnothing\), take \(U=X\) and \(V=\varnothing\). Now suppose both sets are nonempty and define \(U=\{x\in X:d(x,A)<d(x,B)\}\) and \(V=\{x\in X:d(x,B)<d(x,A)\}\). The proposition shows that both distance functions are continuous, so their difference is continuous. Thus \(U\), the preimage of \((-\infty,0)\) under \(x\mapsto d(x,A)-d(x,B)\), is open; the same reasoning shows \(V\) is open. At every \(a\in A\), \(d(a,A)=0\), while \(d(a,B)>0\) because \(B\) is closed and \(a\notin B\). Hence \(a\in U\). For every \(b\in B\), \(d(b,B)=0\) and \(d(b,A)>0\), so \(b\in V\). Finally, no point can satisfy both strict inequalities \(d(x,A)<d(x,B)\) and \(d(x,B)<d(x,A)\); therefore \(U\cap V=\varnothing\). \(\square\)

The strict comparison is pointwise and does not demand a uniform gap between the sets. Points where the two distances are equal belong to neither constructed neighborhood; that causes no problem, since the theorem asks for disjoint open sets containing the closed sets, not for neighborhoods whose union is all of \(X\).

Worked Example: Closed Intervals with a Positive Gap

In \(\mathbb{R}\) with its standard metric, let \(A=[-2,-1]\) and \(B=[1,3]\). Both intervals are closed and disjoint. The smallest distance between a point of \(A\) and a point of \(B\) is the distance from \(-1\) to \(1\), namely \(1-(-1)=2\), so \(d(A,B)=2\).

Choose \(r=1/3\). For \(x\in\mathbb{R}\), the condition \(d(x,A)<1/3\) is equivalent to \(-2-1/3<x<-1+1/3\), so \(N_{1/3}(A)=(-7/3,-2/3)\). Similarly, \(d(x,B)<1/3\) gives \(N_{1/3}(B)=(2/3,10/3)\). The first interval ends at \(-2/3\) and the second starts at \(2/3\), so they are disjoint. Each contains its corresponding closed interval.

Check: The chosen radius satisfies \(2r=2/3<2=d(A,B)\), as required for these neighborhoods to remain disjoint. The strict endpoint exclusions also matter: neither neighborhood includes its displayed endpoints.

When Disjoint Closed Sets Have Distance Zero

The interval example has a positive gap, but that is not guaranteed by disjointness and closedness alone. The distance functions still separate the sets: each point of one set has distance zero to that set and positive distance to the other. These positive values can approach zero as the point varies across the set.

Worked Example: Two Closed Sets with Zero Distance

In \(\mathbb{R}\), let \(A=\{n:n\in\mathbb{N}\}\) and \(B=\{n+1/(n+1):n\in\mathbb{N}\}\), where \(\mathbb{N}=\{1,2,\dots\}\). Every point of \(B\) lies strictly between \(n\) and \(n+1\), so \(A\cap B=\varnothing\).

Both sets are closed. To check this, any bounded interval meets each set in only finitely many points, since the indices of points in that interval are bounded. If \(x\) is outside one of the sets, first choose a bounded open interval around \(x\); within it there are only finitely many points of the set. Because none equals \(x\), a smaller open interval around \(x\) avoids all those finitely many points. Thus the complement of each set is open.

For each \(n\in\mathbb{N}\), the pair \(n\in A\) and \(n+1/(n+1)\in B\) has distance \(1/(n+1)\). These distances approach zero, so \(d(A,B)=0\): the infimum is at most \(1/(n+1)\) for every \(n\), and all distances are nonnegative.

Nevertheless, define \(U=\{x:d(x,A)<d(x,B)\}\) and \(V=\{x:d(x,B)<d(x,A)\}\). The theorem proves these sets are open and disjoint. More explicitly, \(d(n,A)=0\) and \(d(n,B)=1/(n+1)>0\). To see the latter value, the point \(n+1/(n+1)\) is \(1/(n+1)\) from \(n\); any \(B\)-point with index \(k<n\) is at most \(n-1/2\), and any with \(k>n\) is at least \(n+1\), so neither is closer. Similarly, \(d(n+1/(n+1),B)=0\) and its distance to \(A\) is \(1/(n+1)>0\). Hence \(A\subseteq U\) and \(B\subseteq V\).

Check: At each paired point, the midpoint \(x_n=n+1/(2(n+1))\) is at distance \(1/(2(n+1))\) from both sets. These equal-distance points are outside both \(U\) and \(V\), consistent with their definition. The set-to-set distance is zero even though each individual point of \(A\) has positive distance from \(B\).

Fixed-Radius Neighborhoods and Their Limits

If \(d(A,B)=\delta>0\), fixed-radius neighborhoods do give a convenient alternative. For example, \(N_{\delta/3}(A)\) and \(N_{\delta/3}(B)\) are disjoint. If \(x\) belonged to both, the strict inequalities \(d(x,A)<\delta/3\) and \(d(x,B)<\delta/3\) would allow choices \(a\in A\) and \(b\in B\) with \(d(x,a)<\delta/3\) and \(d(x,b)<\delta/3\). The triangle inequality would give \(d(a,b)<2\delta/3<\delta\), contradicting the definition of \(\delta\) as a lower bound for all such distances. This argument requires \(\delta>0\).

Common pitfall. Applying the fixed-radius recipe to the preceding example and writing \(r=d(A,B)/3=0\) gives \(N_0(A)=\{x:d(x,A)<0\}=\varnothing\), not an open neighborhood containing \(A\). Choosing some positive radius instead does not repair that particular recipe: for any \(r>0\), choose \(n\) so large that \(1/(2(n+1))<r\). The midpoint \(x_n\) then has distance less than \(r\) from both \(A\) and \(B\), so it belongs to \(N_r(A)\cap N_r(B)\). The correction is to use the pointwise comparison of distances, which does not require one radius to work uniformly over the whole sets.

Worked Example: Why Closedness Is Needed

In \(\mathbb{R}\), let \(A=\{1/n:n\in\mathbb{N}\}\) and \(B=\{0\}\). These sets are disjoint, but \(A\) is not closed: every open interval around \(0\) contains \(1/n\) for sufficiently large \(n\). In fact, there cannot be disjoint open sets \(U,V\) with \(A\subseteq U\) and \(B\subseteq V\).

To verify this, suppose \(V\) is open and contains \(0\). Then \((-\varepsilon,\varepsilon)\subseteq V\) for some \(\varepsilon>0\). Choose \(n\in\mathbb{N}\) with \(n>1/\varepsilon\); then \(0<1/n<\varepsilon\), so \(1/n\in V\). But \(1/n\in A\subseteq U\) as well, forcing \(U\cap V\ne\varnothing\). Thus the closed-set hypothesis in the separation theorem cannot simply be omitted.

The practical choice is therefore conditional. If the distance between the sets is known to be positive, fixed-radius neighborhoods provide a short construction. If it may be zero, compare the two continuous distance functions at each point. Closedness ensures the strict inequalities hold at every point of the sets to be separated, even when there is no single positive radius that works everywhere.

Check Your Understanding

Use the definitions and arguments above to answer the following questions.

  1. Why is \(x\mapsto d(x,A)\) continuous when \(A\ne\varnothing\)? State the inequality that proves it.
  2. For disjoint closed nonempty sets \(A,B\), why is \(d(a,B)>0\) for each fixed \(a\in A\), even if \(d(A,B)=0\)?
  3. In the zero-distance example, why does every positive fixed radius produce overlapping neighborhoods?
  4. Which strict inequalities define the two open separators, and what happens at a point where the two distances are equal?
  5. Why can \(\{1/n:n\in\mathbb{N}\}\) and \(\{0\}\) not have disjoint open neighborhoods containing them?