Distance Formula Geometry: Derivation, Examples, and Mistakes

·94% (74 Rated)
Illustration_right blog cover: a light-brown-skin teen girl with long curly dark-brown hair in an ochre-orange sweater works on a coordinate-paper sketch beside a tablet and a straightedge on a light wood surface, facing the title Distance Formula Geometry: Derivation, Examples, and Mistakes on a light goose-yellow background.
The distance formula gives the straight-line distance between two points on a coordinate plane. For points (x₁, y₁) and (x₂, y₂), d = √((x₂ − x₁)² + (y₂ − y₁)²). It extends the Pythagorean theorem: the two coordinate differences form the legs of a right triangle, and d is the hypotenuse, which is the length of segment AB. Label the two points, subtract matching coordinates, square and add, then take the principal square root to find the segment length.

What Is the Distance Formula?

The distance formula in geometry calculates the length of the segment between two plotted points without measuring it with a ruler. If point A has coordinates (x₁, y₁) and point B has coordinates (x₂, y₂), the distance d equals the square root of the sum of the squared horizontal difference and the squared vertical difference:
d = √((x₂ − x₁)² + (y₂ − y₁)²)
Because the number describes a physical length, it is never negative. The horizontal and vertical differences act as the two legs of a right triangle, while d is the hypotenuse. This guide works entirely in the two-dimensional plane; three-dimensional coordinates, map distances, and curved surfaces belong to other topics.
The geometry concepts guide places this formula inside the wider study of points, segments, and figures. The plane geometry guide explains the coordinate plane itself; this page assumes the reader can read an ordered pair (x, y) and plot it on grid axes.

Derivation: The Right Triangle on the Coordinate Plane

The formula follows directly from the Pythagorean theorem. For a right triangle with legs a and b and hypotenuse c, the theorem gives a² + b² = c²; Britannica defines the hypotenuse as the side opposite the right angle and the legs as the two sides that meet at that angle.
Plot two points, P(x₁, y₁) and Q(x₂, y₂). Draw a horizontal segment through P and a vertical segment through Q so they meet at a third point R. The resulting triangle PQR is a right triangle. The horizontal leg has length |x₂ − x₁|, because the horizontal change does not depend on which endpoint you subtract first; the vertical leg has length |y₂ − y₁| for the same reason. The segment PQ is the hypotenuse, and its length is the distance between the two points.
Substitute the two leg lengths into the theorem:
|x₂ − x₁|² + |y₂ − y₁|² = d²
Squaring a difference removes the sign, so the absolute-value bars can be dropped:
(x₂ − x₁)² + (y₂ − y₁)² = d²
Taking the nonnegative square root of both sides gives the formula. Khan Academy lesson walks through the same setup: plot the points, label the base and height, write the Pythagorean equation, then solve for the hypotenuse by taking a square root. Math LibreTexts presents the coordinate differences as the two leg lengths and treats d(A, B) as the length of segment AB.
Students can sketch the right triangle instead of memorizing the formula first: compute the two leg lengths, apply the Pythagorean theorem, and simplify. The formula packages that same chain into one line, so the derivation above explains why each part appears where it does. The relationship works on the ordinary flat plane described by the upcoming Euclidean geometry guide; that guide covers the axiom framework underneath plane figures, while this page stays with coordinate practice.
Warm-white coordinate grid with two plotted points joined by a sketched right triangle; the horizontal leg, vertical leg, and hypotenuse each carry a short charcoal label, the hypotenuse marked with one pink-red accent; no long formula or equal-sized cards in the image.

Worked Examples on the Coordinate Plane

Use the same procedure for every pair of points. Label the endpoints, find the two coordinate differences, square each difference, add the squares, and take the principal square root. Khan Academy and Math LibreTexts both separate the labeling step from the arithmetic step, so the arithmetic stays clear when coordinates carry negative signs.

First-Quadrant Example

Find the distance between P(2, 1) and Q(6, 4). Take P as (x₁, y₁) and Q as (x₂, y₂), so x₁ = 2, y₁ = 1, x₂ = 6, and y₂ = 4. The horizontal difference is 6 − 2 = 4, and the vertical difference is 4 − 1 = 3. Square both differences: 4² = 16 and 3² = 9. Add them: 16 + 9 = 25. The distance is d = √25 = 5. The triangle built on these points is a 3-4-5 right triangle, which makes the result easy to check on a grid.

Mixed-Sign Example

Find the distance between C(−2, 1) and D(3, −2). Here x₁ = −2, y₁ = 1, x₂ = 3, and y₂ = −2. The horizontal difference is 3 − (−2) = 5. The vertical difference is −2 − 1 = −3, not 3 − 1; subtracting the matching coordinate keeps the pair together. Squaring removes the negative sign: 5² = 25 and (−3)² = 9. Adding gives 25 + 9 = 34, so d = √34. As a decimal approximation, √34 ≈ 5.83; keep the radical form √34 when an exact answer is required. The negative signs in the coordinates do not change the procedure, but they do make careful subtraction more important.
Coordinate grid showing points P(2, 1) and Q(6, 4) joined by a right triangle; the legs are labeled 4 and 3 and the hypotenuse is labeled 5, with short charcoal labels and one warm accent; the complete substitution steps stay in the article text, not the image.

