Last updated

Distance is a numerical measurement of how far apart objects 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.

Measurement Process of assigning numbers to objects or events

Measurement is the assignment of a number to a characteristic of an object or event, which can be compared with other objects or events. The scope and application of measurement are dependent on the context and discipline. In the natural sciences and engineering, measurements do not apply to nominal properties of objects or events, which is consistent with the guidelines of the International vocabulary of metrology published by the International Bureau of Weights and Measures. However, in other fields such as statistics as well as the social and behavioral sciences, measurements can have multiple levels, which would include nominal, ordinal, interval and ratio scales.

Physics study of matter and its motion, along with related concepts such as energy and force

Physics is the natural science that studies matter and its motion and behavior through space and time and that studies the related entities of energy and force. Physics is one of the most fundamental scientific disciplines, and its main goal is to understand how the universe behaves.

Length is a measure of distance. In the International System of Quantities, length is any quantity with dimension distance. In most systems of measurement, the unit of length is a base unit, from which other units are derived.


Overview and definitions

Physical distances

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. Greatcircle Jetstream routes.svg
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 Manhattan distance.svg
"Manhattan distance" on a grid

A physical distance can mean several different things:

Euclidean distance conventional distance in mathematics and physics

In mathematics, the Euclidean distance or Euclidean metric is the "ordinary" straight-line distance between two points in Euclidean space. With this distance, Euclidean space becomes a metric space. The associated norm is called the Euclidean norm. Older literature refers to the metric as the Pythagorean metric. A generalized term for the Euclidean norm is the L2 norm or L2 distance.

Great-circle distance

The great-circle distance or orthodromic distance is the shortest distance between two points on the surface of a sphere, measured along the surface of the sphere. The distance between two points in Euclidean space is the length of a straight line between them, but on the sphere there are no straight lines. In spaces with curvature, straight lines are replaced by geodesics. Geodesics on the sphere are circles on the sphere whose centers coincide with the center of the sphere, and are called great circles.

Figure of the Earth mathematical descriptions of Earths complex shape

The figure of the Earth is the size and shape of the Earth in geodesy. Its specific meaning depends on the way it is used and the precision with which the Earth's size and shape is to be defined. While the sphere is a close approximation of the true figure of the Earth and satisfactory for many purposes, geodesists have developed several models that more closely approximate the shape of the Earth so that coordinate systems can serve the precise needs of navigation, surveying, cadastre, land use, and various other concerns.

A board showing distances near Visakhapatnam Distance board in Vizag.jpg
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.

Frequency is the number of occurrences of a repeating event per unit of time. It is also referred to as temporal frequency, which emphasizes the contrast to spatial frequency and angular frequency. The period is the duration of time of one cycle in a repeating event, so the period is the reciprocal of the frequency. For example: if a newborn baby's heart beats at a frequency of 120 times a minute, its period—the time interval between beats—is half a second. Frequency is an important parameter used in science and engineering to specify the rate of oscillatory and vibratory phenomena, such as mechanical vibrations, audio signals (sound), radio waves, and light.

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

Chebyshev distance distance between vectors defined by the maximum difference between coordinates

In mathematics, Chebyshev distance, maximum metric, or L metric is a metric defined on a vector space where the distance between two vectors is the greatest of their differences along any coordinate dimension. It is named after Pafnuty Chebyshev.

Chessboard type of checkerboard used in the board game chess

A chessboard is the type of board game used in the game chess, over which the chess pawns (pieces) are laid. It's usually square in shape, with an alternating pattern of two colours between its subdivisions. Traditionally wooden boards are used of naturally derived light and dark brown woods, while plastic and vinyl boards often use Black or Brown for the dark squares and shades such as buff or cream for the light squares. Materials vary widely; while wooden boards are generally used in high-level games; vinyl, plastic, and cardboard are common for regular and common play. Decorative glass and marble boards are available but rarely accepted for games rated by national or international chess federations.

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.

Distance measures (cosmology) definitions for distance between two objects or events in the universe

Distance measures are used in physical cosmology to give a natural notion of the distance between two objects or events in the universe. They are often used to tie some observable quantity to another quantity that is not directly observable, but is more convenient for calculations. The distance measures discussed here all reduce to the common notion of Euclidean distance at low redshift.

Expansion of the universe

The expansion of the universe is the increase of the distance between two distant parts of the universe with time. It is an intrinsic expansion whereby the scale of space itself changes. The universe does not expand "into" anything and does not require space to exist "outside" it. Technically, neither space nor objects in space move. Instead it is the metric governing the size and geometry of spacetime itself that changes in scale. Although light and objects within spacetime cannot travel faster than the speed of light, this limitation does not restrict the metric itself. To an observer it appears that space is expanding and all but the nearest galaxies are receding into the distance.

