Chuyển tới nội dung chính

Distance Formula -- How to Find Distance Between Two Points

Grade: 8-9 | Topic: Geometry

What You Will Learn

After this lesson you will be able to find the distance between any two points on a coordinate plane using the distance formula. You will understand where the formula comes from (it is the Pythagorean theorem in disguise), handle negative coordinates confidently, and apply the formula to both pure math and real-world problems.

Theory

Deriving the formula from the Pythagorean theorem

Take two points on a coordinate plane: A(x1,y1)A(x_1, y_1) and B(x2,y2)B(x_2, y_2). Draw a horizontal line from AA and a vertical line from BB (or vice versa). These two lines meet at a third point C(x2,y1)C(x_2, y_1), forming a right triangle ABCABC.

The lengths of the legs are:

  • Horizontal leg: x2x1|x_2 - x_1|
  • Vertical leg: y2y1|y_2 - y_1|

The distance dd from AA to BB is the hypotenuse. By the Pythagorean theorem:

d2=(x2x1)2+(y2y1)2d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2

Take the square root of both sides:

d=(x2x1)2+(y2y1)2\boxed{d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}}

This is the distance formula. Because the differences are squared, it does not matter whether you compute x2x1x_2 - x_1 or x1x2x_1 - x_2 -- the result is the same.

When coordinates are negative

Negative signs can look scary, but the squaring takes care of them. For example, if x1=3x_1 = -3 and x2=4x_2 = 4:

x2x1=4(3)=4+3=7x_2 - x_1 = 4 - (-3) = 4 + 3 = 7

The square of 7 is 49, exactly the same as the square of 7-7. So negative coordinates work perfectly in the formula -- just be careful with the subtraction.

Special cases

Horizontal segment (same yy-values): The vertical difference is 0, so: d=(x2x1)2+02=x2x1d = \sqrt{(x_2 - x_1)^2 + 0^2} = |x_2 - x_1|

Vertical segment (same xx-values): The horizontal difference is 0, so: d=y2y1d = |y_2 - y_1|

These are just common-sense results, but it is reassuring that the formula gives the correct answer in simple cases.

Worked Examples

Example 1: Both coordinates positive (easy)

Problem: Find the distance between A(1,2)A(1, 2) and B(4,6)B(4, 6).

Step 1: Identify the coordinates. x1=1,  y1=2,  x2=4,  y2=6x_1 = 1, \; y_1 = 2, \; x_2 = 4, \; y_2 = 6

Step 2: Substitute into the formula. d=(41)2+(62)2=32+42d = \sqrt{(4 - 1)^2 + (6 - 2)^2} = \sqrt{3^2 + 4^2}

Step 3: Simplify. d=9+16=25=5d = \sqrt{9 + 16} = \sqrt{25} = 5

Answer: The distance is 5 units.

Example 2: One point at the origin (easy)

Problem: Find the distance from the origin O(0,0)O(0, 0) to the point P(5,12)P(5, 12).

Step 1: Substitute. d=(50)2+(120)2=52+122d = \sqrt{(5 - 0)^2 + (12 - 0)^2} = \sqrt{5^2 + 12^2}

Step 2: Simplify. d=25+144=169=13d = \sqrt{25 + 144} = \sqrt{169} = 13

Answer: The distance is 13 units. (This is the 5-12-13 Pythagorean triple.)

Example 3: Negative coordinates (medium)

Problem: Find the distance between P(3,4)P(-3, 4) and Q(2,8)Q(2, -8).

Step 1: Identify the coordinates. x1=3,  y1=4,  x2=2,  y2=8x_1 = -3, \; y_1 = 4, \; x_2 = 2, \; y_2 = -8

Step 2: Compute the differences carefully. x2x1=2(3)=5x_2 - x_1 = 2 - (-3) = 5 y2y1=84=12y_2 - y_1 = -8 - 4 = -12

Step 3: Substitute and simplify. d=52+(12)2=25+144=169=13d = \sqrt{5^2 + (-12)^2} = \sqrt{25 + 144} = \sqrt{169} = 13

Answer: The distance is 13 units.

Example 4: Irrational result with simplification (medium)

Problem: Find the distance between A(1,3)A(-1, 3) and B(3,7)B(3, 7).

Step 1: Compute differences. x2x1=3(1)=4x_2 - x_1 = 3 - (-1) = 4 y2y1=73=4y_2 - y_1 = 7 - 3 = 4

Step 2: Substitute. d=42+42=16+16=32d = \sqrt{4^2 + 4^2} = \sqrt{16 + 16} = \sqrt{32}

Step 3: Simplify the radical. 32=16×2=425.66\sqrt{32} = \sqrt{16 \times 2} = 4\sqrt{2} \approx 5.66

Answer: The distance is 424\sqrt{2} \approx 5.66 units.

