The distance from a point to a set is defined by an infimum. An infimum need not be attained, and zero distance need not mean membership. Nevertheless, the distance function is always continuous, with a particularly useful common bound on how fast it can change. Keeping these three statements separate turns several compactness arguments into short, precise proofs.
The compactness and closed-set unit proves the sequential criterion for closedness, separation of two compact sets, and the bounded minimizing-sequence argument for distance from a point to a closed set. The continuity and compactness unit supplies attained extrema and uniform continuity; the subsequence unit supplies Bolzano–Weierstrass.
This unit focuses on the distance function itself, nearest-point attainment on unbounded closed subsets of the real line, and explicit nearest-point classifications. A continuous separator built from two distance functions is a derived application.
Study route
Review infimum approximation and the triangle inequality first. Then prove the distance-function estimate and the closure criterion, and prove nearest-point attainment without assuming the set is bounded. Two practice sets follow: gaps, tie points and a missing limit point and separation and uniform gaps. In every extraction argument, check exactly which sequence is bounded. Prerequisites are completeness, closed sets, subsequences, continuity and the extreme value theorem.
Define the distance without assuming a minimizer
Definition 7.1.1
(Distance from a point to a set)
For a nonempty subset and a real number , the distance from to is
A point with is called a nearest point of in .
The defining set is nonempty, bounded below by zero, and contains a finite value after choosing one point of . Hence its infimum is a finite nonnegative real number. We exclude the empty set throughout, so no extended-real convention is needed.
For every , some satisfies
This is an approximate minimizer. Replacing it by an exact minimizer before proving existence would be an extra assumption.
Worked example 7.1.2
(A distance that is not attained)
Let and . Every has , and the points give . Hence , but no member of has distance exactly from , so there is no nearest point. At the situation is sharper still: , yet no member of has distance zero from .
One common continuity scale
Theorem 7.1.3
(The distance function is 1-Lipschitz)
For every nonempty and all ,
In particular is uniformly continuous on , with for each .
Proof
(Triangle inequality, then an infimum over a)
For any and every , the triangle inequality gives
Taking the infimum over on the right gives . Reversing yields the other inequality, and together they give the stated bound.
The estimate holds for every nonempty set, whether or not it is closed or bounded. Neither compactness nor a nearest-point choice enters the proof.
Worked example 7.1.4
(A tent over a gap)
For the closed set , the distance is zero on and is for . The graph is a tent over the missing interval, with slope , which is exactly the Lipschitz constant. At its center the distance is , and there are two nearest points, and . A continuous distance function does not imply that its nearest-point choice is unique.
Quick check
(For , find and all nearest points of .)
Compare and .
Solution · Answer
Both points are at distance , so and both and are nearest points.
Distance zero detects the closure
Proposition 7.1.5
(Zero distance and the closure)
For nonempty and ,
and moreover for every .
Proof
(Approximation in both directions, then comparison with the closure)
Recall that means that every open interval centered at meets . If , then for every there is with , so . Consequently .
Conversely, if , the infimum approximation property supplies with for every . Thus every such interval meets .
One inequality in follows from , which gives . For the other, fix . The 1-Lipschitz estimate and give . Take the infimum over . This proof avoids choosing a nearest point in either set.
In particular, if is closed, zero distance is equivalent to membership. If is not closed, the distance function cannot distinguish from its missing limit points.
Common mistake
(Zero distance is not membership)
For and we have , because has distance from . But . Zero distance places in the closure , and only closedness upgrades closure to membership. Likewise for this set, so the distance function sees , not .
Quick check
(For , what is for each real ?)
Find the closure of .
Solution · Answer
Every real number is a limit of rationals, so , and for every real . The infimum is attained only at rational .
Closedness supplies a nearest point in the real line
Theorem 7.1.6
(Nearest points in a closed subset of the real line)
Let be nonempty and closed, and let . Then has at least one nearest point , so . If , then .
Proof
(A bounded minimizing sequence in an unbounded set)
Put . Choose with
Although may be unbounded, this particular sequence is bounded:
Bolzano–Weierstrass supplies a convergent subsequence . Closedness gives . By continuity of absolute value, . Positivity follows when : a zero minimum would force .
Proof X-ray
What each hypothesis does in the nearest-point proof
The proof has one idea: replace the possibly unbounded set by the particular sequence , which the choice of itself forces into the interval . Boundedness is therefore manufactured by the minimizing property, not assumed of , and dropping boundedness of costs nothing. Bolzano–Weierstrass then supplies a limit, and closedness is used exactly once, to put that limit back in . Continuity of the absolute value carries to . Closedness is the hypothesis that cannot be dropped: for and , the minimizing sequence is bounded and converges to , but , so the limit is not a nearest point.
The conclusion uses the real line's bounded-subsequence theorem, not a claim that every closed set is compact. It also asserts existence rather than uniqueness.
Concept lensGeometric
Distance as the nearer of two gaps
Let be nonempty and closed. The sets and are closed, so each that is nonempty has a largest element or a smallest element respectively. Every with has , and every has . Hence , ignoring a side that is empty. For and , , and .
Common mistake
(A nearest point need not be unique)
For , both points are nearest to , at distance . A map that chooses a nearest point can jump (here from to as the input crosses ) even though the distance itself remains 1-Lipschitz.
Only one set needs compactness for separation
Theorem 7.1.7
(Separation of a compact set from a closed set)
Let be nonempty and compact, let be nonempty and closed, and suppose . Then there are and with
Proof
(Minimize over , then attain it in )
The continuous function attains a minimum on , say at . Since , the minimum is positive. Nearest-point attainment in supplies with . For every and ,
Hence the pair realizes the infimum, and it is positive.
Compactness prevents the first point from escaping to infinity; closedness retains the second point when a bounded minimizing sequence is extracted. Both hypotheses are needed on the real line in the following sense: two closed sets alone are not enough.
Counterexample mode
Two disjoint closed sets can have separation zero
Claim: disjoint nonempty closed subsets of have positive separation. This is false. Let and with integer . Both sets are closed, because each has only finitely many points in every bounded interval. They are disjoint, since shows no point of is an integer. But the points and are at distance : for the pair and is apart, and for the pair and is apart. So the separation is and is not attained. The repair is the hypothesis of the theorem: make one of the two sets compact.
For any two nonempty sets with positive separation , there is also an inequality that does not need compactness at all.
Proposition 7.1.8
(Sum of two distances is bounded below by the separation)
If , then
Proof
(Approximate nearest points in both sets)
Fix and . Choose approximate nearest points , with and . Then . Let .
When , the denominator in
is bounded away from zero. The function equals zero on and one on . A quotient estimate, proved in the separation practice set, gives , rather than assuming that a quotient of uniformly continuous functions is always uniformly continuous.
Worked example 7.1.9
(A continuous separator for two rays)
Let and , so . Then and . For the sum is and . For the sum is exactly and . For the sum is and . So is the continuous ramp from to on , with Lipschitz constant , matching the general bound. Numerically, and the denominator there is .
Checklist and errors to avoid
- Specify that the set is nonempty before taking its finite real distance.
- Prove the 1-Lipschitz estimate using infima; a nearest point is not required.
- Zero distance means membership in the closure. Membership in the set itself needs closedness.
- To extract from a sequence in an unbounded closed set, first bound the minimizing sequence explicitly.
- A nearest point need not be unique. Continuity of the distance function does not guarantee a continuous choice of nearest points.
- For positive separation of two sets, compact–closed suffices on the real line. Closed–closed alone does not.
- A positive denominator at every point ensures continuity of a quotient of continuous functions. A uniform lower bound is a stronger fact and can support a common Lipschitz estimate.