Skip to content

Distance Formula

Distance between two points in the plane.

Variables

d
Distance
(x₁, y₁), (x₂, y₂)
The two points

Explanation

This is the Pythagorean theorem applied to the right triangle formed by the horizontal and vertical differences.

Example

From to : .

How to use it

  1. Label the points and . The order doesn't matter, because the differences are squared.
  2. Find the horizontal change and the vertical change .
  3. Square both, add them, and take the square root.

Another worked example

Find the distance from to .

Notice the 5, 12, 13 right triangle hiding inside the problem. Recognising Pythagorean triples like 3-4-5, 5-12-13 and 8-15-17 saves time.

Where it comes from

Draw a horizontal segment from the first point and a vertical segment up or down to the second. They meet at a right angle, so the straight-line distance is the hypotenuse of a right triangle with legs and . Apply and solve for .

In three dimensions

Add a third squared difference: . From to the distance is .

Common mistakes

  • Forgetting that subtracting a negative adds: .
  • Writing . The square root does not split over addition.
  • Mixing an x-value with a y-value when subtracting.

Where you'll use it

Checking whether a triangle is isosceles, finding the radius of a circle from its centre and a point on it, and measuring map distances on a grid all use this formula.

Where it's used

  • Maps and games: finding how far apart two locations or characters are on a grid.
  • Geometry proofs: showing that sides are equal, so a shape is a rhombus, square or isosceles triangle.
  • Circles: finding a radius from the centre and a point on the circle.
  • Data science: the "nearest neighbour" method compares data points by this distance.

Key takeaways

  • Square the horizontal and vertical changes, add, then take the square root.
  • It is the Pythagorean theorem on a coordinate grid.
  • Add a z-term for three dimensions.

Try it: Slope Calculator

Find the slope, equation of the line, distance and midpoint between two points.

Open calculator

Practice problems

Try each one first, then open the answer to check your work.

  1. 1.Find the distance from to .

    Show answer

    10.

  2. 2.Find the distance from to .

    Show answer

    .

  3. 3.Find the distance from to .

    Show answer

    5.

  4. 4.Find the distance from to , then from to . What kind of triangle do these points make with and ?

    Show answer

    Both distances are 5, so the triangle is isosceles.

  5. 5.Find the distance from to .

    Show answer

    .

Key terms

Coordinate plane
The grid formed by the x-axis and y-axis.
Ordered pair
A point written as .
Hypotenuse
The longest side of a right triangle, here the straight-line distance.
Pythagorean triple
Whole numbers with .
Euclidean distance
The ordinary straight-line distance this formula gives.

Frequently asked questions

Does the order of the points matter?

No. The differences are squared, so and are equal.

Can a distance be negative?

No. It's a square root of a sum of squares, so it's always zero or positive. It's zero only when the two points are the same.

How do I leave the answer exact?

Simplify the square root. . Give a decimal only if the question asks for one.

What about distance on a map with latitude and longitude?

For short distances the formula works well after converting degrees to kilometres. Over long distances the Earth's curve matters, so navigators use the haversine formula.

What is the distance from a point to a line?

For the line and point , it's , the length of the perpendicular.

What is taxicab distance?

, the distance when you can only move along grid lines, like driving city blocks.

Related formulas

More geometry formulas