Horizontal or Vertical Segments

When two points share the same y-coordinate, the vertical difference is zero. When they share the same x-coordinate, the horizontal difference is zero. The formula still produces the segment length, but a grid count gives the same answer faster. For E(1, 2) and F(6, 2), both points have y = 2, so the segment runs horizontally and d = 6 − 1 = 5. For G(3, 1) and H(3, 5), both points have x = 3, so the segment runs vertically and d = 5 − 1 = 4. CK-12 notes that counting grid units works for these aligned pairs, while the general formula still applies to any slanted segment.

Common Mistakes to Avoid

The arithmetic itself is usually simple; most errors come from organizing the coordinates before squaring them. Watch for these slips as you substitute points into the formula.
  • Pairing mismatched coordinates. Use x₁ with y₁ and x₂ with y₂ throughout the calculation. Swapping y₁ with y₂ in the subtraction changes both leg lengths and produces a wrong segment.
  • Dropping a sign or changing subtraction order. A negative difference, such as −3, squares to the same value as the positive 3, so the final result does not depend on which point is listed first. That does not mean the subtraction can skip signs; write −2 − 1 before squaring the result.
  • Forgetting to square the differences. Adding the leg lengths 4 + 3 = 7 gives the perimeter of the triangle, not the hypotenuse. The theorem uses squares: 4² + 3² = 25, then the square root returns a length.
  • Taking the square root before adding. Square each difference first, add the two squares, and take one square root at the end. Taking roots separately breaks the Pythagorean relationship and usually produces a smaller or larger number than the true segment length.
  • Mixing up the two legs. The horizontal difference uses x-coordinates, and the vertical difference uses y-coordinates. Swapping them does not change a correctly squared sum, but it scrambles the sketch, the shortcut cases, and the check against the drawn triangle.
Open hand-drawn sheet split into two non-card zones: the left zone pairs each point with its own x and y labels under a sunny-yellow check mark; the right zone shows crossed arcs between points rejected by one bold pink-red X with the short label Mismatch; open layout, minimal arrows, no equal rounded boxes.

Using the Formula for Plotted Figures

The same rule works for sides of shapes you draw on a coordinate grid. Take two adjacent vertices of a plotted polygon, substitute their coordinates, and the formula returns that side's length. Repeating the calculation for every adjacent pair gives the side lengths needed for a perimeter sum; this guide does not expand area formulas for irregular polygons. CK-12 connects the formula to segment lengths used inside polygon figures, which is why coordinate drawing appears in both geometry lessons and later measurement problems.
The geometric shapes guide describes the figures themselves, while the geometry formulas reference collects the area, perimeter, and other measurement formulas students consult after the side lengths are known.

How to Practice the Distance Formula

Move first through pairs in the first quadrant so the coordinate differences stay positive, then work toward points with negative coordinates on both sides of an axis. Sketch each pair and the right triangle once or twice; after that, the sketch can move to mental or scratch-paper work. Check horizontal and vertical pairs by counting grid units before reaching for the formula, and finish with a plotted figure where each side comes from a fresh pair of coordinates. If a result looks too large, return to the pairing, sign, squaring, and root-order checklist above.

Learn Geometry with Gauth

The existing geometry course includes a Unit 6 lesson on coordinate-plane midpoints and distances, where this formula appears alongside related coordinate practice. You can also create a focused interactive course for the topic and grade level you want to drill, starting with two-point distance practice and moving to plotted figures.

Frequently Asked Questions About the Distance Formula

Does it matter which point I label (x₁, y₁) versus (x₂, y₂)? No. Reversing the labels changes each difference to its opposite, but squaring removes that opposite sign, so the two squared sums stay the same. Keep one point's x with that point's y while you write the differences; label order itself does not change the answer.
How does the distance formula differ from the midpoint formula? The distance formula returns a length, the number of units in segment AB. The midpoint formula returns an ordered pair, the average coordinates of the two endpoints, which locates the point at the segment's center. Math LibreTexts presents both rules in the same coordinate lesson; this guide derives the distance rule only, so the midpoint formula is noted here as a separate tool.

Sources and Review

  • Britannica, Pythagorean theorem, accessed 2026-10-26: right-triangle legs, hypotenuse, and the a² + b² = c² relationship used to derive the coordinate formula.
  • CK-12 Foundation, The Distance Formula, accessed 2026-10-26: segment-length generalization, grid-count shortcut for aligned segments, and polygon side-length applications; editorial fact-check dated 2026-10-02.

Related