Ball (mathematics) 2026-10-14
In a metric space , an open ball of radius about is . A closed ball instead uses . The strict inequality matters: a point at distance exactly belongs to the closed ball and is excluded from the open ball. In particular, is excluded from all three open unit balls above, and included in all three closed unit balls.
The three closed unit balls centred at zero are , , and . Their shapes are a diamond (a rotated square), a disk with a circle as its boundary, and an axis-aligned square. A ball need not look round! The corresponding open balls are the interiors of these shapes. At , Manhattan distance from zero is and Euclidean distance is , whereas Chebyshev distance is : only the square's open unit ball contains this point.
Figure 1.
Three closed unit balls on the same coordinate scale
. Details.
These shapes illustrate , with either the open ball or closed ball convention used consistently. Their outlines are included in the displayed closed balls. In an arbitrary metric space, however, points at distance exactly need not form the topological boundary; the discrete metric below shows why this distinction matters.
Hamming cube as an L1 and L2 metric Created 2026-09-28 Updated 2026-10-14
Use the convention for the Hamming cube . Its elements are length- binary strings, and their Hamming distance counts the differing coordinates:
Send each binary string to the vector with the same coordinates, by . Every differing coordinate contributes both to the sum of absolute differences and to the sum of squared differences. Therefore the L1 norm and L2 norm give, respectively,
This short coordinate calculation proves that the L1 norm gives an isometric embedding, while Euclidean distance grows like the square root of the number of changed binary digits. For example, and differ twice: their Hamming distance and Manhattan distance are , but their Euclidean distance is . Comparing binary strings in these two geometric representations answers different questions even though the points have the same coordinates.
For distinct pairs ranges over every integer from to . The metric embedding into the L2 norm thus has sharp ratios
Neighbors attain and opposite corners attain . This computes the bi-Lipschitz distortion of this coordinate map; it does not prove that every metric embedding into an L2 space has at least this bi-Lipschitz distortion. Uniformly multiplying the output coordinates changes and together and leaves unchanged.
Figure 1.
Hamming distances become k in L1 and square root of k in L2, with controls independent of dimension
. Details.
The important family distinction is that these coordinate maps have no dimension-independent bound on their bi-Lipschitz distortion into the L2 norm, yet they do give a uniform coarse embedding of a family of metric spaces. Pad each output vector with zero coordinates to view all maps in the single l2 sequence space, an L2 space for counting measure. Then the same functions
work for every , and . Similarly, padding into the l1 sequence space gives common controls and exact preservation of Hamming distance. These claims use unnormalized Hamming distance; replacing it by normalized Hamming distance changes the family of source metrics.
The geometry has a practical origin: Hamming's 1950 paper uses the number of differing positions between binary strings to study error-correcting codes. Changing one binary digit moves to a neighboring corner, so a question about corrupted messages becomes a question about separation in the Hamming cube. [ref]
Metric space Created 2026-09-24 Updated 2026-10-14
A metric space is a set together with a metric measuring how far apart its elements are. The elements can be positions, functions, or other objects: what matters is that the metric obeys the same basic rules. This lets one discuss convergence in a metric space, continuous maps, and Cauchy sequences without first assigning Cartesian coordinates. The useful abstraction is that many arguments require only comparisons of distances, rather than the particular objects being compared.
Even the same set can support several informative metrics. On the plane with Cartesian coordinates, write and . Three standard choices are Manhattan distance, Euclidean distance, and Chebyshev distance:
They come from the L1 norm, Euclidean norm, and maximum norm, respectively, through . For and , Manhattan distance is , Euclidean distance is , and Chebyshev distance is . All three answers are correct for their respective metrics.
The choice encodes the question being asked. Manhattan distance models travel along a rectangular street grid. Euclidean distance measures unrestricted travel along a line segment. Chebyshev distance measures the time needed when two Cartesian coordinates can change simultaneously, each at speed at most one. Thus choosing a metric is part of modelling, rather than a consequence of knowing the endpoints. These examples have the same metric topology, but different metric path lengths and different collections of metric geodesics.
A historical reference for the general study of metric spaces is Maurice Fréchet's 1906 paper Sur quelques points du calcul fonctionnel, published in volume 22 of the Rendiconti del Circolo Matematico di Palermo. [ref]
Let be their Manhattan distance. Each joint action can reduce by at most two, so use the simultaneous rendezvous distance
This heuristic function is nonzero whenever the robots are apart. For a transition , the triangle inequality gives
Applying the ceiling function yields , and . Thus is a consistent heuristic, hence an admissible heuristic.
In the unobstructed grid this estimate is exact. Along a shortest route of length , both robots approach a middle room, taking at most steps each; when is an odd integer, the robot with the shorter route waits once. That final wait prevents a crossing from being mistaken for a meeting. With obstacles the same formula remains a relaxation heuristic, though it need not be exact.
Figure 1.
An original nine-edge route needs five simultaneous steps: the last wait produces a meeting rather than a crossing
. Details.
Ignore the fox and obstacles when estimating the remaining number of rabbit moves. Define the heuristic function
This is Manhattan distance to the nearest exit, a relaxation heuristic. Assume at least one exit; with none the instance is immediately unsolvable. The estimate is generally nonconstant and is not the perfect escape cost: obstacles can force detours, while pursuit can make an apparently nearby exit unreachable.
To prove it is a consistent heuristic, consider a surviving one-round transition from to . Let attain the minimum defining . The triangle inequality for Manhattan distance and the rabbit's move bound give
Every successful terminal state has . This proves consistency with unit round costs; summing the inequality along any successful route also proves that it is an admissible heuristic. Failed transitions need no successor estimate because they are discarded.
Relaxation heuristic 2026-10-25
A heuristic function obtained by solving an easier problem that permits every original transition and possibly additional ones, with original transitions costing no more in the easier problem. Every original solution remains available, so the easier optimum is an admissible heuristic.
If is the exact distance to the relaxed goal set, each original transition also gives by taking that transition and then a relaxed optimal continuation. Thus this construction gives a consistent heuristic when original goals have relaxed distance zero. For a four-direction grid walk, deleting obstacles gives Manhattan distance; deleting a pursuer's capture constraint supplies another relaxation. The resulting estimate can remain finite when the original goal is unreachable.
Two controlled walkers on the same connected undirected graph can each traverse one edge or wait in each unit-cost step. If they meet only by occupying the same vertex at the same time, their minimum meeting time is
where is the shortest path distance. A common meeting point after steps implies by the triangle inequality. Conversely, choose a middle vertex of a shortest connecting graph path; both walkers reach it within steps, and the earlier arrival waits. The wait is essential when the path length is an odd integer. This distance on the joint Cartesian product state space is a consistent heuristic: each joint move changes the walkers’ separation by at most two. Replacing by an obstacle-free Manhattan distance preserves admissible heuristic and consistent heuristic guarantees.
Triangle inequality Created 2026-09-24 Updated 2026-10-14
A metric satisfies : visiting an intermediate point cannot beat the direct endpoint distance. A norm satisfies the corresponding inequality .
Take , , and . For Euclidean distance, the triangle inequality reads . The direct line segment has metric path length , while the route through has metric path length . For Manhattan distance, the same comparison becomes : both routes are shortest. The line segment and the bent route both become metric geodesics when progress is measured by metric path length. For Chebyshev distance, the direct line segment has metric path length , while the same bent route still costs .
Figure 1.
The same endpoints and routes have different lengths in three metrics
. Details.
Repeated application of the triangle inequality bounds the endpoint distance by the sum along any finite chain of intermediate points. This explains why metric path length is always at least the distance between endpoints. Equality reveals a shortest route, but its shape and uniqueness depend on the chosen metric.
The additive group gives a useful way to see what a word metric measures. Let and , and choose the four-move generating set of a group . Its Cayley graph is the square lattice. Each move changes exactly one coordinate by one, so the word length is the L1 norm, and the word metric is Manhattan distance:
At least this many moves are necessary, and moving horizontally then vertically attains the bound. Bridson gives this square lattice as a basic Cayley graph example.[ref]
Now allow all eight neighbouring lattice points as moves:
Each coordinate changes by at most one per move. Use diagonal moves until the smaller displacement is exhausted, then use axis moves: the resulting word length is the maximum norm, and the word metric is Chebyshev distance. From to , an -route has five steps, while the -route has three.
The closed word metric balls consist of lattice points inside a diamond for , and inside an axis-aligned square for . For every nonnegative integer radius ,
The diamond has lattice points at word length ; the square has choices for each coordinate. At radius three the counts are and . These are discrete closed balls for Manhattan distance and Chebyshev distance; an Euclidean distance bound would instead select lattice points inside a Euclidean disk.
Figure 1.
Radius-three word metric balls in the integer lattice: a diamond with 25 points and a square with 49 points, with routes to
. Details.