Geometry

How to find the distance between two points

The distance between two points on a coordinate plane is calculated with the distance formula: d = √((x2 - x1)² + (y2 - y1)². It gives the exact straight-line length between point (x1, y1) and point (x2, y2).

Formula

d=\sqrt{\left(- x_{1} + x_{2}\right)^{2} + \left(- y_{1} + y_{2}\right)^{2}}

d is the distance, (x1, y1) are the coordinates of the first point, and (x2, y2) are the coordinates of the second point.

How the Distance Formula Works

To find the distance between two coordinate points, start by subtracting the x-coordinates to get the horizontal distance, and subtracting the y-coordinates to get the vertical distance.

Next, square both differences so that all values become positive. Add those two squared values together, then take the square root of the total sum to find the straight-line distance.

For example, to find the distance between (-2, 1) and (1, 5), compute the horizontal change as 1 - (-2) = 3 and the vertical change as 5 - 1 = 4. Square both values to get 9 and 16, add them to get 25, and take the square root: d = √(25) = 5.

Where You Use It in School and Real Life

In algebra and high school geometry, you use the distance formula to find side lengths of shapes on a grid, verify whether triangles are right-angled, and find circle radii from the center to a point on the circumference.

In real-world applications, software developers and game designers use coordinate distance to detect collisions between characters and objects. GPS navigation systems use similar coordinate principles to calculate the straight-line separation between geographic locations.

Common Mistakes to Avoid

The most common mistake is mixing x and y coordinates together. Always subtract x1 from x2 and y1 from y2. Never subtract a y-value from an x-value.

Watch your negative signs carefully. If a coordinate is negative, subtracting it creates an addition step. For instance, 1 - (-2) becomes 1 + 2 = 3, not -1.

Another frequent error is forgetting the final square root. Squaring and adding gives d²; you must take the square root of that sum to get the actual distance d.

Quick Mental Checks and Shortcuts

Look for common Pythagorean triples such as 3-4-5, 5-12-13, and 8-15-17. If your horizontal and vertical differences match these pairs, you can write the distance immediately without lengthy calculations.

You can also check your answer using triangle inequalities: your final distance must always be longer than either individual horizontal or vertical difference, but it must be less than their sum.

Worked examples

Example 1Subtract matching coordinates of the endpoints. x_{1}=-2,\;y_{1}=1,\;x_{2}=1,\;y_{2}=5. Find d.

  1. Write the relationship for the requested quantity.

    d=\sqrt{\left(- x_{1} + x_{2}\right)^{2} + \left(- y_{1} + y_{2}\right)^{2}}
  2. Substitute each value, keeping its sign.

    \sqrt{\left(\left(\left(1-\left(-2\right)\right)\right)^{2}+\left(\left(5-1\right)\right)^{2}\right)}
  3. Simplify the expression to obtain the exact result.

    5
Answer5Verified by computation

Example 2Subtract matching coordinates of the endpoints. x_{1}=4,\;y_{1}=-3,\;x_{2}=-1,\;y_{2}=9. Find d.

  1. Write the relationship for the requested quantity.

    d=\sqrt{\left(- x_{1} + x_{2}\right)^{2} + \left(- y_{1} + y_{2}\right)^{2}}
  2. Substitute each value, keeping its sign.

    \sqrt{\left(\left(\left(\left(-1\right)-4\right)\right)^{2}+\left(\left(9-\left(-3\right)\right)\right)^{2}\right)}
  3. Simplify the expression to obtain the exact result.

    13
Answer13Verified by computation

Example 3Subtract matching coordinates of the endpoints. x_{1}=1,\;y_{1}=2,\;x_{2}=5,\;y_{2}=6. Find d.

  1. Write the relationship for the requested quantity.

    d=\sqrt{\left(- x_{1} + x_{2}\right)^{2} + \left(- y_{1} + y_{2}\right)^{2}}
  2. Substitute each value, keeping its sign.

    \sqrt{\left(\left(\left(5-1\right)\right)^{2}+\left(\left(6-2\right)\right)^{2}\right)}
  3. Simplify the expression to obtain the exact result.

    4 \sqrt{2}
Answer4 \sqrt{2}Verified by computation

Questions and answers

Can the distance between two points be negative?

No, distance is always zero or positive. Because the coordinate differences are squared before taking the square root, the result is always a non-negative value.

Does it matter which point is (x1, y1) and which is (x2, y2)?

No, the order does not matter. Squaring the difference gives the exact same positive result whether you calculate (x2 - x1)² or (x1 - x2)².

How is this formula related to the Pythagorean theorem?

The distance formula is the Pythagorean theorem (a² + b² = c² applied to coordinates. The horizontal change is side a, the vertical change is side b, and the distance is hypotenuse c.

What if both points have the same x or y coordinate?

If the x-coordinates are identical, the distance is simply the absolute difference between the y-coordinates. If the y-coordinates are identical, the distance is the absolute difference between the x-coordinates.

Solve your own problem

Different numbers or a harder variant? Type it in and get the steps.

Enter solves, Shift+Enter adds a line