Courses
Courses for Kids
Free study material
Offline Centres
More
Store Icon
Store

What Is Euclidean Distance? Formula, Definition & Applications

Reviewed by:
ffImage
hightlight icon
highlight icon
highlight icon
share icon
copy icon
SearchIcon

How to Calculate Euclidean Distance: Step-by-Step Guide

The Euclidean distance, a positive number, represents the spacing between two points in a space where Euclid's geometry's axioms and theorems are true. The distance between points A and B in a Euclidean space is the length of the line segment AB belonging to the only line that passes through these points.


The space we perceive and where we human beings move is a three-dimensional space (3-D), where the axioms and theorems of Euclid's geometry are fulfilled. Two-dimensional subspaces (flats) and one-dimensional subspaces (lines) are contained in this space.


Euclidean spaces can be one-dimensional (1-D), two-dimensional (2-D), and three-dimensional (3-D).


Euclidean Distance in One Dimension

The oriented line (OX) connects all points in the one-dimensional space X, and the direction from O to X is positive.


Euclidean distance in 1 D


Euclidean distance in 1 D


To locate the points on said line, the Cartesian system is used, which consists of assigning a number to each point on the line.


The Euclidean distance d(A, B) between points A and B, located on a line, is defined as the square root of the square of the differences of their X coordinates:

\[d(A,B) = \sqrt {({{({X_B} - {X_A})}^2})} \]

This definition guarantees that: The distance between two points is always a positive quantity. And that the distance between A and B is equal to the distance between B and A.


Euclidean Distance in Two Dimensions

Two-dimensional Euclidean space is a plane. The points of a Euclidean plane satisfy the axioms of Euclidean geometry, for example:


  • Only one line connects two points.

  • Three points on the plane form a triangle whose internal angles always add up to 180º.

  • The square of the hypotenuse in a right triangle equals the sum of the squares of its legs.

  • A point has X and Y coordinates in two dimensions.


For instance, the coordinates of a point P are (XP, YP), whereas those of a point Q are (XQ, YQ).

The Euclidean distance between the points P and Q is defined with the following formula:

\[d(P,Q) = \sqrt {[{{({X_Q} - {X_P})}^2} + {{({Y_Q} - {Y_P})}^2}]} \]

It should be noted that this formula is equivalent to the Pythagorean theorem, as shown in Figure 2.


The distance between two points P and Q of the plane fulfils the Pythagorean theorem


The distance between two points P and Q of the plane fulfils the Pythagorean theorem


The Euclidean Distance Formula Derivation

To derive the Euclidean distance formula, let us consider two points, A (x1, y1) and B (x1, y2) and assume that d is the distance between them. Join A and B by a line segment. We create a right-angled triangle using AB as the hypotenuse to arrive at the formula. To do this, we construct lines from points A and B that meet at point C, as illustrated below.


Derivation of euclidean distance formula


Derivation of euclidean distance formula


The Pythagorean theorem will now be applied to the triangle ABC. Then comes,

\[A{B^2} = A{C^2} + B{C^2}\]

\[{d^2} = {\left( {{x_2} - {x_1}} \right)^2} + {\left( {{y_2} - {y_1}} \right)^2}\]

Taking the square root on both sides,

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

Hence the Euclidean distance formula is derived.

Let’s now see some solved Euclidean distance examples.


Solved Examples

Example 1: Find the Euclidean distance between points (2,4) and (-2, -4).

Solution: Given points are (x1, y1) = (2,4) and (x2, y2) = (-2, -4)

Use Euclidean distance formula,

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

\[d = \sqrt {\left[ {{{\left( { - 2 - 2} \right)}^2} + {{\left( { - 4 - 4} \right)}^2}} \right]} \]

\[d = \sqrt {{{\left( { - 4} \right)}^2} + {{\left( { - 8} \right)}^2}} \]

\[d = \sqrt {16 + 64} \]

\[d = \sqrt {80} \]

\[d = 4\sqrt 5 \] units


Example 2: Find the distance between points (1,1) and (5,4).

Sol: Given points are (x1, y1) = (1,1) and (x2, y2) = (5,5)

Use Euclidean distance formula,

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

\[d = \sqrt {\left[ {{{\left( {5 - 1} \right)}^2} + {{\left( {5 - 1} \right)}^2}} \right]} \]

\[d = \sqrt {{4^2} + {4^2}} \]

\[d = \sqrt {16 + 16} \]

\[d = \sqrt {32} \,units\]


Key Features about Euclidean Distance

  • The Euclidean distance in mathematics is the length of a line segment connecting two points in Euclidean space.

  • The distance between the two locations should be calculated from the length of the line segment that connects them.

  • Since it could be calculated from the points' cartesian coordinates using the Pythagorean Theorem, it is frequently referred to as the Pythagorean distance.

  • These designations are drawn from the ancient Greek mathematicians Euclid and Pythagoras, even though Euclid did not characterise distances as numbers and the connection between the Pythagorean theorem and distance calculation was not understood until the 18th century.


