The Distance Formula

Learn how to calculate the distance between two points on a coordinate plane using the distance formula.

Intermediate25 minLesson

Definition

The distance formula calculates the distance between two points on a coordinate plane.
For two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2), the distance dd is:
d=(x2−x1)2+(y2−y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}
This formula comes from the Pythagorean theorem. When you draw a right triangle between two points:
  • The horizontal distance is ∣x2−x1∣|x_2 - x_1|
  • The vertical distance is ∣y2−y1∣|y_2 - y_1|
  • The actual distance is the hypotenuse

Try it now

What is the distance formula used to find?

Worked Examples

Find the distance between (2,3)(2, 3) and (6,6)(6, 6).

1

Identify coordinates

(x1,y1)=(2,3)(x_1, y_1) = (2, 3) and (x2,y2)=(6,6)(x_2, y_2) = (6, 6) → Points identified

2

Find horizontal distance

x2−x1=6−2=4x_2 - x_1 = 6 - 2 = 4 → Horizontal: 44

3

Find vertical distance

y2−y1=6−3=3y_2 - y_1 = 6 - 3 = 3 → Vertical: 33

4

Apply the formula

d=42+32=16+9=25d = \sqrt{4^2 + 3^2} = \sqrt{16 + 9} = \sqrt{25} → d=5d = 5

Common Mistakes

Forgetting to square the differences before adding

Why it's wrong: Students sometimes write (x2−x1)+(y2−y1)\sqrt{(x_2-x_1) + (y_2-y_1)} instead of (x2−x1)2+(y2−y1)2\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}

Correct: Always square each difference: d=(Δx)2+(Δy)2d = \sqrt{(\Delta x)^2 + (\Delta y)^2}

Taking the square root of each term separately

Why it's wrong: a2+b2≠a2+b2\sqrt{a^2 + b^2} \neq \sqrt{a^2} + \sqrt{b^2}. The square root applies to the entire sum.

Correct: Add the squared terms first, then take one square root of the total.

Getting confused with negative coordinates

Why it's wrong: Subtracting a negative number means adding: 3−(−2)=3+2=53 - (-2) = 3 + 2 = 5

Correct: Be careful with signs. Squaring will always give a positive result anyway.

Interactive Visual

Linear Function Explorer

y = x
Slope (m)1
Y-Intercept (b)0
b
run
rise

Interactive Sandbox

Expression Calculator

Try these:

History

No calculations yet

Practice Problems

16 problems
Problem 1 of 16
Easy

What is the distance formula used to find?

Why It Matters

The distance formula has countless real-world applications:
  • Navigation: GPS systems calculate distances between locations using coordinates
  • Gaming: Video games use this formula to detect collisions and calculate movement
  • Architecture: Designers measure distances on blueprints using coordinate systems
  • Sports: Analysts calculate how far athletes run or throw using positional data
Mastering the distance formula prepares you for more advanced topics like circles, parabolas, and 3D geometry.

Real World Applications

GPS Navigation

GPS devices use coordinate systems to calculate distances between locations. While Earth's coordinates are more complex (latitude/longitude on a sphere), the fundamental principle is the same.

Example:

A GPS calculates you are at coordinates (3,7)(3, 7) km and your destination is at (9,15)(9, 15) km. The straight-line distance is (9−3)2+(15−7)2=36+64=10\sqrt{(9-3)^2 + (15-7)^2} = \sqrt{36 + 64} = 10 km.

1Try It Yourself

You are at map coordinates (2,5)(2, 5) km. A restaurant is at (8,13)(8, 13) km.

How far is the restaurant in a straight line?

Step 1: Write the mathematical expression

Use the distance formula:

Video Game Design

Game developers use the distance formula constantly to calculate collision detection, enemy AI range, and movement physics.

Example:

In a game, your character is at (50,30)(50, 30) pixels and an enemy is at (80,70)(80, 70). The distance is (80−50)2+(70−30)2=900+1600=50\sqrt{(80-50)^2 + (70-30)^2} = \sqrt{900 + 1600} = 50 pixels.

2Try It Yourself

A player at (10,20)(10, 20) has a weapon with range 1313 pixels. An enemy appears at (22,25)(22, 25).

Can the player hit the enemy?

Step 1: Write the mathematical expression

Calculate the distance and compare to 13:

Key Takeaways

  • 1The distance formula is d=(x2−x1)2+(y2−y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}
  • 2It comes from the Pythagorean theorem applied to a right triangle
  • 3Always square the differences first, then add, then take the square root
  • 4Negative coordinates work the same way since squaring eliminates negatives
  • 5The result may be a whole number or an irrational number (square root)

Frequently Asked Questions

No! Since we square the differences, the order does not matter. (5−2)2=9(5-2)^2 = 9 and (2−5)2=9(2-5)^2 = 9 give the same result.
No! Since we square the differences, the order does not matter. (5−2)2=9(5-2)^2 = 9 and (2−5)2=9(2-5)^2 = 9 give the same result.
Squaring converts negative differences to positive values and sets up the Pythagorean theorem calculation. The square root then gives us the actual distance (the hypotenuse length).
That is perfectly fine! Exact answers like 34\sqrt{34} are often preferred. You can also give a decimal approximation if needed.

Glossary

Distance formula
The formula d=(x2−x1)2+(y2−y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} used to find the distance between two points
Coordinate plane
A two-dimensional plane with horizontal (xx) and vertical (yy) axes
Pythagorean theorem
For a right triangle with legs aa and bb and hypotenuse cc: a2+b2=c2a^2 + b^2 = c^2
Hypotenuse
The longest side of a right triangle, opposite the right angle

More in This Topic