Distance Formula
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 twodimensional plane which can be extended to find the distance between two points in a threedimensional 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 in the upcoming sections along with few solved examples and practice questions.
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 twodimensional plane and threedimensional 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 twodimensional 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.
Derivation of Distance Formula
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 the called the distance between two points formula.
Distance Between Two Points in 3D
To find the distance formula for 2 points in 3D plane, let us consider two points in a threedimensional 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 Formula to Calculate the 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. Both 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 twodimensional 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{\lefta 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{xx_1}{a}=\dfrac{yy_1}{b}=\dfrac{zz_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_1x_0, y_1y_0, z_1z_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 Formula to Calculate 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 (d) between L\(_1\) and L\(_2\) is:
d = \(\dfrac{\leftc_2c_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
Two lines in threedimensional space are said to be skew lines if they are nonparallel and nonintersecting. 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{xx_1}{a_1}=\dfrac{yy_1}{b_1}=\dfrac{zz_1}{c_1}\) and L\(_2\): \(\dfrac{xx_2}{a_2}=\dfrac{yy_2}{b_2}=\dfrac{zz_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 Formula to Find 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{\lefta x_{1}+b y_{1}+cz_1+d\right}{\sqrt{a^{2}+b^{2}+c^2}}\)
Calculate Distance Between Two Parallel Planes using Distance Formula
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{\leftd_2d_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 reallife 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 argand 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 threedimensional and also in ndimensional 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.
Related Topics:
Important Points:
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.
Examples Using Distance Formula

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 + (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 the distance formula to find the distance from a point to a line,
d = \(\dfrac{\lefta x_{1}+b y_{1}+c\right}{\sqrt{a^{2}+b^{2}}}\)
d= \(\dfrac{\left3(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{x2}{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{xx_1}{a}=\dfrac{yy_1}{b}=\dfrac{zz_1}{c}\), we get:
Q = \((x_1,y_1,z_1)\) = (2, 1, 3).
\(\bar{s}\) = <1, 2, 3>.
Then \(\overline{PQ} = (x_1x_0, y_1y_0, z_1z_0)\) = (2+1, 12, 35) = (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.
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_2y_1)^2}\).
What is 2D Distance Formula?
The 2D distance formula gives the shortest distance between two points in a twodimensional 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_2y_1)^2}\).
What is 3D Distance Formula?
The distance formula is three dimensional geometry is similar to the distance between two points in twodimensional 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 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 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{\lefta x_{1}+b y_{1}+c\right}{\sqrt{a^{2}+b^{2}}}\).
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{\leftd_2d_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{xx_1}{a}=\dfrac{yy_1}{b}=\dfrac{zz_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>
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.
visual curriculum