Euclidean distance

From Wikipedia, the free encyclopedia

In mathematics, the Euclidean distance or Euclidean metric is the "ordinary" distance between two points that one would measure with a ruler, which can be proven by repeated application of the Pythagorean theorem. By using this formula as distance, Euclidean space becomes a metric space (even a Hilbert space). Older literature refers to this metric as Pythagorean metric. The technique has been rediscovered numerous times throughout history, as it is a logical extension of the Pythagorean theorem.

Contents

[edit] Definition

The Euclidean distance between points P=(p_1,p_2,\dots,p_n)\, and Q=(q_1,q_2,\dots,q_n)\,, in Euclidean n-space, is defined as:

\sqrt{(p_1-q_1)^2 + (p_2-q_2)^2 + \cdots + (p_n-q_n)^2} = \sqrt{\sum_{i=1}^n (p_i-q_i)^2}.

[edit] One-dimensional distance

For two 1D points, P=(p_x)\, and Q=(q_x)\,, the distance is computed as:

\sqrt{(p_x-q_x)^2} = | p_x-q_x |

The absolute value signs are used since distance is normally considered to be an unsigned scalar value.

[edit] Two-dimensional distance

For two 2D points, P=(p_x,p_y)\, and Q=(q_x,q_y)\,, the distance is computed as:

\sqrt{(p_x-q_x)^2 + (p_y-q_y)^2}

Alternatively, expressed in circular coordinates (also known as polar coordinates), using P=(r_1, \theta_1)\, and Q=(r_2, \theta_2)\,, the distance can be computed as:

\sqrt{r_1^2 + r_2^2 - 2 r_1 r_2 \cos(\theta_1 - \theta_2)}

[edit] Three-dimensional distance

For two 3D points, P=(p_x,p_y,p_z)\, and Q=(q_x,q_y,q_z)\,, the distance is computed as

\sqrt{(p_x-q_x)^2 + (p_y-q_y)^2+(p_z-q_z)^2}.

[edit] See also