Any distance formula, as its name suggests, gives the distance (the length of the line segment). For example, the distance between two points is the length of the line segment connecting them. We use the Pythagoras theorem to derive the formula for distance between two points in a two-dimensional plane which can be extended to find the distance between two points in a three-dimensional plane as well. There are different types of distance formulas in coordinate geometry.

- Distance between two points in a 2D plane
- Distance between two points in a 3D plane
- Distance from a point to a line in 2D
- Distance between two parallel lines in 2D
- Distance from a point to a line in 3D
- Shortest distance between two skew lines
- Distance from a point to a plane
- Distance between two parallel planes

Let us learn all these distance formulas in detail along with a few solved examples and practice questions.

1. | What is Distance Formula? |

2. | Formula For Distance Between Two Points |

3. | Distance From a Point To a Line |

4. | Formula for Distance Between Two Lines |

5. | Distance From a Point To a Plane |

6. | Formula for Distance Between Two Parallel Planes |

7. | Applications of Distance Formula |

8. | FAQs on Distance Formula |

## What is Distance Formula?

We have a list of distance formulas in coordinate geometry that can be used to find the distance between two points, distance between a point to a line, the distance between two parallel lines, the distance between two parallel planes, etc. All the distance formulas are listed below and we will study each formula separately in the upcoming sections.

## Distance Formula to Calculate Distance Between Two Points

We will see the distance between two points in a two-dimensional plane and a three-dimensional space. Both distance formulas are derived by using the Pythagoras theorem.

### Distance Between Two Points in 2D

The distance formula which is used to find the distance between two points in a two-dimensional plane is also known as the Euclidean distance formula. To derive the formula, let us consider two points in 2D plane A\((x_1, y_1)\), and B\((x_2, y_2)\). Assume that 'd' is the distance between A and B. Then the distance formula is d = √[(x\(_2\) – x\(_1\))^{2} + (y\(_2\) – y\(_1\))^{2}].

## Derivation of Distance Formula

From the above figure:

- AC = \(x_2-x_1\)
- BC = \(y_2-y_1\)

By the Pythagoras theorem,

AB^{2} = AC^{2} + BC^{2}

d^{2} = (x\(_2\) – x\(_1\))^{2} + (y\(_2\) – y\(_1\))^{2}

Taking the square root on both sides,

d = √[(x\(_2\) – x\(_1\))^{2} + (y\(_2\) – y\(_1\))^{2}]

This is called the distance between two points formula.

### Distance Between Two Points in 3D

To find the distance formula for 2 points in 3-D plane, let us consider two points in a three-dimensional plane A\((x_1, y_1, z_1)\), and B\((x_2, y_2, y_3)\). Let 'd' is the distance between A and B. By applying the same logic (as explained in the previous section) of finding distance between two points in 2D, the distance between two points in 3D is,

d = √[(x\(_2\) – x\(_1\))^{2} + (y\(_2\) – y\(_1\))^{2} + (z\(_2\) – z\(_1\))^{2}]

## Distance From a Point To a Line

In this section, we will see the distance formula for the distance from a point to a line in 2D and 3D. Note that these two formulas do not look similar.

### Distance From a Point To a Line in 2D

The distance formula to calculate the distance from a point to a line is the length of the perpendicular line segment that is drawn from the point to the line. Let us consider a line L in a two-dimensional plane with the equation ax + by + c =0 and consider a point P\((x_1,y_1)\). Then the distance (d) from P to L is,

d = \(\dfrac{\left|a x_{1}+b y_{1}+c\right|}{\sqrt{a^{2}+b^{2}}}\)

If you want to know how this formula is derived, click here.

### Distance From a Point To a Line in 3D

To find distance formula to calculate the distance from a point to a line in 3D, consider a point P \((x_0, y_0, z_0)\) and a line (L) in 3D whose equation is \(\dfrac{x-x_1}{a}=\dfrac{y-y_1}{b}=\dfrac{z-z_1}{c}\). Then the distance (d) from the point P to L is,

\(d=\dfrac{| \overline{PQ} \times \bar{s} |}{|\bar{s}|}\), where

- P = \((x_0, y_0, z_0)\) is the given point from which we are finding the distance to the line L
- Q = \((x_1,y_1,z_1)\) is a point on the line (which is from the equation of the line)
- \(\overline{PQ} = (x_1-x_0, y_1-y_0, z_1-z_0)\)
- \(\bar{s}\) = <a, b, c> is the direction vector of the line
- \(\overline{PQ} \times \bar{s}\) is the cross product of \(\overline{PQ}\) and \(\bar{s}\).

