Mathwords logoMathwords

Distance — Definition, Formula & Examples

Distance is the length of the straight line segment between two points. On a coordinate plane, you can calculate it using the coordinates of those points.

Given two points P1(x1,y1)P_1(x_1, y_1) and P2(x2,y2)P_2(x_2, y_2) in the Cartesian plane, the distance dd between them is defined as the non-negative value d=(x2x1)2+(y2y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}, derived from the Pythagorean theorem.

Key Formula

d=(x2x1)2+(y2y1)2d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}
Where:
  • dd = Distance between the two points
  • (x1,y1)(x_1, y_1) = Coordinates of the first point
  • (x2,y2)(x_2, y_2) = Coordinates of the second point

How It Works

Picture the two points on a coordinate grid. Draw a horizontal segment from one point and a vertical segment from the other so they form a right triangle. The horizontal leg has length x2x1|x_2 - x_1| and the vertical leg has length y2y1|y_2 - y_1|. The distance between the two points is the hypotenuse of that right triangle, which you find using the Pythagorean theorem.

Worked Example

Problem: Find the distance between the points (1, 2) and (4, 6).
Subtract the coordinates: Find the differences in the x-values and y-values.
x2x1=41=3,y2y1=62=4x_2 - x_1 = 4 - 1 = 3, \quad y_2 - y_1 = 6 - 2 = 4
Square and add: Square each difference and add the results.
32+42=9+16=253^2 + 4^2 = 9 + 16 = 25
Take the square root: The distance is the square root of the sum.
d=25=5d = \sqrt{25} = 5
Answer: The distance between (1, 2) and (4, 6) is 5 units.

Why It Matters

The distance formula shows up constantly in geometry, physics, and computer science. Anytime you need to know how far apart two locations are — whether plotting a map route or detecting collisions in a video game — you're using this formula.

Common Mistakes

Mistake: Forgetting to square the differences before adding them.
Correction: Always square each difference first: (x2x1)2(x_2 - x_1)^2 and (y2y1)2(y_2 - y_1)^2. Adding the raw differences and then squaring gives the wrong answer.