Euclidean Distance

Last Updated : 31 Jul, 2026

Euclidean distance is the straight-line distance between two points in a plane or higher-dimensional space.

  • It is like measuring the straightest and shortest path between two points.
  • Imagine you have a string and you stretch it tight between two points on a map; the length of that string is the Euclidean distance.
  • It tells you how far apart the two points are without any turns or bends, just like a bird would fly directly from one spot to another.
2056958497
Real-life Applications of Euclidean Distance

This metric is based on the Pythagorean theorem and is widely utilized in various fields such as machine learning, data analysis, computer vision, and more.

Formula

Consider two points (x1, y1) and (x2, y2) in a 2-dimensional space; the Euclidean distance between them is given by using the formula:

euclidean-distance-formula-derivation-2

d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

  • d is Euclidean distance,
  • (x1, y1) is the coordinate of the first point,
  • (x₂, y₂) is the coordinate of the second point.

Euclidean Distance in 3D

If the two points (x1, y1, z1) and (x2, y2, z2) are in a 3-dimensional space, the Euclidean distance between them is given by using the formula:

d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2+ (z_2 - z_1)^2}

Where,

  • d is Euclidean distance,
  • (x1, y1, z1) is the coordinate of the first point,
  • (x₂, y₂, z₂) is the coordinate of the second point.

Euclidean Distance in nD

In general, the Euclidean distance formula between two points (x11, x12, x13, ..., x1n) and (x21, x22, x23, ..., x2n) in an n-dimensional space is given by the formula:

d = \sqrt{∑^{n}_{i=1}(x_{2i} – x_{1i})^2}

Where,

  • i ranges from 1 to n,
  • d is Euclidean distance,
  • (x11, x12, x13, ..., x1n) is the coordinate of the first point,
  • (x21, x22, x23, ..., x2n) is the coordinate of the second point.

Euclidean Distance vs. Manhattan Distance

AspectEuclidean DistanceManhattan Distance
DefinitionMeasures the shortest straight-line distance between two points.Measures the distance between two points along axes at right angles.
Formula (2D)

d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

d = [|x2 - x1| + |y2 - y1|]
PathDirect straight line.The path that resembles city blocks or a grid pattern.
Metric NameL2 norm or Euclidean norm.L1 norm or Manhattan norm.
Use CasesUsed in scenarios where direct distances are needed (e.g., physics).Commonly used in planning, urban design, and certain optimization algorithms.
Sensitivity to ScalingMore sensitive to outliers because differences are squared.Less sensitive to outliers since it uses absolute differences.

➢Practice: Solved Examples

Comment

Explore