3D Distance Formula
Before learning 3d distance formula, let us recall the 2d distance formula, which gives the length of the line segment that joins two points on a plane. In the same way, the 3d distance formula gives the length of the line segment joining two points in the threedimensional space. The 2d distance formula for any 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}\)
The 3d distance formula is just an extension of this formula. Let us learn this formula along with a few solved examples.
What Is 3D Distance Formula?
The 3d distance formula says, the distance between two points in the space A(x_{1}, y_{1}, z_{1}) and B(x_{2}, y_{2}, z_{2}) is given as:
\(d = \sqrt{(x_2 x_1)^2 + (y_2y_1)^2+(z_2z_1)^2}\)
Here, d is the distance between A and B or the length of the line segment joining A and B.
Example
Find the distance between the points (1, 3, 2) and (2, 4, 1).
Solution
It is given that
(x_{1}, y_{1}, z_{1}) = (1, 3, 2)
(x_{2}, y_{2}, z_{2}) = (2, 4, 1)
Substitute these values in the 3d distance formula:
\[ \begin{align} d &= \sqrt{(x_2 x_1)^2 + (y_2y_1)^2+(z_2z_1)^2}\\[0.2cm] &= \sqrt{(21)^2+(43)^2+(1(2))^2}\\[0.2cm] &= \sqrt{1+1+1}\\[0.2cm] &= \sqrt{3} \end{align} \]
Thus, the distance between the given two points is \(\sqrt{3}\) units.
Note: The distance between two points, as it is the length of the line segment, is never negative.
Solved Examples Using 3D Distance Formula

Example 1
Use the 3D distance formula to prove the following points are collinear.
A(1, 0, 7), B(3, 2, 1), and C(5, 3, 2).
Solution:
Using the 3d distance formula,
\[ \begin{align} AB &= \sqrt{(3+1)^2+(20)^2+(17)^2}=2 \sqrt{14}\\[0.2cm] BC &= \sqrt{(53)^2+(32)^2+(21)^2}= \sqrt{14}\\[0.2cm] CA &= \sqrt{(5+1)^2+(30)^2+(27)^2} = 3 \sqrt{14} \end{align}\]
Here, AB + BC = CA.
Hence, A, B, and C are collinear.
Answer: Since AB + BC = CA, the given points are collinear.

Example 2:
Find a point on the yaxis that is equidistant from the points (−1, 2, 0) and (2, 3, 1)
Solution:
We know that the x and z coordinates of any point on the yaxis are 0.
Hence, we assume the point that is equidistant from the given points to be (0, k, 0). i.e.,
Distance between (0, k, 0) and (−1, 2, 0) = Distance between (0, k, 0) and (2, 3, 1)
\(\begin{aligned} \sqrt{(10)^2+(2k)^2+(00)^2}&= \sqrt{(20)^2+(3k)^2+(10)^2}\\[0.2cm] (10)^2+(2k)^2+(00)^2&=(20)^2+(3k)^2+(10)^2 \\[0.2cm] 1+4+k^24k&=4+9+k^26k+1\\[0.2cm] 4k+5&=6k+14\\[0.2cm] 2k&=9\\[0.2cm] k&= \dfrac{9}{2} \end{aligned}\)
Answer: k = \( \dfrac{9}{2}\)