Theory of relativity physical theory

The theory of relativity usually encompasses two interrelated theories by Albert Einstein: special relativity and general relativity. Special relativity applies to elementary particles and their interactions, describing all their physical phenomena except gravity. General relativity explains the law of gravitation and its relation to other forces of nature. It applies to the cosmological and astrophysical realm, including astronomy.

Theoretical distances

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 computational linguistics and computer science, edit distance is a way of quantifying how dissimilar two strings are to one another by counting the minimum number of operations required to transform one string into the other. Edit distances find applications in natural language processing, where automatic spelling correction can determine candidate corrections for a misspelled word by selecting words from a dictionary that have a low distance to the word in question. In bioinformatics, it can be used to quantify the similarity of DNA sequences, which can be viewed as strings of the letters A, C, G and T.

Spell checker software used to detect misspelled words, in a document

In software, a spell checker is a software feature that checks for misspellings in a text. Features are often in software, such as a word processor, email client, electronic dictionary, or search engine.

Coding theory study of the properties of codes and their fitness for a specific application

Coding theory is the study of the properties of codes and their respective fitness for specific applications. Codes are used for data compression, cryptography, error detection and correction, data transmission and data storage. Codes are studied by various scientific disciplines—such as information theory, electrical engineering, mathematics, linguistics, and computer science—for the purpose of designing efficient and reliable data transmission methods. This typically involves the removal of redundancy and the correction or detection of errors in the transmitted data.

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 displacement

Distance along a path compared with displacement Distancedisplacement.svg
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]

The distance covered by a vehicle (for example as recorded by an odometer), person, animal, or object along a curved path from a point A to a point B should be distinguished from the straight-line distance from A to B. For example, whatever the distance covered during a round trip from A to B and back to A, the displacement is zero as start and end points coincide. In general the straight-line distance does not equal distance travelled, except for journeys in a straight line.

Directed distance

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). I.e. the directed distance from the New York City Main Library flag pole to the Statue of Liberty flag pole has:

Another kind of directed distance is that between two different particles or point masses at a given time. For instance, the distance from the center of gravity of the Earth A and the center of gravity of the Moon B (which does not strictly imply motion from A to B) falls into this category.

A directed distance along a curved line is not a vector and is represented by a segment of that curved line defined by endpoints A and B, with some specific information indicating the sense (or direction) of an ideal or real motion from one endpoint of the segment to the other (see figure). For instance, just labelling the two endpoints as A and B can indicate the sense, if the ordered sequence (A, B) is assumed, which implies that A is the starting point.


A displacement (see above) is a special kind of directed distance defined in mechanics. A directed distance is called displacement when it is the distance along a straight line (minimum distance) from A and B, and when A and B are positions occupied by the same particle at two different instants of time. This implies motion of the particle. The distance traveled by a particle must always be greater than or equal to its displacement, with equality occurring only when the particle moves along a straight path.



In analytic geometry, the distance between two points of the xy-plane can be found using the distance formula. The distance between (x1, y1) and (x2, y2) is given by:

Similarly, given points (x1, y1, z1) and (x2, y2, z2) in three-space, the distance between them is:

These formula are easily derived by constructing a right triangle with a leg on the hypotenuse of another (with the other leg orthogonal to the plane that contains the 1st triangle) and applying the Pythagorean theorem. In the study of complicated geometries, we call this (most common) type of distance Euclidean distance, as it is derived from the Pythagorean theorem, which does not hold in non-Euclidean geometries. This distance formula can also be expanded into the arc-length formula.

Distance in Euclidean space

In the Euclidean space Rn, the distance between two points is usually given by the Euclidean distance (2-norm distance). Other distances, based on other norms, are sometimes used instead.

For a point (x1, x2, ...,xn) and a point (y1, y2, ...,yn), the Minkowski distance of order p (p-norm distance) is defined as:

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

p need not be an integer, but it cannot be less than 1, because otherwise the triangle inequality does not hold.

The 2-norm distance is the Euclidean distance, a generalization of the Pythagorean theorem to more than two coordinates. It is what would be obtained if the distance between two points were measured with a ruler: the "intuitive" idea of distance.

The 1-norm distance is more colourfully called the taxicab norm or Manhattan distance , because it is the distance a car would drive in a city laid out in square blocks (if there are no one-way streets).

The infinity norm distance is also called Chebyshev distance. In 2D, it is the minimum number of moves kings require to travel between two squares on a chessboard.

The p-norm is rarely used for values of p other than 1, 2, and infinity, but see super ellipse.

In physical space the Euclidean distance is in a way the most natural one, because in this case the length of a rigid body does not change with rotation.

Variational formulation of distance

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 objects

