How to Use the Distance Formula

How far apart are two points on a coordinate plane? You could plot them on graph paper and measure, but math gives us a precise formula — one that works for any two points, no ruler required.

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

It looks like a lot at first glance. But once you see where it comes from, the formula makes complete sense — and you'll probably never forget it.

Where the Formula Comes From

The distance formula is really the Pythagorean theorem in disguise.

Here's the idea: suppose you want the distance between two points that aren't neatly lined up on the same row or column. Draw a horizontal line from one point and a vertical line from the other, and they'll meet at a corner — forming a right triangle. The direct distance between your two original points is the hypotenuse of that triangle.

right triangle formed between two coordinate points

The horizontal leg has length \(|x_2 - x_1|\) — the change in x. The vertical leg has length \(|y_2 - y_1|\) — the change in y. The Pythagorean theorem says:

$$d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2$$

Take the square root, and you have the distance formula. You're not memorizing something arbitrary — you're applying a theorem you already know, just repackaged for the coordinate plane.

Using the Distance Formula

Example 1

Find the distance between \((5, 5)\) and \((1, 2)\).

distance between the points (5,5) and (1,2)

The change in x is \(5 - 1 = 4\). The change in y is \(5 - 2 = 3\). Plug in:

$$d = \sqrt{4^2 + 3^2} = \sqrt{16 + 9} = \sqrt{25} = 5$$

A clean answer — this happens to be a 3-4-5 right triangle.

Example 2

Find the distance between \((8, -2)\) and \((3, 9)\).

$$d = \sqrt{(8-3)^2 + (-2-9)^2}$$ $$d = \sqrt{5^2 + (-11)^2}$$ $$d = \sqrt{25 + 121}$$ $$d = \sqrt{146} \approx 12.08$$

One thing worth noticing: it doesn't matter which point you label \((x_1, y_1)\) and which you label \((x_2, y_2)\). Both differences get squared, so any negative sign disappears either way. Pick whichever assignment makes the subtraction feel easier.

A note on direction

You might wonder: what if I subtract in the wrong order and get a negative number inside the square root? That can't happen here. Each term is squared before adding, so \((x_2 - x_1)^2\) and \((y_2 - y_1)^2\) are always non-negative. The expression under the square root is always zero or positive.

In Three Dimensions

The formula extends naturally to 3D. If your points have three coordinates — \((x_1, y_1, z_1)\) and \((x_2, y_2, z_2)\) — just add a third squared term:

$$d = \sqrt{(x_2-x_1)^2 + (y_2-y_1)^2 + (z_2-z_1)^2}$$

The logic is the same. You're still applying the Pythagorean theorem, just once more to account for the extra dimension.

Example: Find the distance between \((1, 5, 0)\) and \((2, 0, 8)\).

$$d = \sqrt{(2-1)^2 + (0-5)^2 + (8-0)^2}$$ $$d = \sqrt{1 + 25 + 64}$$ $$d = \sqrt{90} \approx 9.49$$

Practice Problems

Find the distance between \((0, 0)\) and \((6, 8)\).

Show answer\(d = \sqrt{6^2 + 8^2} = \sqrt{36 + 64} = \sqrt{100} = 10\)

Find the distance between \((-3, 4)\) and \((5, -2)\).

Show answer\(d = \sqrt{(5-(-3))^2 + (-2-4)^2} = \sqrt{8^2 + (-6)^2} = \sqrt{64 + 36} = \sqrt{100} = 10\)

A line segment has endpoints at \((2, 3)\) and \((2, 9)\). How long is it?

Show answer\(d = \sqrt{(2-2)^2 + (9-3)^2} = \sqrt{0 + 36} = 6\). The points share the same x-coordinate, so this is a vertical segment — you could count the units directly.

Find the distance between \((-1, 4)\) and \((5, -4)\).

Show answer\(d = \sqrt{(5-(-1))^2 + (-4-4)^2} = \sqrt{6^2 + (-8)^2} = \sqrt{36 + 64} = \sqrt{100} = 10\)

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

Show answer\(d = \sqrt{(4-1)^2 + (6-2)^2 + (3-3)^2} = \sqrt{9 + 16 + 0} = \sqrt{25} = 5\). The z-coordinates are equal, so the points are at the same height — it reduces to a 2D problem.

Two points are 13 units apart. One point is at \((0, 0)\) and the other is at \((5, y)\). What is \(y\)?

Show answerSquare both sides: \(169 = 25 + y^2\), so \(y^2 = 144\) and \(y = \pm 12\). There are two answers: the second point is either \((5, 12)\) or \((5, -12)\).

Popular Questions from Our Forum