Euclidean distance

From Canonica AI

Definition

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.

Mathematical Formulation

In two-dimensional space, the Euclidean distance between two points, (x1, y1) and (x2, y2), is given by:

√[(x2 - x1)² + (y2 - y1)²]

In three-dimensional space, the Euclidean distance between two points, (x1, y1, z1) and (x2, y2, z2), is given by:

√[(x2 - x1)² + (y2 - y1)² + (z2 - z1)²]

In general, for any number of dimensions n, the Euclidean distance between two points p and q in that space is given by:

√[Σ (qi - pi)²] for i = 1 to n

where p and q are points in Euclidean n-space, and pi and qi are their respective coordinates.

A photograph of a two-dimensional graph with two points marked and a line drawn between them to represent the Euclidean distance.
A photograph of a two-dimensional graph with two points marked and a line drawn between them to represent the Euclidean distance.

Properties

The Euclidean distance has several important properties. It is symmetric, which means that the distance from point A to point B is the same as the distance from point B to point A. It is also non-negative, meaning it is always greater than or equal to zero. The only time the Euclidean distance is zero is when the two points are exactly the same.

The Euclidean distance also satisfies the triangle inequality. This means that for any three points A, B, and C in the space, the distance from A to C is always less than or equal to the distance from A to B plus the distance from B to C.

Applications

Euclidean distance has a wide range of applications. It is used in many fields, including computer science, machine learning, data mining, and bioinformatics.

In computer science, it is often used in algorithms that deal with spatial data. For example, it is used in the k-nearest neighbors algorithm to find the k points in a given dataset that are closest to a specified point.

In machine learning and data mining, Euclidean distance is often used as a similarity measure. Objects with a small Euclidean distance are considered similar. It is also used in clustering algorithms such as k-means clustering.

In bioinformatics, Euclidean distance is used to measure the genetic distance between different species or individuals.

Generalizations

The concept of Euclidean distance can be generalized to other types of spaces. For example, in a Minkowski space, the Minkowski distance is a generalization of the Euclidean distance that can incorporate different types of metrics.

In a Hilbert space, the Euclidean distance is replaced by the Hilbert distance. This is a more abstract concept that relies on the inner product of the space.

See Also