The Euclidean distance between two objects may also be generalized to the case where the objects are no longer points but are higher-dimensional manifolds, such as space curves, so in addition to talking about distance between two points one can discuss concepts of distance between two strings. Since the new objects that are dealt with are extended objects (not points anymore) additional concepts such as non-extensibility, curvature constraints, and non-local interactions that enforce non-crossing become central to the notion of distance. The distance between the two manifolds is the scalar quantity that results from minimizing the generalized distance functional, which represents a transformation between the two manifolds:

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 distance

This is a metric often used in computer vision that can be minimized by least squares estimation. 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 metric

In mathematics, in particular geometry, a distance function on a given set M is a function d: M × MR, where R denotes the set of real numbers, that satisfies the following conditions:

For example, the usual definition of distance between two real numbers x and y is: d(x,y) = |xy|. This definition satisfies the three conditions above, and corresponds to the standard topology of the real line. But distance on a given set is a definitional choice. Another possible choice is to define: d(x,y) = 0 if x = y, and 1 otherwise. This also defines a metric, but gives a completely different topology, the "discrete topology"; with this definition numbers cannot be arbitrarily close.

Distances between sets and between a point and a set

d(A, B) > d(A, C) + d(C, B) Distance between sets.svg
d(A, B) > d(A, C) + d(C, B)

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:

This is a symmetric premetric. On a collection of sets of which some touch or overlap each other, it is not "separating", because the distance between two different but touching or overlapping sets is zero. Also it is not hemimetric, i.e., the triangle inequality does not hold, except in special cases. Therefore only in special cases this distance makes a collection of sets a metric space.

The distance between a point and a set is the infimum of the distances between the point and those in the set. This corresponds to the distance, according to the first-mentioned definition above of the distance between sets, from the set containing only this point to the other set.

In terms of this, the definition of the Hausdorff distance can be simplified: it is the larger of two values, one being the supremum, for a point ranging over one set, of the distance between the point and the set, and the other value being likewise defined but with the roles of the two sets swapped.

Graph theory

In graph theory the distance between two vertices is the length of the shortest path between those vertices.

Other mathematical "distances"

See also

Related Research Articles

Euclidean space Generalization of Euclidean geometry to higher dimensions

In geometry, Euclidean space encompasses the two-dimensional Euclidean plane, the three-dimensional space of Euclidean geometry, and similar spaces of higher dimension. It is named after the Ancient Greek mathematician Euclid of Alexandria. The term "Euclidean" distinguishes these spaces from other types of spaces considered in modern geometry. Euclidean spaces also generalize to higher dimensions.

Hyperbola type of smooth curve, lying in a plane

In mathematics, a hyperbola is a type of smooth curve lying in a plane, defined by its geometric properties or by equations for which it is the solution set. A hyperbola has two pieces, called connected components or branches, that are mirror images of each other and resemble two infinite bows. The hyperbola is one of the three kinds of conic section, formed by the intersection of a plane and a double cone. If the plane intersects both halves of the double cone but does not pass through the apex of the cones, then the conic is a hyperbola.

In mathematics, a metric space is a set together with a metric on the set. The metric is a function that defines a concept of distance between any two members of the set, which are usually called points. The metric satisfies a few simple properties. Informally:

Great circle intersection of the sphere and a plane which passes through the center point of the sphere

A great circle, also known as an orthodrome, of a sphere is the intersection of the sphere and a plane that passes through the center point of the sphere. A great circle is the largest circle that can be drawn on any given sphere. Any diameter of any great circle coincides with a diameter of the sphere, and therefore all great circles have the same center and circumference as each other. This special case of a circle of a sphere is in opposition to a small circle, that is, the intersection of the sphere and a plane that does not pass through the center. Every circle in Euclidean 3-space is a great circle of exactly one sphere.

Triangle inequality

In mathematics, the triangle inequality states that for any triangle, the sum of the lengths of any two sides must be greater than or equal to the length of the remaining side. This statement permits the inclusion of degenerate triangles, but some authors, especially those writing about elementary geometry, will exclude this possibility, thus leaving out the possibility of equality. If x, y, and z are the lengths of the sides of the triangle, with no side being greater than z, then the triangle inequality states that

Curve object similar to a line but which is not required to be straight

In mathematics, a curve is, generally speaking, an object similar to a line but that need not be straight. Thus, a curve is a generalization of a line, in that its curvature need not be zero.

Geodesic shortest path between two points on a curved surface

In differential geometry, a geodesic is a generalization of the notion of a "straight line" to "curved spaces". The term "geodesic" comes from geodesy, the science of measuring the size and shape of Earth; in the original sense, a geodesic was the shortest route between two points on the Earth's surface, namely, a segment of a great circle. The term has been generalized to include measurements in much more general mathematical spaces; for example, in graph theory, one might consider a geodesic between two vertices/nodes of a graph.