Example 5: Real-world application -- map distance (challenging)

Problem: On a city grid, a pizza shop is at coordinates (2,3)(2, 3) and a customer's house is at (8,11)(8, 11). Each grid unit represents 0.25 km. What is the straight-line delivery distance?

Step 1: Find the distance in grid units. d=(82)2+(113)2=62+82=36+64=100=10 unitsd = \sqrt{(8 - 2)^2 + (11 - 3)^2} = \sqrt{6^2 + 8^2} = \sqrt{36 + 64} = \sqrt{100} = 10 \text{ units}

Step 2: Convert to kilometres. 10 units×0.25 km/unit=2.5 km10 \text{ units} \times 0.25 \text{ km/unit} = 2.5 \text{ km}

Answer: The straight-line delivery distance is 2.5 km.

Common Mistakes

Mistake 1: Forgetting to square the differences before adding

d=(41)+(62)=3+4=7d = \sqrt{(4 - 1) + (6 - 2)} = \sqrt{3 + 4} = \sqrt{7}

d=(41)2+(62)2=9+16=25=5d = \sqrt{(4 - 1)^2 + (6 - 2)^2} = \sqrt{9 + 16} = \sqrt{25} = 5

Why this matters: Without squaring, you are just adding the horizontal and vertical distances (which gives the "Manhattan distance," not the straight-line distance). The squares are essential because the formula comes from the Pythagorean theorem.

Mistake 2: Subtracting coordinates in the wrong order between x and y

d=(x2x1)2+(x2y1)2d = \sqrt{(x_2 - x_1)^2 + (x_2 - y_1)^2} -- mixing xx and yy values.

d=(x2x1)2+(y2y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} -- keep xx's together and yy's together.

Why this matters: The horizontal distance uses only xx-coordinates and the vertical distance uses only yy-coordinates. Mixing them produces a number that has no geometric meaning.

Mistake 3: Sign errors with negative coordinates

P(3,4)P(-3, 4) and Q(2,8)Q(2, -8): computing x2x1=23=1x_2 - x_1 = 2 - 3 = -1 (dropping the negative sign on x1x_1).

x2x1=2(3)=2+3=5x_2 - x_1 = 2 - (-3) = 2 + 3 = 5.

Why this matters: Subtracting a negative number means adding. This is the most common arithmetic slip when using the distance formula with negative coordinates. Write out the subtraction fully to avoid errors.

Practice Problems

Try these on your own before checking the answers:

  1. Find the distance between (0,0)(0, 0) and (8,6)(8, 6).
  2. Find the distance between (2,5)(-2, 5) and (4,3)(4, -3).
  3. Find the distance between (7,1)(7, 1) and (7,9)(7, 9).
  4. Find the distance between (5,2)(-5, -2) and (3,4)(3, 4). Leave in simplified radical form.
  5. Two cell towers are at grid coordinates (10,15)(10, 15) and (22,20)(22, 20). Each grid unit is 0.5 miles. What is the straight-line distance between the towers?
Click to see answers
  1. d=82+62=64+36=100=10d = \sqrt{8^2 + 6^2} = \sqrt{64 + 36} = \sqrt{100} = 10 units.
  2. d=(4(2))2+(35)2=62+(8)2=36+64=100=10d = \sqrt{(4-(-2))^2 + (-3-5)^2} = \sqrt{6^2 + (-8)^2} = \sqrt{36 + 64} = \sqrt{100} = 10 units.
  3. Same xx-value, so d=91=8d = |9 - 1| = 8 units. (Or use the formula: 02+82=8\sqrt{0^2 + 8^2} = 8.)
  4. d=(3(5))2+(4(2))2=82+62=64+36=100=10d = \sqrt{(3-(-5))^2 + (4-(-2))^2} = \sqrt{8^2 + 6^2} = \sqrt{64 + 36} = \sqrt{100} = 10 units.
  5. d=(2210)2+(2015)2=122+52=144+25=169=13d = \sqrt{(22-10)^2 + (20-15)^2} = \sqrt{12^2 + 5^2} = \sqrt{144 + 25} = \sqrt{169} = 13 units. Convert: 13×0.5=6.513 \times 0.5 = 6.5 miles.

Summary

  • The distance formula is d=(x2x1)2+(y2y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}.
  • It is derived directly from the Pythagorean theorem: the horizontal and vertical differences are the legs, and the distance is the hypotenuse.
  • The order of the two points does not matter -- squaring eliminates sign differences.
  • For horizontal segments (y1=y2y_1 = y_2), the distance simplifies to x2x1|x_2 - x_1|. For vertical segments, it simplifies to y2y1|y_2 - y_1|.
  • Always square the differences before adding them.

Need help with the distance formula?

Take a photo of your math problem and MathPal will solve it step by step.

Open MathPal