3D Distance Notes
These 3D Distance Notes explain how to measure how far apart two points in space are, with the working shown line by line. The gap along each axis is found first, each gap is squared, and the square root of their total is the straight-line distance. Squaring removes the signs, so the order of the two points never changes the answer. Following the same pattern every time keeps the three axis gaps separate until the very end.
Enter the coordinates of \(P_{1} = (x_{1}, y_{1}, z_{1})\) and \(P_{2} = (x_{2}, y_{2}, z_{2})\).
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the points into the formula.
- Work out the differences.
- Work out the distance.
Formula: 3D Distance Formula
This formula gives the straight-line distance between two points in space. Subtract each pair of coordinates, square, add, then take the square root.
Useful Tips to Remember
The 3D distance formula is the 2D one with a third term for z. Subtract in the same order for all three coordinates, although squaring means the order of the points does not change the answer. A distance is never negative. If two coordinates match, that term is 0, but it still belongs in the formula.
Required knowledge
- How to subtract numbers, including negatives, covered in the Subtraction of Small Numbers Calculator.
- How to simplify a square root, covered in the Simplifying Radicals Calculator.
- The same idea on a flat grid, covered in the Distance Between Two Points Calculator.
Where Is the 3D Distance Formula Used?
The 3D distance formula measures straight-line distances in space, which is needed anywhere objects have three coordinates. Drones, aircraft and satellites use it to work out how far apart they are. Game engines check 3D distances for collisions and for when enemies notice the player. Chemists measure bond lengths between atoms from their coordinates, and in data science the same formula extends to any number of dimensions to compare data points.
- Distances between drones, aircraft and satellites
- Collision and range checks in 3D games
- Bond lengths between atoms in chemistry
- Measuring parts in CAD and 3D printing
- Nearest-neighbour searches in data science
3D Distance Practice Problems
Example 1 finds the distance from \((1, 2, 3)\) to \((4, 6, 3)\), which is a whole number, and Example 2 measures from the origin to \((1, 1, 1)\), which gives \(\sqrt{3}\). Examples 3 and 4 give you two more problems of the same kind to try. Work out the differences and the square root yourself.
The worked examples below go through the same pattern from start to finish, so you can compare every step with your own working. Try each problem on paper first, then open the example and check your working one step at a time, so you can see exactly which step went wrong if your answer does not match. Use them to check your answers and to understand why each step works.
See Example 1 Hide Example 1
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the points into the formula.
- Work out the differences.
- Work out the distance.
Formula
Formula: 3D Distance Formula
This formula gives the straight-line distance between two points in space. Subtract each pair of coordinates, square, add, then take the square root.
Step 1
Step 1 - Set up the problem.
In this problem: We are finding the distance between \(P_{1} = \left(1,\; 2,\; 3\right)\) and \(P_{2} = \left(4,\; 6,\; 3\right)\).
Step 2
Step 2 - Write the formula.
In this problem: The distance between two points is the length of the straight line joining them. It comes from Pythagoras' theorem in three dimensions, using the change in each coordinate.
Step 3
Step 3 - Substitute the points into the formula.
In this problem: Replacing the coordinates in \(d = \sqrt{\left(x_{2} - x_{1}\right)^{2} + \left(y_{2} - y_{1}\right)^{2} + \left(z_{2} - z_{1}\right)^{2}}\) gives \(d = \sqrt{\left(4 - 1\right)^{2} + \left(6 - 2\right)^{2} + \left(3 - 3\right)^{2}}\).
Step 4
Step 4 - Work out the differences.
In this problem: Subtracting the matching coordinates gives \(4 - 1 = 3\), \(6 - 2 = 4\) and \(3 - 3 = 0\).
Step 5
Step 5 - Work out the distance.
In this problem: Squaring the differences gives \(3^{2} = 9\), \(4^{2} = 16\) and \(0^{2} = 0\). Adding the squares gives \(9 + 16 + 0 = 25\), and taking the square root gives \(\sqrt{25} = 5\).
Final Answer
See Example 2 Hide Example 2
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the points into the formula.
- Work out the differences.
- Work out the distance.
Formula
Formula: 3D Distance Formula
This formula gives the straight-line distance between two points in space. Subtract each pair of coordinates, square, add, then take the square root.
Step 1
Step 1 - Set up the problem.
In this problem: We are finding the distance between \(P_{1} = \left(0,\; 0,\; 0\right)\) and \(P_{2} = \left(1,\; 1,\; 1\right)\).
Step 2
Step 2 - Write the formula.
In this problem: The distance between two points is the length of the straight line joining them. It comes from Pythagoras' theorem in three dimensions, using the change in each coordinate.
Step 3
Step 3 - Substitute the points into the formula.
In this problem: Replacing the coordinates in \(d = \sqrt{\left(x_{2} - x_{1}\right)^{2} + \left(y_{2} - y_{1}\right)^{2} + \left(z_{2} - z_{1}\right)^{2}}\) gives \(d = \sqrt{\left(1 - 0\right)^{2} + \left(1 - 0\right)^{2} + \left(1 - 0\right)^{2}}\).
Step 4
Step 4 - Work out the differences.
In this problem: Subtracting the matching coordinates gives \(1 - 0 = 1\), \(1 - 0 = 1\) and \(1 - 0 = 1\).
Step 5
Step 5 - Work out the distance.
In this problem: Squaring the differences gives \(1^{2} = 1\), \(1^{2} = 1\) and \(1^{2} = 1\). Adding the squares gives \(1 + 1 + 1 = 3\), and taking the square root gives \(\sqrt{3} \approx 1.73\).
Final Answer
See Example 3 Hide Example 3
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the points into the formula.
- Work out the differences.
- Work out the distance.
Formula
Formula: 3D Distance Formula
This formula gives the straight-line distance between two points in space. Subtract each pair of coordinates, square, add, then take the square root.
Step 1
Step 1 - Set up the problem.
In this problem: We are finding the distance between \(P_{1} = \left(2,\; -1,\; 4\right)\) and \(P_{2} = \left(4,\; 1,\; 5\right)\).
Step 2
Step 2 - Write the formula.
In this problem: The distance between two points is the length of the straight line joining them. It comes from Pythagoras' theorem in three dimensions, using the change in each coordinate.
Step 3
Step 3 - Substitute the points into the formula.
In this problem: Replacing the coordinates in \(d = \sqrt{\left(x_{2} - x_{1}\right)^{2} + \left(y_{2} - y_{1}\right)^{2} + \left(z_{2} - z_{1}\right)^{2}}\) gives \(d = \sqrt{\left(4 - 2\right)^{2} + \left(1 - \left(-1\right)\right)^{2} + \left(5 - 4\right)^{2}}\).
Step 4
Step 4 - Work out the differences.
In this problem: Subtracting the matching coordinates gives \(4 - 2 = 2\), \(1 - \left(-1\right) = 2\) and \(5 - 4 = 1\).
Step 5
Step 5 - Work out the distance.
In this problem: Squaring the differences gives \(2^{2} = 4\), \(2^{2} = 4\) and \(1^{2} = 1\). Adding the squares gives \(4 + 4 + 1 = 9\), and taking the square root gives \(\sqrt{9} = 3\).
Final Answer
See Example 4 Hide Example 4
Problem
Approach
Step-by-step method
- Set up the problem.
- Write the formula.
- Substitute the points into the formula.
- Work out the differences.
- Work out the distance.
Formula
Formula: 3D Distance Formula
This formula gives the straight-line distance between two points in space. Subtract each pair of coordinates, square, add, then take the square root.
Step 1
Step 1 - Set up the problem.
In this problem: We are finding the distance between \(P_{1} = \left(-3,\; 2,\; 0\right)\) and \(P_{2} = \left(3,\; -1,\; 2\right)\).
Step 2
Step 2 - Write the formula.
In this problem: The distance between two points is the length of the straight line joining them. It comes from Pythagoras' theorem in three dimensions, using the change in each coordinate.
Step 3
Step 3 - Substitute the points into the formula.
In this problem: Replacing the coordinates in \(d = \sqrt{\left(x_{2} - x_{1}\right)^{2} + \left(y_{2} - y_{1}\right)^{2} + \left(z_{2} - z_{1}\right)^{2}}\) gives \(d = \sqrt{\left(3 - \left(-3\right)\right)^{2} + \left(-1 - 2\right)^{2} + \left(2 - 0\right)^{2}}\).
Step 4
Step 4 - Work out the differences.
In this problem: Subtracting the matching coordinates gives \(3 - \left(-3\right) = 6\), \(-1 - 2 = -3\) and \(2 - 0 = 2\).
Step 5
Step 5 - Work out the distance.
In this problem: Squaring the differences gives \(6^{2} = 36\), \(\left(-3\right)^{2} = 9\) and \(2^{2} = 4\). Adding the squares gives \(36 + 9 + 4 = 49\), and taking the square root gives \(\sqrt{49} = 7\).
Final Answer
Calculator and Practice Mode
Want to check your own working? The 3D Distance Calculator solves any problem you type in and shows every step, so you can compare it line by line with your answer and find exactly where a mistake crept in. When you are ready to test yourself, 3D Distance Practice gives you a new problem at Easy, Medium or Hard level, checks your answer and shows the full working whenever you get one wrong. Practice Mode for this calculator is available on the Pro plan.