Distance is a numerical measurement of how far apart objects or points are. In physics or everyday usage, distance may refer to a physical length or an estimation based on other criteria (e.g. "two counties over"). In most cases, "distance from A to B" is interchangeable with "distance from B to A". In mathematics, a distance function or metric is a generalization of the concept of physical distance. A metric is a function that behaves according to a specific set of rules, and is a way of describing what it means for elements of some space to be "close to" or "far away from" each other.

Overview and definitionsEdit

Physical distancesEdit

Airline routes between Los Angeles and Tokyo approximately follow a direct great circle route (top), but use the jet stream (bottom) when heading eastwards. Note that the shortest route appears as a curve rather than a straight line because this map is a Mercator projection, which does not scale all distances equally compared to the real spherical surface of the Earth.
"Manhattan distance" on a grid

A physical distance can mean several different things:

  • Distance Travelled: The length of a specific path travelled between two points, such as the distance walked while navigating a maze
  • Straight-Line (Euclidean) Distance: The length of the shortest possible path through space, between two points, that could be taken if there were no obstacles (usually formalized as Euclidean distance)
  • Geodesic Distance: The length of the shortest path between two points while remaining on some surface, such as the great-circle distance along the curve of the Earth
  • The length of a specific path that returns to the starting point, such as a ball thrown straight up, or the Earth when it completes one orbit.
A board showing distances near Visakhapatnam

"Circular distance" is the distance traveled by a wheel, which can be useful when designing vehicles or mechanical gears. The circumference of the wheel is 2π × radius, and assuming the radius to be 1, then each revolution of the wheel is equivalent of the distance 2π radians. In engineering ω = 2πƒ is often used, where ƒ is the frequency.

Unusual definitions of distance can be helpful to model certain physical situations, but are also used in theoretical mathematics:

  • "Manhattan distance" is a rectilinear distance, named after the number of blocks north, south, east, or west a taxicab must travel on to reach its destination on the grid of streets in parts of New York City.
  • "Chessboard distance", formalized as Chebyshev distance, is the minimum number of moves a king must make on a chessboard to travel between two squares.

Distance measures in cosmology are complicated by the expansion of the universe, and by effects described by the theory of relativity such as length contraction of moving objects.

Theoretical distancesEdit

The term "distance" is also used by analogy to measure non-physical entities in certain ways.

In computer science, there is the notion of the "edit distance" between two strings. For example, the words "dog" and "dot", which vary by only one letter, are closer than "dog" and "cat", which differ by three letters. This idea is used in spell checkers and in coding theory, and is mathematically formalized in several different ways, such as:

In mathematics, a metric space is a set for which distances between all members of the set are defined. In this way, many different types of "distances" can be calculated, such as for traversal of graphs, comparison of distributions and curves, and using unusual definitions of "space" (for example using a manifold or reflections). The notion of distance in graph theory has been used to describe social networks, for example with the Erdős number or the Bacon number, the number of collaborative relationships away a person is from prolific mathematician Paul Erdős or actor Kevin Bacon, respectively.

In psychology, human geography, and the social sciences, distance is often theorized not as an objective metric, but as a subjective experience.

Distance versus directed distance and displacementEdit

Distance along a path compared with displacement

Both distance and displacement measure the movement of an object. Distance cannot be negative, and never decreases. Distance is a scalar quantity, or a magnitude. Whereas displacement is a vector quantity with both magnitude and direction. It can be negative, zero, or positive. Directed distance does not measure movement, it measures the separation of two points, and can be a positive, zero, or negative vector.[1]


Directed distanceEdit

Directed distances can be determined along straight lines and along curved lines.

Directed distances along straight lines are vectors that give the distance and direction between a starting point and an ending point. A directed distance of a point C from point A in the direction of B on a line AB in a Euclidean vector space is the distance from A to C if C falls on the ray AB, but is the negative of that distance if C falls on the ray BA (I.e., if C is not on the same side of A as B is). For example, the directed distance from the New York City Main Library flag pole to the Statue of Liberty flag pole has:

  • a starting point: library flag pole
  • an ending point: statue flag pole
  • a direction: -38°
  • a distance: 8.72 km












