Finding something worth knowing…

Science

Euclid never measured distance with numbers, only with matching line segments

The straight-line distance between two points is named after Euclid, yet in his Elements distances were not numbers at all. Two segments were simply equal or not. Linking distance to the Pythagorean theorem, the basis of today's formula, only happened in the 18th century.

Greek geometry built distance into its tools rather than its arithmetic. A compass draws a circle because every point on it sits the same distance from the centre, and the Elements reasoned about lengths by comparing segments. The now familiar recipe came much later: take the differences between two points' coordinates, square them, add them and take the square root. On a flat plane this is the Pythagorean theorem applied to a right triangle whose hypotenuse joins the points, which is why it is sometimes called the Pythagorean distance. Many programming libraries package the calculation as a function called hypot.

The same pattern stretches to any number of dimensions, adding one more squared difference for each extra coordinate. For points in polar coordinates the law of cosines does the job instead. When the objects are not points, such as a point and a line, distance usually means the shortest gap between any pair of points taken from each.

Euclidean distance is the model for what mathematicians call a metric. It is symmetric, unlike a road trip on one-way streets, so the trip from A to B equals the trip back. It is positive between distinct points and zero from a point to itself. It obeys the triangle inequality, so a detour through a third point is never shorter than going straight. It also satisfies Ptolemy's inequality: in any quadrilateral, the products of opposite sides add up to at least the product of the diagonals. The Beckman–Quarles theorem adds a surprise: any transformation of the plane that keeps every unit distance unchanged must preserve all distances.

In practice people often skip the final square root. Squared distances keep the same ordering, so comparisons, such as building a minimum spanning tree, come out identical while avoiding needless computation and rounding trouble.

Source: Euclidean distance

Related

More in Science · All topics