Skip to content
Tutorials Center
My learning

Topics

Lesson 7 of 36 ยท Metric Spaces

Open and Closed Balls

Define open balls, closed balls and spheres in any metric space, plot unit balls for three metrics, and prove with code and logic that every open ball is open.

In the real line, the basic neighborhoods are intervals. In a metric space, the same role is played by balls: all points within a given distance of a center. Balls are how we turn a distance function into a notion of "nearby", and they are the bridge from metric spaces to topology.

Definitions

Let (X, d) be a metric space, x โˆˆ X and r > 0.

Name Notation Definition
Open ball B(x, r) { y โˆˆ X : d(x, y) < r }
Closed ball Bฬ„(x, r) { y โˆˆ X : d(x, y) โ‰ค r }
Sphere S(x, r) { y โˆˆ X : d(x, y) = r }

On the real line, B(x, r) = (x โˆ’ r, x + r). In the plane with the Euclidean metric, B(x, r) is a disc without its boundary circle, and the closed ball includes it.

The shape of a ball depends on the metric

The word "ball" misleads, since only the Euclidean ball is round. In the plane, the unit open ball around the origin is:

  • a diamond (a square turned 45ยฐ) for the taxicab metric, since |x| + |y| < 1;
  • a disc for the Euclidean metric;
  • an axis-aligned square for the maximum metric, since max(|x|, |y|) < 1.

The code plots all three together.

Python Unit balls for three metrics

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Every open ball is open

We call a subset U of a metric space open if each of its points has some ball around it inside U (the full definition appears in Open and Closed Sets in Metric Spaces). A reassuring fact is that open balls are open, so the name is honest.

Claim. Let y โˆˆ B(x, r). Then B(y, s) โІ B(x, r) where s = r โˆ’ d(x, y).

Proof. Since y is in the ball, d(x, y) < r, so s > 0. Take any z with d(y, z) < s. By the triangle inequality,

Text
d(x, z) โ‰ค d(x, y) + d(y, z) < d(x, y) + s = r

so z โˆˆ B(x, r). โˆŽ

The triangle inequality is exactly the tool that makes this work: without it, a small ball around y could poke out of the big ball around x.

The code tests the claim on random points for the three plane metrics.

Python Testing the open-ball argument

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The count of points outside should be zero for each metric: a random test cannot prove the claim, but the proof above does.

Balls in the discrete metric

Balls can behave unexpectedly. In a set X with the discrete metric (distance 1 between distinct points):

  • B(x, r) = {x} when r โ‰ค 1, because no other point has distance below 1;
  • B(x, r) = X when r > 1;
  • the closed ball Bฬ„(x, 1) is all of X, since every point is within distance 1.

So the closed ball of radius 1 is not the smallest closed set containing the open ball of radius 1: the open ball is , which is closed in the discrete metric. This tells you that "closed ball" does not mean "the closure of the open ball".

Python Balls in the discrete metric

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Same topology from different metrics

Although the balls of the three plane metrics look different, every taxicab ball contains a Euclidean ball with the same center, and vice versa, using the inequalities from Examples of Metrics: dโ‚‚ โ‰ค dโ‚ means Bโ‚(x, r) โІ Bโ‚‚(x, r), and dโ‚ โ‰ค 2ยทdโˆž, dโˆž โ‰ค dโ‚‚ let us fit one kind of ball inside another by shrinking the radius. So a set is open for one metric exactly when it is open for the others. Topologists say that these metrics are equivalent and give the same topology on the plane.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. In the taxicab metric on the plane, what shape is the open unit ball around the origin?

    The condition |x| + |y| < 1 describes a diamond with corners at (ยฑ1, 0) and (0, ยฑ1).
  2. 2. y lies in B(x, r). Which radius s makes B(y, s) fit inside B(x, r)?

    With s = r - d(x, y), the triangle inequality shows every point within s of y is within r of x.
  3. 3. In a set with the discrete metric, what is the open ball B(x, 1)?

    Other points are at distance exactly 1, which is not less than 1.
  4. 4. Which tool proves that every open ball is open?

    The triangle inequality shows that z close to y is automatically close to x.

Summary

  • Open ball B(x, r) uses <, the closed ball uses โ‰ค, and the sphere uses =.
  • The shape of unit balls depends on the metric: diamond, disc or square in the plane.
  • Every open ball is open, with radius r โˆ’ d(x, y) around each interior point y; the triangle inequality is the key.
  • A closed ball is not always the closure of the open ball, as the discrete metric shows.
  • Metrics that nest each other's balls (up to scale) give the same open sets.

Next: Open and Closed Sets in Metric Spaces