Summary

The Euclid distance formula for 1 dimensional is the absolute value of the difference x-coordinates of the points. The Euclid distance of 1 dimensional is a line segment. The y-coordinate of the points is zero.

The Euclid distance formula for 2 dimensional is \[d = \sqrt {{{\left( {{x_2} - {x_1}} \right)}^2} + {{\left( {{y_2} - {y_1}} \right)}^2}} \].


List of Related Articles


Practice Questions

Q 1: Find the distance between points (1,2) and (3,5) using the Euclidean distance formula.

Ans: \[\sqrt {13} \] units.


Q 2: Find the distance between points A (2,8) and B (5,8).

Ans: 3 units.

FAQs on What Is Euclidean Distance? Formula, Definition & Applications

1. What exactly is Euclidean distance and what is its formula for two points in a plane?

Euclidean distance is the most common way of representing the shortest, straight-line distance between two points in Euclidean space. In a two-dimensional (2D) plane, if you have two points, P₁(x₁, y₁) and P₂(x₂, y₂), the Euclidean distance (d) between them is calculated using the distance formula, which is derived from the Pythagorean theorem: d = √[(x₂ – x₁)² + (y₂ – y₁)²].

2. Can you provide a simple, step-by-step example of calculating Euclidean distance?

Certainly. Let's find the distance between two points: Point A at (3, 4) and Point B at (9, 12).

  • Step 1: Identify the coordinates. Here, x₁=3, y₁=4, and x₂=9, y₂=12.
  • Step 2: Substitute these values into the distance formula: d = √[(9 – 3)² + (12 – 4)²].
  • Step 3: Calculate the differences: d = √[(6)² + (8)²].
  • Step 4: Square the results and add them: d = √[36 + 64] = √100.
  • Step 5: Find the square root. The Euclidean distance is 10 units.

3. Why is the Euclidean distance formula fundamentally based on the Pythagorean theorem?

The Euclidean distance formula is a direct application of the Pythagorean theorem (a² + b² = c²) on a coordinate plane. If you draw a line between two points, this line becomes the hypotenuse (c) of a right-angled triangle. The horizontal distance between the points (|x₂ – x₁|) forms one leg (a) of the triangle, and the vertical distance (|y₂ – y₁|) forms the other leg (b). Applying the theorem, we get (x₂ – x₁)² + (y₂ – y₁)² = d², which gives the distance formula when solved for d.

4. How can Euclidean distance be used to check if three points are collinear?

Three points A, B, and C are collinear if they all lie on a single straight line. You can verify this using Euclidean distance by applying the segment addition postulate. First, calculate the distances between all three pairs of points: d(A,B), d(B,C), and d(A,C). If the sum of the two shorter distances equals the longest distance (e.g., if d(A,B) + d(B,C) = d(A,C)), then the points are collinear. If the sum is greater, the points form a triangle.

5. What are some common real-world applications of Euclidean distance?

Euclidean distance is crucial in many practical fields. Key applications include:

  • Navigation and Geolocation: GPS systems use it to calculate the shortest path between two points on a map.
  • Computer-Aided Design (CAD): Engineers use it to determine lengths and clearances between components in a design.
  • Robotics: It helps a robot determine the most direct path to move its arm or navigate through an area.
  • Sports Analytics: To track the total distance a player has run on a field.

6. How is Euclidean distance applied in advanced fields like Machine Learning and Computer Vision?

In advanced fields, Euclidean distance is a fundamental metric for measuring similarity.

  • In Machine Learning, algorithms like K-Nearest Neighbors (KNN) and K-Means Clustering heavily rely on it to group similar data points. For instance, in a recommendation system, it can measure the 'distance' between user preferences.
  • In Computer Vision, it helps in tasks like object recognition by comparing feature vectors of images. For facial recognition, it can measure the distance between key facial landmarks.

7. How does Euclidean distance compare to other metrics like Manhattan distance?

The primary difference lies in how the path is measured. Euclidean distance calculates the 'as-the-crow-flies' or diagonal distance, representing the shortest possible path. In contrast, Manhattan distance (or 'taxicab distance') calculates the distance by summing the absolute differences along the axes, as if travelling on a city grid where you can only move horizontally or vertically. For two points, the Manhattan distance is always greater than or equal to the Euclidean distance.

8. Why is the squared Euclidean distance sometimes used instead of the standard formula?

The squared Euclidean distance is often used for computational efficiency, especially in data science and machine learning. Calculating a square root is computationally more expensive than multiplication. In applications where we only need to compare distances (e.g., to find the 'closest' point), we don't need the actual distance value. Since the square root function is monotonic (meaning it preserves the order), comparing the squared distances (d²) will yield the same result as comparing the true distances (d) but much faster.