Distance in Euclidean spaceEdit



1-norm distance  
2-norm distance  
p-norm distance  
infinity norm distance  







Variational formulation of distanceEdit

The Euclidean distance between two points in space (  and  ) may be written in a variational form where the distance is the minimum value of an integral:


Here   is the trajectory (path) between the two points. The value of the integral (D) represents the length of this trajectory. The distance is the minimal value of this integral and is obtained when   where   is the optimal trajectory. In the familiar Euclidean case (the above integral) this optimal trajectory is simply a straight line. It is well known that the shortest path between two points is a straight line. Straight lines can formally be obtained by solving the Euler–Lagrange equations for the above functional. In non-Euclidean manifolds (curved spaces) where the nature of the space is represented by a metric tensor   the integrand has to be modified to  , where Einstein summation convention has been used.

Generalization to higher-dimensional objectsEdit



The above double integral is the generalized distance functional between two polymer conformation.   is a spatial parameter and   is pseudo-time. This means that   is the polymer/string conformation at time   and is parameterized along the string length by  . Similarly   is the trajectory of an infinitesimal segment of the string during transformation of the entire string from conformation   to conformation  . The term with cofactor   is a Lagrange multiplier and its role is to ensure that the length of the polymer remains the same during the transformation. If two discrete polymers are inextensible, then the minimal-distance transformation between them no longer involves purely straight-line motion, even on a Euclidean metric. There is a potential application of such generalized distance to the problem of protein folding[2][3] This generalized distance is analogous to the Nambu–Goto action in string theory, however there is no exact correspondence because the Euclidean distance in 3-space is inequivalent to the spacetime distance minimized for the classical relativistic string.

Algebraic distanceEdit

This is a metric often used in computer vision that can be minimized by least squares estimation. [1][2] For curves or surfaces given by the equation   (such as a conic in homogeneous coordinates), the algebraic distance from the point   to the curve is simply  . It may serve as an "initial guess" for geometric distance to refine estimations of the curve by more accurate methods, such as non-linear least squares.

General metricEdit




Distances between sets and between a point and a setEdit


Various distance definitions are possible between objects. For example, between celestial bodies one should not confuse the surface-to-surface distance and the center-to-center distance. If the former is much less than the latter, as for a low earth orbit, the first tends to be quoted (altitude), otherwise, e.g. for the Earth–Moon distance, the latter.

There are two common definitions for the distance between two non-empty subsets of a given metric space:




Graph theoryEdit


Statistical distancesEdit

In statistics and information geometry, there are many kinds of statistical distances, notably divergences, especially Bregman divergences and f-divergences. These include and generalize many of the notions of "difference between two probability distributions", and allow them to be studied geometrically, as statistical manifolds. The most elementary is the squared Euclidean distance, which forms the basis of least squares; this is the most basic Bregman divergence. The most important in information theory is the relative entropy (Kullback–Leibler divergence), which allows one to analogously study maximum likelihood estimation geometrically; this is the most basic f-divergence, and is also a Bregman divergence (and is the only divergence that is both). Statistical manifolds corresponding to Bregman divergences are flat manifolds in the corresponding geometry, allowing an analog of the Pythagorean theorem (which is traditionally true for squared Euclidean distance) to be used for linear inverse problems in inference by optimization theory.

Other important statistical distances include the Mahalanobis distance, the energy distance, and many others.

Other mathematical "distances"Edit

  • Canberra distance – a weighted version of Manhattan distance, used in computer science

See alsoEdit

Library SupportEdit


  1. ^ "The Directed Distance" (PDF). Information and Telecommunication Technology Center. University of Kansas. Archived from the original (PDF) on 10 November 2016. Retrieved 18 September 2018.
  2. ^ SS Plotkin, PNAS.2007; 104: 14899–14904,