## Distance Between Two Lines

### Distance Between Two Parallel Lines in 2D

We know that the slopes of two parallel lines are always the same. So we can assume the two parallel lines to be L\(_1\): ax + by + c\(_1\) = 0 and L\(_2\): ax + by + c\(_2\) = 0. Then the distance formula (d) between the parallel linesL\(_1\) and L\(_2\) is:

d = \(\dfrac{\left|c_2-c_1\right|}{\sqrt{a^{2}+b^{2}}}\)

If you want to know how to derive this formula, click here.

### Shortest Distance Between Two Skew Lines in 3D

Two lines in three-dimensional space are said to be skew lines if they are non-parallel and non-intersecting. The distance formula to calculate the shortest distance between them can be found using one of the following formulas depending on whether they are given in cartesian form or in vector form.

- The distance between two lines given in cartesian form L\(_1\): \(\dfrac{x-x_1}{a_1}=\dfrac{y-y_1}{b_1}=\dfrac{z-z_1}{c_1}\) and L\(_2\): \(\dfrac{x-x_2}{a_2}=\dfrac{y-y_2}{b_2}=\dfrac{z-z_2}{c_2}\) is:

\(d = \left| \dfrac{\begin{vmatrix} x_2 – x_1 & y_2 – y_1 & z_2 – z_1\\ a_1 & b_1 & c_1\\ a_2 & b_2 & c_2 \end{vmatrix} }{ {[(b_1c_2 – b_2c_1)^2 + ( c_1a_2 – a_2c_1)^2 + (a_1b_2– b_2a_1)^2}]^{1/2}}\right|\) - The distance between two lines given in vector form L\(_1\):\( \overrightarrow{r_1} = \overrightarrow{a_1} + t \overrightarrow{b_1} \) and L\(_2\): \(\overrightarrow{r_2} = \overrightarrow{a_2} + t \overrightarrow{b_2}\) is,

\(d = \dfrac{ \left|(\overrightarrow{a_2} - \overrightarrow{a_1}).(\overrightarrow{b_1}\times \overrightarrow{b_2})\right|}{|\overrightarrow{b_1}\times \overrightarrow{b_2}|}\)

## Distance From a Point To a Plane

The distance from a point to a plane formula resembles the distance formula to find the distance from a point to a line (which is discussed in one of the previous sections). The distance (D) from a point \((x_1,y_1,z_1)\) to a plane ax + by + cz + d = 0 is given by:

D = \(\dfrac{\left|a x_{1}+b y_{1}+cz_1+d\right|}{\sqrt{a^{2}+b^{2}+c^2}}\)

## Distance Between Two Parallel Planes

The distance between two parallel lines formula resembles the distance between two parallel lines formula. We know that the normal vectors of two parallel planes are either equal or in proportion. Thus, to find the distance formula between two parallel planes, we can consider the equations of two parallel planes to be ax + by + cz + d\(_1\) = 0 and ax + by + cz + d\(_2\) = 0. Then the distance (d) between two parallel planes is,

d = \(\dfrac{\left|d_2-d_1\right|}{\sqrt{a^{2}+b^{2}+c^2}}\)

## Applications of Distance Formula

The distance formula has numerous applications in other areas of mathematics and also in many real-life situations. Some of the uses of the distance formula are as follows.

- The distance of any point from the origin can be calculated using the distance formula.
- The complex number is represented in the arg-and plane, and the formula to find the magnitude of a complex number has been derived from the distance formula.
- The distance formula can also be used to find the distance between two points in three-dimensional and also in n-dimensional planes.
- The distance formula can be used to derive the magnitude formula, to find the magnitude of a vector.
- The distance between two points in a sea can be found by identifying the geographic coordinates of the two points and then applying the distance formula.
- The distance between two cities for the purpose of travel by air is the shortest distance and is calculated using the distance formula.

**Important Points on Distance Formula:**

The following are the important points related to the distance formula.

- The distance calculated through the distance formula always takes a positive sign.
- The distance calculated is the shortest linear distance between the two points.
- The distance formula gives the same answer for the points located in any of the four quadrants.

☛ **Related Topics:**

- Distance Between Two Points Calculator
- x and y axis
- Coordinate Geometry
- Coordinate Plane

