# Euclidean distance

n = 3, formula results from repeated application of the Pythagorean theorem

The Euclidean distance is the concept of distance in Euclidean geometry . The Euclidean distance between two points in a plane or in space is the length of a line that connects these two points, measured with a ruler, for example . This distance is invariant under movements ( congruence maps ).

In Cartesian coordinates , the Euclidean distance can be calculated using the Pythagorean theorem . With the help of the formula obtained in this way, the concept of the Euclidean distance can be generalized to - dimensional Euclidean and unitary vector spaces , Euclidean point spaces and coordinate spaces. ${\ displaystyle n}$

This distance is called "Euclidean" to differentiate it from more general distance terms , such as:

## Euclidean space

In the two-dimensional Euclidean plane or in three-dimensional Euclidean space with Euclidean distance agrees with the ideological distance match. In the more general case of - dimensional Euclidean space , it is defined for two points or vectors by the Euclidean norm of the difference vector between the two points. If the points and are given by the coordinates and , then: ${\ displaystyle d (p, q)}$${\ displaystyle n}$${\ displaystyle \ mathbb {R} ^ {n}}$ ${\ displaystyle \ | qp \ | _ {2}}$${\ displaystyle p}$${\ displaystyle q}$${\ displaystyle p = (p_ {1}, \ ldots, p_ {n})}$${\ displaystyle q = (q_ {1}, \ ldots, q_ {n})}$

${\ displaystyle d (p, q) = \ | qp \ | _ {2} = {\ sqrt {(q_ {1} -p_ {1}) ^ {2} + \ cdots + (q_ {n} -p_ {n}) ^ {2}}} = {\ sqrt {\ sum _ {i = 1} ^ {n} (q_ {i} -p_ {i}) ^ {2}}}}$
n = 2, corresponds to the Pythagorean theorem

A well-known special case of calculating a Euclidean distance for is the Pythagorean theorem . ${\ displaystyle n = 2}$

The Euclidean distance is a metric and in particular it satisfies the triangle inequality . In addition to the Euclidean distance, there are a number of other distance measures. Since the Euclidean distance comes from a norm , namely the Euclidean norm, it is translation-invariant .

In statistics , the Euclidean distance is a special case of the weighted Euclidean distance and its square is a special case of the Mahalanobis distance .

## example

The Euclidean distance between the two points and is ${\ displaystyle p = (2,3, -1)}$${\ displaystyle q = (4,1, -2)}$

${\ displaystyle d (p, q) = {\ sqrt {(4-2) ^ {2} + (1-3) ^ {2} + (- 2 - (- 1)) ^ {2}}} = {\ sqrt {2 ^ {2} + (- 2) ^ {2} + (- 1) ^ {2}}} = {\ sqrt {9}} = 3}$.