Distance Formula

Last Updated : 23 Feb, 2026

The distance formula is used to find the distance between two points in cartesian coordinate system and can be calculated using the distance formula.

distance_formula

Let's say you have two points: A (x1​, y1​) and B (x2​, y2​).

Distance 'd' between A and B is given by the formula: d = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}the

Derivation

Derivation of the Distance Formula is given using Pythagoras Theorem. In the right-angled triangle ABC, we have:

AB2 = AC2 + BC2

  • Distance between points A and C is (x2 - x1)
  • Distance between points B and C is (y2 - y1)

Distance, d is calculated as:

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

Now, taking the square root on both sides,

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

Thus, d is the distance between two points.

Distance between Two Points in Polar Co-ordinates

We can also calculate the distance between two points using the polar coordinates.

Let's take two points A (r1, θ1) and B (r2, θ2) then the distance between them is calculated using the Distance Formula:

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

Distance From a Point To a Plane

In 3D we can also calculate the distance between a point and the plane using the distance formula.

Let's take point A (x1, y1, z1) and plane P: ax + by + cz + d = 0 then the distance between the point and the plane is given using the Distance Formula:

d = \frac{|ax_1 + by_1 + cz_1|} { \sqrt{(a^2 + b^2 + c^2)}}

The image below shows the distance between the point and the plane:

5

Applications

Distance Formula has various applications in Mathematics, Sciences, and others and some of the most important applications of the Distance Formula are:

  • The distance of a point from the origin is calculated using the Distance Formula.
  • Distance between two points in 2D and 3D planes is calculated using the Distance Formula.
  • The magnitude of the vector is calculated using the Distance Formula.
  • The magnitude of the complex number is calculated using the Distance formula.

Apart from this distance formula also has some real-life applications which are:

  • Distance Formula is used to find the distance between two stars.
  • Distance Formula is also used to find the distance between various points in the sea and oceans.
  • Distance Formula is used to find the linear distance between two points in the Globe.

Solved Examples

Example 1: Calculate the distance between the points X(5, 15) and Y(4, 14).

Distance between point X and Y is given by distance formula

d = √[( x2 - x1 )2 + ( y2 - y1 )2]

⇒ d = √[( 4 - 5 )2 + ( 14 - 15 )2]

⇒ d = √[( 1 )2 + ( 1 )2]

⇒ d = √(2)

Distance between X and Y is √2 or 1.41

Example 2: Find the distance between the parallel lines -6x + 20y + 10 = 0 and -6x + 20y + 20 = 0.

General equation of parallel lines is

Ax + By + C1 = 0 and Ax + By + C2 = 0, 

Here, 

A = -6, B = 20, C1 = 10, and C2 = 20

Applying formula

d = \frac{|c_2-c_1|}{\sqrt{a^2+b^2}}

⇒ d = \frac{|20-10|}{\sqrt{-6^2+20^2}}\\ \frac{|10|}{\sqrt{36+400}}\\ \frac{10}{\sqrt{436}}

⇒ d = 10 / √436

Thus, the distance between two parallel lines is d = 10 / √436

Example 3: Calculate the distance between line 4a + 6b – 26 = 0 from the point (2, –4) using the Distance Formula in maths.

General equation of parallel lines is

A point (x1, y1) and a line ax + by + c = 0

Here,

A = 4, B = 6 and C = –26

Applying formula

d = \frac{|ax_1+by_1+c|}{\sqrt{a^2+b^2}}

⇒ d = \frac{|4\times2+6\times(-4)+(-26)|}{\sqrt{4^2+6^2}}\\ =\frac{8-24-26}{\sqrt{16+36}}\\ =\frac{-42}{\sqrt{52}}

⇒ d = -42 / √52

Thus, the distance between lines and point is d = -42 / √52

Example 4: Calculate the distance between points A(-25, -5) and B(-16, -4) using the Distance Formula in Maths.

Distance between point A and B is given by distance formula

d = √[( x2 - x1 )2 + ( y2 - y1 )2]

⇒ d = √[( (-16) - (-25) )2 + ( (-4) - (-5) )2]

⇒ d = √[( 9 )2 + ( 1 )2]

⇒ d = √(82)

Distance between A and B is √82 or 9.05

Practice Problems

1. A square has one vertex at (1, 1) and the opposite vertex at (4, 4). Calculate the length of the diagonal.

2. Calculate the distance between the points (-5, -5) and (-1, -1).

3. Find the distance between the points (2, -3) and (-4, 5).

4. Two points, A and B, have coordinates (2, 3) and (10, 7) respectively. A third point, C, lies on the line segment AB and divides it into a ratio of 2:1. Find the coordinates of point C and calculate the distance from C to point A.

5. Calculate the distance between the points (1, 2, 3) and (4, 6, 9).

6. Two vertices of a cube are (0, 0, 0) and (3, 3, 3). Determine the length of the diagonal that connects these two vertices inside the cube.

Answer:-

  1. 3√2
  2. 4√2
  3. 10
  4. (8√5)/3
  5. √61
  6. 3√3
Comment

Explore