## Distance Formula Examples

**Example 1:**Find the distance between the points (-2, 3), and (5, 6).**Solution:**The given two points are \((x_1, y_1)\) = (-2, 3), and \((x_2, y_2)\) = (5, 6)

Using the Euclidean distance formula,

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

= \(\sqrt{(5 + 2)^2 + (6 - 3)^2}\)

= \(\sqrt{7^2 + 3^2}\)

= \(\sqrt{49 + 9}\)

= \(\sqrt{58}\)

**Answer:**Therefore the distance between the points is \(\sqrt{58}\).**Example 2:**Find the distance from the point (3, -5) to the line 3x - 4y = 5.**Solution:**The given point is, \((x_1,y_1)\) = (3, -5).

The given line can be written as 3x - 4y - 5 = 0. Comparing this with ax + by + c = 0, we get a = 3, b = -4, and c = -5.

Using one of the distance formulas:

d = \(\dfrac{\left|a x_{1}+b y_{1}+c\right|}{\sqrt{a^{2}+b^{2}}}\)

d= \(\dfrac{\left|3(3) -4(-5)-5\right|}{\sqrt{3^2+(-4)^2}}\)

d = 24 / 5.

**Answer:**The distance from the given point to the given line = 24 / 5 units.**Example 3:**Find the distance from the point (-1, 2, 5) to the line \(\dfrac{x-2}{1}=\dfrac{y+1}{2}=\dfrac{z- 3}{3}\) and round your answer to the nearest hundredths.**Solution:**The given point is P \((x_0, y_0, z_0)\) = (-1, 2, 5).

Comparing the given line with \(\dfrac{x-x_1}{a}=\dfrac{y-y_1}{b}=\dfrac{z-z_1}{c}\), we get:

Q = \((x_1,y_1,z_1)\) = (2, -1, 3).

\(\bar{s}\) = <1, 2, 3>.

Then \(\overline{PQ} = (x_1-x_0, y_1-y_0, z_1-z_0)\) = (2+1, -1-2, 3-5) = (3, -3, -2).

Now we will find the cross-product.

\(\overline{PQ} \times \bar{s}\) = \(\left|\begin{array}{rrr}

\mathrm{i} & \mathrm{j} & \mathrm{k} \\

3 & -3 & -2 \\

1 & 2 & 3

\end{array}\right|\)

= < (-9 + 4), 9 + 2, (6 + 3)>

= <-5, 11, 9>

Its magnitude is,

\(| \overline{PQ} \times \bar{s} |\) = \(\sqrt{(-5)^2+11^2+9^2}\) = \(\sqrt{227}\)

Also, \(|\bar{s}|\) = \(\sqrt{1^2+2^2+3^2}\) = \(\sqrt{14}\)

Using the distance formula to find the distance from a point to a line,

\(d=\dfrac{| \overline{PQ} \times \bar{s} |}{|\bar{s}|}\)

\(d = \dfrac{\sqrt{227}}{\sqrt{14}}\) ≈ 4.03

**Answer:**The distance from the given point to the given line = 4.03 units.

View More >

go to slidego to slidego to slide

Great learning in high school using simple cues

Indulging in rote learning, you are likely to forget concepts. With Cuemath, you will learn visually and be surprised by the outcomes.

Book a Free Trial Class

## Practice Questions on Distance Formula

Check Answer >

go to slidego to slide

## FAQs on Distance Formula

### What is the Distance Formula in Coordinate Geometry?

The** distance formula** in coordinate geometry is used to calculate the distance between two given points. The distance formula to calculate the distance between two points \((x_1, y_1)\), and \((x_2, y_2)\) is given as, \(D = \sqrt{(x_2 -x_1)^2 + (y_2-y_1)^2}\).

### What is 2D Distance Formula?

The 2D distance formula gives the shortest distance between two points in a two-dimensional plane. The formula says the distance between two points \((x_1, y_1)\), and \((x_2, y_2)\) is \(D = \sqrt{(x_2 -x_1)^2 + (y_2-y_1)^2}\).

### What are Different Distance Formulas in Maths?

We have different distance formulas in maths which are as follows:

