# Distance

"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:

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).

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 and 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.^{[3]}

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.^{[4]}

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 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:

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.

In analytic geometry, the Euclidean distance between two points of the xy-plane can be found using the distance formula. The distance between (*x*_{1}, *y*_{1}) and (*x*_{2}, *y*_{2}) is given by:^{[5]}^{[6]}

Similarly, given points (*x*_{1}, *y*_{1}, *z*_{1}) and (*x*_{2}, *y*_{2}, *z*_{2}) in three-space, the distance between them is:^{[5]}

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. This distance formula can also be expanded into the arc-length formula. Other distances with other formulas are used in non-Euclidean geometry.

In the Euclidean space **R**^{n}, 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 (*x*_{1}, *x*_{2}, ...,*x*_{n}) and a point (*y*_{1}, *y*_{2}, ...,*y*_{n}), the **Minkowski distance** of order *p* (** p-norm distance**) is defined as:

*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.

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:

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.

In mathematics, in particular geometry, a distance function on a given set *M* is a function *d*: *M* × *M* → **R**, 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*) = |*x* − *y*|. 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.

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:

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.

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

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.

Psychological distance is defined as "the different ways in which an object might be removed from" the self along dimensions such as "time, space, social distance, and hypotheticality".^{[1]} The relation between psychological distance and the extent to which thinking is abstract or concrete is described in construal level theory, a framework for decision-making.