Distance is a numerical or occasionally qualitative measurement of how far apart objects, points, people, or ideas 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"). The term is also frequently used metaphorically[1] to mean a measurement of the amount of difference between two similar objects (such as statistical distance between probability distributions or edit distance between strings of text) or a degree of separation (as exemplified by distance between people in a social network). Most such notions of distance, both physical and metaphorical, are formalized in mathematics using the notion of a metric space.
In the social sciences, distance can refer to a qualitative measurement of separation, such as social distance or psychological distance.
The distance between physical locations can be defined in different ways in different contexts.
See main article: Euclidean distance.
The distance between two points in physical space is the length of a straight line between them, which is the shortest possible path. This is the usual meaning of distance in classical physics, including Newtonian mechanics.
Straight-line distance is formalized mathematically as the Euclidean distance in two- and three-dimensional space. In Euclidean geometry, the distance between two points and is often denoted
|AB|
See main article: Distance measurement. There are many ways of measuring straight-line distances. For example, it can be done directly using a ruler, or indirectly with a radar (for long distances) or interferometry (for very short distances). The cosmic distance ladder is a set of ways of measuring extremely long distances.
See main article: Geographic distance and geodesic.
The straight-line distance between two points on the surface of the Earth is not very useful for most purposes, since we cannot tunnel straight through the Earth's mantle. Instead, one typically measures the shortest path along the surface of the Earth, as the crow flies. This is approximated mathematically by the great-circle distance on a sphere.
More generally, the shortest path between two points along a curved surface is known as a geodesic. The arc length of geodesics gives a way of measuring distance from the perspective of an ant or other flightless creature living on that surface.
See main article: Distance measure. In the theory of relativity, because of phenomena such as length contraction and the relativity of simultaneity, distances between objects depend on a choice of inertial frame of reference. On galactic and larger scales, the measurement of distance is also affected by the expansion of the universe. In practice, a number of distance measures are used in cosmology to quantify such distances.
Unusual definitions of distance can be helpful to model certain physical situations, but are also used in theoretical mathematics:
Many abstract notions of distance used in mathematics, science and engineering represent a degree of difference or separation between similar objects. This page gives a few examples.
See main article: Statistical distance. In statistics and information geometry, statistical distances measure the degree of difference between two probability distributions. There are many kinds of statistical distances, typically formalized as divergences; these allow a set of probability distributions to be understood as a geometrical object called a statistical manifold. The most elementary is the squared Euclidean distance, which is minimized by the least squares method; 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 an example of both an f-divergence and a Bregman divergence (and in fact the only example which is both). Statistical manifolds corresponding to Bregman divergences are flat manifolds in the corresponding geometry, allowing an analog of the Pythagorean theorem (which holds for squared Euclidean distance) to be used for linear inverse problems in inference by optimization theory.
Other important statistical distances include the Mahalanobis distance and the energy distance.
In computer science, an edit distance or string metric between two strings measures how different they are. For example, the words "dog" and "dot", which differ by just one letter, are closer than "dog" and "cat", which have no letters in common. This idea is used in spell checkers and in coding theory, and is mathematically formalized in a number of different ways, including Levenshtein distance, Hamming distance, Lee distance, and Jaro–Winkler distance.
See main article: Distance (graph theory). In a graph, the distance between two vertices is measured by the length of the shortest edge path between them. For example, if the graph represents a social network, then the idea of six degrees of separation can be interpreted mathematically as saying that the distance between any two vertices is at most six. Similarly, the Erdős number and the Bacon number—the number of collaborative relationships away a person is from prolific mathematician Paul Erdős and actor Kevin Bacon, respectively—are distances in the graphs whose edges represent mathematical or artistic collaborations.
In psychology, human geography, and the social sciences, distance is often theorized not as an objective numerical measurement, but as a qualitative description of a subjective experience.[4] For example, psychological distance is "the different ways in which an object might be removed from" the self along dimensions such as "time, space, social distance, and hypotheticality".[5] In sociology, social distance describes the separation between individuals or social groups in society along dimensions such as social class, race/ethnicity, gender or sexuality.
See main article: Metric space. Most of the notions of distance between two points or objects described above are examples of the mathematical idea of a metric. A metric or distance function is a function which takes pairs of points or objects to real numbers and satisfies the following rules:
As an exception, many of the divergences used in statistics are not metrics.
There are multiple ways of measuring the physical distance between objects that consist of more than one point:
Even more generally, this idea can be used to define the distance between two subsets of a metric space. The distance between sets and is the infimum of the distances between any two of their respective points: This does not define a metric on the set of such subsets: the distance between overlapping sets is zero, and this distance does not satisfy the triangle inequality for any metric space with two or more points (consider the triple of sets consisting of two distinct singletons and their union).
The word distance is also used for related concepts that are not encompassed by the description "a numerical measurement of how far apart points or objects are".
The distance travelled by an object is the length of a specific path travelled between two points,[6] such as the distance walked while navigating a maze. This can even be a closed distance along a closed curve which starts and ends at the same point, such as a ball thrown straight up, or the Earth when it completes one orbit. This is formalized mathematically as the arc length of the curve.
The distance travelled may also be signed: a "forward" distance is positive and a "backward" distance is negative.
Circular distance is the distance traveled by a point on the circumference of a wheel, which can be useful to consider when designing vehicles or mechanical gears (see also odometry). The circumference of the wheel is ; if the radius is 1, each revolution of the wheel causes a vehicle to travel radians.
See main article: Displacement (vector). The displacement in classical physics measures the change in position of an object during an interval of time. While distance is a scalar quantity, or a magnitude, displacement is a vector quantity with both magnitude and direction. In general, the vector measuring the difference between two locations (the relative position) is sometimes called the directed distance.[7] For example, the directed distance from the New York City Main Library flag pole to the Statue of Liberty flag pole has:
scipy.spatial.distance
)