- Distance between two points formula in 2D: \(D = \sqrt{(x_2 -x_1)^2 + (y_2-y_1)^2}\).
- Distance between two points formula in 3D: \(D=\sqrt{(x_2 - x_1)^2 + (y_2 -y_1)^2 + (z_2 - z_1)^2}\).
- Distance from a point to a line formula in 2D: D = \(\dfrac{\left|a x_{1}+b y_{1}+c\right|}{\sqrt{a^{2}+b^{2}}}\)
- Distance from a point to a line formula in 3D: \(D=\dfrac{| \overline{PQ} \times \bar{s} |}{|\bar{s}|}\)
- Distance between two parallel lines formula in 2D: D = \(\dfrac{\left|c_2-c_1\right|}{\sqrt{a^{2}+b^{2}}}\)
- Shortest distance formula between two skew lines: \(D = \left| \dfrac{\begin{vmatrix} x_2 – x_1 & y_2 – y_1 & z_2 – z_1\\ a_1 & b_1 & c_1\\ a_2 & b_2 & c_2 \end{vmatrix} }{ {[(b_1c_2 – b_2c_1)^2 + ( c_1a_2 – a_2c_1)^2 + (a_1b_2– b_2a_1)^2}]^{1/2}}\right|\)
- Distance from a point to a plane formula: D = \(\dfrac{\left|a x_{1}+b y_{1}+cz_1+d\right|}{\sqrt{a^{2}+b^{2}+c^2}}\)
- Distance between two parallel planes formula: D = \(\dfrac{\left|d_2-d_1\right|}{\sqrt{a^{2}+b^{2}+c^2}}\)

### What is Manhattan Distance Formula?

The distance between two points measured along the right angular axis is called the manhattan distance. The manhattan distance formula between the points \((x_1, y_1)\), and \((x_2, y_2)\) is |\(x_2 - x_1\)| + |\(y_2 - y_1\)|.

### What is 3D Distance Formula?

The distance formula is three-dimensional geometry is similar to the distance between two points in two-dimensional geometry. The distance between two points \((x_1, y_1, z_1)\), and \((x_2, y_2, z_2)\) in a three dimensional space is equal to \(\sqrt{(x_2 - x_1)^2 + (y_2 -y_1)^2 + (z_2 - z_1)^2}\).

### How to Derive Distance Formula?

The distance formula can be derived using the Pythagoras theorem. The distance between two points \((x_1, y_1)\) and \((x_2, y_2)\) is calculated by first finding the distance between the x coordinates of the points, \(x_1\) and \(x_2\) which represents the base of the right triangle, then finding the distance between the y coordinates of the points \(y_1\) and \(y_2\) which represents the altitude, and the distance between these two given points represents the hypotenuse of the right triangle. Finally, applying the Pythagoras formula we get

Hypotenuse^{2} = Base^{2} + Altitude^{2}

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

Taking square root on both sides,

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

### What is Distance Formula To Find Distance From a Point To a Line?

The distance from a point to a line is nothing but the length of the perpendicular drawn from the point to the line. The distance from a point \((x_1,y_1)\) to the line ax + by + c =0 is, d = \(\dfrac{\left|a x_{1}+b y_{1}+c\right|}{\sqrt{a^{2}+b^{2}}}\).

### How is the Pythagorean Theorem Related to the Distance Formula?

Pythagorean formula is used to find the derivation of the distance formula. The distance between two points \((x_1, y_1)\) and \((x_2, y_2)\) is calculated by, Distance^{2} = \((x_2 - x_1)^2 + (y_2 - y_1)^2 \), or, Distance = \(\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}\), where, \((x_1, y_1)\) and \((x_2, y_2)\) are two vertices of a right angled triangle that form its hypotenuse when joined.

### What is Distance Formula To Find Distance Between Two Parallel Planes?

Two parallel planes are of the form ax + by + cx + d\(_1\) = 0 and ax + by + cx + d\(_2\) = 0. The distance formula to find the distance (d) between these two parallel lines is d = \(\dfrac{\left|d_2-d_1\right|}{\sqrt{a^{2}+b^{2}+c^2}}\).

### What is Distance Formula To Find Distance From a Point To a Line in 3D?

The distance formula to find the distance from a point P \((x_0, y_0, z_0)\) to a line \(\dfrac{x-x_1}{a}=\dfrac{y-y_1}{b}=\dfrac{z-z_1}{c}\) is \(d=\dfrac{| \overline{PQ} \times \bar{s} |}{|\bar{s}|}\), where

- Q = \((x_1,y_1,z_1)\)
- \(\bar{s}\) = <a, b, c>