In differential geometry, a (smooth) Riemannian manifold or (smooth) Riemannian space(M, g) is a real, smooth manifold M equipped with an inner product gp on the tangent space TpM at each point p that varies smoothly from point to point in the sense that if X and Y are differentiable vector fields on M, then pgp(X|p, Y|p) is a smooth function. The family gp of inner products is called a Riemannian metric. These terms are named after the German mathematician Bernhard Riemann. The study of Riemannian manifolds constitutes the subject called Riemannian geometry.

In the mathematical field of differential geometry, a metric tensor is a type of function which takes as input a pair of tangent vectors v and w at a point of a surface and produces a real number scalar g(v, w) in a way that generalizes many of the familiar properties of the dot product of vectors in Euclidean space. In the same way as a dot product, metric tensors are used to define the length of and angle between tangent vectors. Through integration, the metric tensor allows one to define and compute the length of curves on the manifold.

Isometry distance-preserving function between metric spaces

In mathematics, an isometry is a distance-preserving transformation between metric spaces, usually assumed to be bijective.

Poincaré half-plane model

In non-Euclidean geometry, the Poincaré half-plane model is the upper half-plane, denoted below as H , together with a metric, the Poincaré metric, that makes it a model of two-dimensional hyperbolic geometry.

In the mathematical study of metric spaces, one can consider the arclength of paths in the space. If two points are at a given distance from each other, it is natural to expect that one should be able to get from the first point to the second along a path whose arclength is equal to that distance. The distance between two points of a metric space relative to the intrinsic metric is defined as the infimum of the lengths of all paths from the first point to the second. A metric space is a length metric space if the intrinsic metric agrees with the original metric of the space.

This is a glossary of some terms used in Riemannian geometry and metric geometry — it doesn't cover the terminology of differential topology.

In geometry, parallel lines are lines in a plane which do not meet; that is, two lines in a plane that do not intersect or touch each other at any point are said to be parallel. By extension, a line and a plane, or two planes, in three-dimensional Euclidean space that do not share a point are said to be parallel. However, two lines in three-dimensional space which do not meet must be in a common plane to be considered parallel; otherwise they are called skew lines. Parallel planes are planes in the same three-dimensional space that never meet.

The Mahalanobis distance is a measure of the distance between a point P and a distribution D, introduced by P. C. Mahalanobis in 1936. It is a multi-dimensional generalization of the idea of measuring how many standard deviations away P is from the mean of D. This distance is zero if P is at the mean of D, and grows as P moves away from the mean along each principal component axis. The Mahalanobis distance measures the number of standard deviations from P to the mean of D. If each of these axes is re-scaled to have unit variance, then the Mahalanobis distance corresponds to standard Euclidean distance in the transformed space. The Mahalanobis distance is thus unitless and scale-invariant, and takes into account the correlations of the data set.

Line (geometry) straight object with negligible width and depth

The notion of line or straight line was introduced by ancient mathematicians to represent straight objects with negligible width and depth. Lines are an idealization of such objects. Until the 17th century, lines were defined as the "[…] first species of quantity, which has only one dimension, namely length, without any width nor depth, and is nothing else than the flow or run of the point which […] will leave from its imaginary moving some vestige in length, exempt of any width. […] The straight line is that which is equally extended between its points."

In mathematics, a hyperbolic metric space is a metric space satisfying certain metric relations between points. The definition, introduced by Mikhael Gromov, generalizes the metric properties of classical hyperbolic geometry and of trees. Hyperbolicity is a large-scale property, and is very useful to the study of certain infinite groups called (Gromov-)hyperbolic groups.

Differential geometry of surfaces deals with the differential geometry of smooth surfaces with various additional structures, most often, a Riemannian metric

In mathematics, the differential geometry of surfaces deals with the differential geometry of smooth surfaces with various additional structures, most often, a Riemannian metric. Surfaces have been extensively studied from various perspectives: extrinsically, relating to their embedding in Euclidean space and intrinsically, reflecting their properties determined solely by the distance within the surface as measured along curves on the surface. One of the fundamental concepts investigated is the Gaussian curvature, first studied in depth by Carl Friedrich Gauss, who showed that curvature was an intrinsic property of a surface, independent of its isometric embedding in Euclidean space.

In the hyperbolic plane, as in the Euclidean plane, each point can be uniquely identified by two real numbers. Several qualitatively different ways of coordinatizing the plane in hyperbolic geometry are used.


  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,
  3. AR Mohazab, SS Plotkin,"Minimal Folding Pathways for Coarse-Grained Biopolymer Fragments" Biophysical Journal, Volume 95, Issue 12, Pages 5496–5507