Distance Formula
The distance formula finds the length of the segment between two points on a coordinate plane. For (x_1, y_1) and (x_2, y_2), the distance is d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}. Subtract, square, add, then take the square root.
Before this lesson: You should know the Midpoint Formula, the Coordinate Plane and Simplifying Square Roots.
Where the Distance Formula Comes From
Pick two points that are not on the same row or column. Draw a horizontal leg and a vertical leg between them. Now the segment is the long side of a right triangle.
The horizontal leg is x_2 - x_1 units long. The vertical leg is y_2 - y_1 units long. The Pythagorean theorem says a^2 + b^2 = c^2 for a right triangle. So the segment’s length squared is the sum of the legs squared.
Take the square root of both sides, and you get the distance formula. A distance is never negative, so we only use the positive square root.
The Distance Formula
d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}Squaring makes each difference positive. So it doesn’t matter which point you call the first one.
Steps to use the distance formula
- Label the points (x_1, y_1) and (x_2, y_2).
- Subtract the x-coordinates. Subtract the y-coordinates.
- Square each difference.
- Add the squares.
- Take the square root. Simplify the radical if it is not a whole number.
Worked Examples
Example 1: A whole-number distance
Find the distance between A(1, 2) and B(4, 6).
Step 1: Subtract the x-coordinates.
4 - 1 = 3
Step 2: Subtract the y-coordinates.
6 - 2 = 4
Step 3: Put the differences in the formula.
d = \sqrt{3^2 + 4^2}Step 4: Square each difference.
d = \sqrt{9 + 16}Step 5: Add.
d = \sqrt{25}Step 6: Take the square root.
d = 5
The distance is 5 units. The graph above shows this triangle.
Example 2: Negative coordinates
Find the distance between P(-2, 3) and Q(4, -5).
Step 1: Subtract the x-coordinates. Subtracting a negative means adding (see adding and subtracting integers).
4 - (-2) = 6
Step 2: Subtract the y-coordinates.
-5 - 3 = -8
Step 3: Put the differences in the formula.
d = \sqrt{6^2 + (-8)^2}Step 4: Square each difference. A negative number squared is positive.
d = \sqrt{36 + 64}Step 5: Add.
d = \sqrt{100}Step 6: Take the square root.
d = 10
The distance is 10 units.
Example 3: Simplify the radical
Find the distance between C(-1, -4) and D(3, 2). Give the exact answer.
Step 1: Subtract the x-coordinates.
3 - (-1) = 4
Step 2: Subtract the y-coordinates.
2 - (-4) = 6
Step 3: Put the differences in the formula.
d = \sqrt{4^2 + 6^2}Step 4: Square each difference.
d = \sqrt{16 + 36}Step 5: Add.
d = \sqrt{52}Step 6: 52 is not a perfect square. Find its largest perfect square factor (see simplifying square roots).
d = \sqrt{4 \cdot 13}Step 7: Take the square root of 4.
d = 2\sqrt{13}The exact distance is 2\sqrt{13} units, or about 7.2 units.
Example 4: Classify a triangle by its sides
A triangle has corners A(1, 1), B(4, 5) and C(8, 2). Is it isosceles? (An isosceles triangle has at least two sides of equal length.)
Step 1: Find AB. The differences are 4 - 1 = 3 and 5 - 1 = 4.
AB = \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5Step 2: Find BC. The differences are 8 - 4 = 4 and 2 - 5 = -3.
BC = \sqrt{4^2 + (-3)^2} = \sqrt{16 + 9} = \sqrt{25} = 5Step 3: Find AC. The differences are 8 - 1 = 7 and 2 - 1 = 1.
AC = \sqrt{7^2 + 1^2} = \sqrt{49 + 1} = \sqrt{50}Step 4: Simplify \sqrt{50}.
AC = \sqrt{25 \cdot 2} = 5\sqrt{2}Step 5: Compare the sides.
AB = BC = 5
Two sides are equal, so the triangle is isosceles. \overline{AB} \cong \overline{BC}.
Example 5: Word problem
A drone starts at (2, -1) on a field map. It flies in a straight line to (14, 4). Each unit on the map is 1 kilometer. How far does it fly?
Step 1: Subtract the x-coordinates.
14 - 2 = 12
Step 2: Subtract the y-coordinates.
4 - (-1) = 5
Step 3: Put the differences in the formula.
d = \sqrt{12^2 + 5^2}Step 4: Square each difference.
d = \sqrt{144 + 25}Step 5: Add.
d = \sqrt{169}Step 6: Take the square root.
d = 13
The drone flies 13 kilometers.
Common Mistakes
| Mistake | Example of the error | Fix |
|---|---|---|
| Adding the coordinates | Using 1 + 4 for A(1, 2) and B(4, 6) | Subtract the coordinates: 4 - 1 = 3. Adding is for the midpoint. |
| Mixing x and y | Using x_2 - y_1 | Subtract x from x and y from y. |
| Sign errors with negatives | Writing 4 - (-2) = 2 | Subtracting a negative means adding: 4 + 2 = 6. |
| Taking the root of each part | Writing \sqrt{9 + 16} = 3 + 4 = 7 | Add first: \sqrt{25} = 5. The root of a sum is not the sum of the roots. |
| Squaring a negative wrong | Writing (-8)^2 = -64 | (-8)^2 = 64. A square is never negative. |
| Not simplifying the radical | Leaving \sqrt{52} | Factor out the perfect square: \sqrt{52} = 2\sqrt{13}. |
Horizontal, Vertical and Number Line Distances
When two points are on the same horizontal line, the y-coordinates match. Then the distance is just the difference of the x-coordinates. For (-3, 2) and (5, 2), the distance is |5 - (-3)| = 8.
When two points are on the same vertical line, use the y-coordinates. For (1, -4) and (1, 6), the distance is |6 - (-4)| = 10.
On a number line, the distance is |a - b|, as in the segment addition postulate. The distance formula gives the same answers, because one of the squares is 0.
| Formula | What it finds | Operation |
|---|---|---|
| Midpoint formula | The point halfway between | Add, then divide by 2 |
| Slope formula | How steep the segment is | Subtract, then divide |
| Distance formula | How long the segment is | Subtract, square, add, square root |
Practice Problems
- Find the distance between (0, 0) and (6, 8).
- Find the distance between (2, 3) and (5, 7).
- Find the distance between (-4, 1) and (2, 9).
- Find the distance between (3, -2) and (3, 7).
- Find the distance between (-5, -1) and (7, 4).
- Find the exact distance between (1, 2) and (4, 5).
- Find the exact distance between (-2, -3) and (2, 5).
- Find the exact distance between (-1, 4) and (5, 1).
- A triangle has corners P(0, 0), Q(4, 0) and R(2, 5). Is it isosceles?
- Two hikers are at (-3, -2) and (5, 13) on a trail map. Each unit is 1 kilometer. How far apart are they in a straight line?
Show answers
- Subtract the x-coordinates: 6 - 0 = 6. Subtract the y-coordinates: 8 - 0 = 8. Square each difference: 6^2 + 8^2 = 36 + 64. Add: 36 + 64 = 100. Take the square root: \sqrt{100} = 10. The distance is 10.
- Subtract the x-coordinates: 5 - 2 = 3. Subtract the y-coordinates: 7 - 3 = 4. Square each difference: 3^2 + 4^2 = 9 + 16. Add: 9 + 16 = 25. Take the square root: \sqrt{25} = 5. The distance is 5.
- Subtract the x-coordinates: 2 - (-4) = 6. Subtract the y-coordinates: 9 - 1 = 8. Square each difference: 6^2 + 8^2 = 36 + 64. Add: 36 + 64 = 100. Take the square root: \sqrt{100} = 10. The distance is 10.
- The x-coordinates match, so the points are on a vertical line. Subtract the y-coordinates: 7 - (-2) = 9. The distance is 9. (The formula gives \sqrt{0^2 + 9^2} = \sqrt{81} = 9.)
- Subtract the x-coordinates: 7 - (-5) = 12. Subtract the y-coordinates: 4 - (-1) = 5. Square each difference: 12^2 + 5^2 = 144 + 25. Add: 144 + 25 = 169. Take the square root: \sqrt{169} = 13. The distance is 13.
- Subtract the x-coordinates: 4 - 1 = 3. Subtract the y-coordinates: 5 - 2 = 3. Square each difference: 3^2 + 3^2 = 9 + 9. Add: 9 + 9 = 18. Take the square root: \sqrt{18}. Simplify: \sqrt{9 \cdot 2} = 3\sqrt{2}. The distance is 3\sqrt{2}.
- Subtract the x-coordinates: 2 - (-2) = 4. Subtract the y-coordinates: 5 - (-3) = 8. Square each difference: 4^2 + 8^2 = 16 + 64. Add: 16 + 64 = 80. Take the square root: \sqrt{80}. Simplify: \sqrt{16 \cdot 5} = 4\sqrt{5}. The distance is 4\sqrt{5}.
- Subtract the x-coordinates: 5 - (-1) = 6. Subtract the y-coordinates: 1 - 4 = -3. Square each difference: 6^2 + (-3)^2 = 36 + 9. Add: 36 + 9 = 45. Take the square root: \sqrt{45}. Simplify: \sqrt{9 \cdot 5} = 3\sqrt{5}. The distance is 3\sqrt{5}.
- Find PQ. The points are on the x-axis: PQ = 4 - 0 = 4. Find PR: PR = \sqrt{(2 - 0)^2 + (5 - 0)^2} = \sqrt{4 + 25} = \sqrt{29}. Find QR: QR = \sqrt{(2 - 4)^2 + (5 - 0)^2} = \sqrt{4 + 25} = \sqrt{29}. Compare: PR = QR. Yes. Two sides are \sqrt{29}, so the triangle is isosceles.
- Subtract the x-coordinates: 5 - (-3) = 8. Subtract the y-coordinates: 13 - (-2) = 15. Square each difference: 8^2 + 15^2 = 64 + 225. Add: 64 + 225 = 289. Take the square root: \sqrt{289} = 17. The hikers are 17 kilometers apart.
FAQ
What is the distance formula?
d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}. It gives the length of the segment between two points.
Is the distance formula the same as the Pythagorean theorem?
Yes, in a way. The two differences are the legs of a right triangle, and the distance is the long side. The formula is the Pythagorean theorem written with coordinates.
Does the order of the points matter?
No. Each difference gets squared, and a number and its opposite have the same square.
Can the distance be negative?
No. A distance is a length, so it is always 0 or more. That is why we take only the positive square root.
Summary
- Distance formula: d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}.
- Subtract, square, add, then take the square root.
- The formula comes from a right triangle whose legs are the x and y differences.
- Simplify radicals for exact answers, like \sqrt{52} = 2\sqrt{13}.
- For points on a horizontal or vertical line, just subtract the coordinates that change.
Previous lesson: Midpoint Formula
Next lesson: Partitioning a Line Segment
Back to the Geometry Index
