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 |
Definition
The Euclidean distance between points <math>P=(p_1,p_2,\dots,p_n)\,</math> and <math>Q=(q_1,q_2,\dots,q_n)\,</math>, in Euclidean n-space, is defined as:
- <math>\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}.</math>
One-dimensional distance
For two 1D points, <math>P=(p_x)\,</math> and <math>Q=(q_x)\,</math>, the distance is computed as:
- <math>\sqrt{(p_x-q_x)^2} = | p_x-q_x |</math>
The absolute value signs are used since distance is normally considered to be an unsigned scalar value.
Two-dimensional distance
For two 2D points, <math>P=(p_x,p_y)\,</math> and <math>Q=(q_x,q_y)\,</math>, the distance is computed as:
- <math>\sqrt{(p_x-q_x)^2 + (p_y-q_y)^2}</math>
Alternatively, expressed in circular coordinates (also known as polar coordinates), using <math>P=(r_1, \theta_1)\,</math> and <math>Q=(r_2, \theta_2)\,</math>, the distance can be computed as:
- <math>\sqrt{r_1^2 + r_2^2 - 2 r_1 r_2 \cos(\theta_1 - \theta_2)}</math>
Three-dimensional distance
For two 3D points, <math>P=(p_x,p_y,p_z)\,</math> and <math>Q=(q_x,q_y,q_z)\,</math>, the distance is computed as
- <math>\sqrt{(p_x-q_x)^2 + (p_y-q_y)^2+(p_z-q_z)^2}.</math>


