Skip to content

Euclidean Distance

Definition

The Euclidean distance between two points x=(x1,…,xn)\boldsymbol{x}=(x_1,\ldots,x_n) and y=(y1,…,yn)\boldsymbol{y}=(y_1,\ldots,y_n) in Rn\mathbb{R}^n is d(x,y)=∥x−y∥=(x1−y1)2+⋯+(xn−yn)2d(\boldsymbol{x},\boldsymbol{y})=\|\boldsymbol{x}-\boldsymbol{y}\|=\sqrt{(x_1-y_1)^2+\cdots+(x_n-y_n)^2}.


Interpretation

Euclidean distance is the ordinary straight-line distance, inherited from the Euclidean norm: the distance between two points is the length of the vector from one to the other.

The points P = (1, 1) and Q = (4, 3) on a grid joined by a segment, with the horizontal leg 3 and vertical leg 2 of a right triangle; the distance is the square root of 13.

From P=(1,1)\boldsymbol{P}=(1,1) to Q=(4,3)\boldsymbol{Q}=(4,3) the coordinates change by 33 horizontally and 22 vertically. These differences are the legs of a right triangle, so by Pythagoras d(P,Q)=32+22=13d(\boldsymbol{P},\boldsymbol{Q})=\sqrt{3^2+2^2}=\sqrt{13}. In Rn\mathbb{R}^n the formula adds one squared difference per coordinate.

Drag the points x\boldsymbol{x} and y\boldsymbol{y}: the distance is the length of x−y\boldsymbol{x}-\boldsymbol{y}, the hypotenuse of a right triangle with the coordinate differences as legs.

The squares remove the signs, so d(x,y)=d(y,x)d(\boldsymbol{x},\boldsymbol{y})=d(\boldsymbol{y},\boldsymbol{x}), and d(x,y)=0d(\boldsymbol{x},\boldsymbol{y})=0 only when x=y\boldsymbol{x}=\boldsymbol{y}. For n=1n=1 the formula reduces to ∣x1−y1∣|x_1-y_1|, the distance on the real line given by the absolute value. A detour is never shorter: d(x,z)≤d(x,y)+d(y,z)d(\boldsymbol{x},\boldsymbol{z})\le d(\boldsymbol{x},\boldsymbol{y})+d(\boldsymbol{y},\boldsymbol{z}) is the triangle inequality for the norm. OR Modelling uses these distances as edge lengths in a Euclidean network.


Key Results

  • The distance between two points is the length of the vector connecting them.
  • The distance from a point to a line is the minimum Euclidean distance from the point to points on the line.

Examples

  • d((0,0),(3,4))=5d((0,0),(3,4))=5.
  • d((1,1),(2,2))=2d((1,1),(2,2))=\sqrt{2}.

Prerequisites

Sources

Aliases: Euclidean metric, L2 distance Keywords: straight-line distance Symbols: real numbers, square root

Last updated: 20 October 2026 03:02