How-to guides · 4 min read

Distance and Midpoint Formulas With Worked Examples

Distance and Midpoint Formulas With Worked Examples — illustration
In short: The distance between (x₁, y₁) and (x₂, y₂) is √((x₂ − x₁)² + (y₂ − y₁)²), and the midpoint is the average of the coordinates. For (1, 2) and (7, 10) the distance is 10 and the midpoint is (4, 6).

Where the distance formula comes from

Draw a right triangle with the segment between the two points as its hypotenuse. The horizontal leg has length |x₂ − x₁| and the vertical leg |y₂ − y₁|. The Pythagorean theorem then gives d² = (x₂ − x₁)² + (y₂ − y₁)², so d is the square root of that. The distance formula is the Pythagorean theorem written with coordinates.

Because the differences are squared, the order of the points does not matter and negative differences cause no trouble.

Distance: a worked example

Find the distance between (1, 2) and (7, 10). The horizontal difference is 7 − 1 = 6 and the vertical difference is 10 − 2 = 8.

Distance between (1, 2) and (7, 10)
Answer10
Order-of-operations steps 6 steps

Start: √((7 − 1)^2 + (10 − 2)^2)

  1. Subtract
    7 − 1 = 6→ √(6^2 + (10 − 2)^2)
  2. Subtract
    10 − 2 = 8→ √(6^2 + 8^2)
  3. Exponent
    6^2 = 36→ √(36 + 8^2)
  4. Exponent
    8^2 = 64→ √(36 + 64)
  5. Add
    36 + 64 = 100→ √(100)
  6. Square root
    √(100) = 10→ 10

The result is 10. Notice 6-8-10 is a multiple of the 3-4-5 triple, so the answer is a whole number; see Pythagorean triples for more of these.

Several examples, with exact and decimal answers

Point APoint BDifferencesd²Distance (exact)Decimal
(0, 0)(3, 4)3, 42555
(1, 2)(7, 10)6, 81001010
(−2, 3)(4, −1)6, −4522√137.2111
(2, 5)(5, 1)3, −42555
(−3, −2)(2, 4)5, 661√617.8102
(0, 0)(1, 1)1, 12√21.4142

When d² is not a perfect square, leave the answer as a simplified radical, such as 2√13, and give a decimal only if asked. Simplifying radicals shows how each exact form is found.

The midpoint formula

The midpoint of a segment is the point exactly halfway between its endpoints. It is found by averaging the x-coordinates and averaging the y-coordinates: M = ((x₁ + x₂) ÷ 2, (y₁ + y₂) ÷ 2).

Point APoint BMidpoint
(1, 2)(7, 10)(4, 6)
(−2, 3)(4, −1)(1, 1)
(0, 0)(5, 9)(2.5, 4.5)
(−4, −6)(2, 8)(−1, 1)

The midpoint is always the same distance from both ends, so you can check it: for (1, 2), (7, 10) and M = (4, 6), the distance from A to M is √(9 + 16) = 5, half of the total 10.

Finding a missing endpoint

If you know the midpoint and one endpoint, work backwards. A segment has midpoint (3, 4) and one endpoint (1, 2). Let the other endpoint be (x, y). Then (1 + x) ÷ 2 = 3 so x = 5, and (2 + y) ÷ 2 = 4 so y = 6. The other endpoint is (5, 6).

A shortcut: the missing endpoint is twice the midpoint minus the known endpoint, coordinate by coordinate: 2 × 3 − 1 = 5 and 2 × 4 − 2 = 6.

Using the formulas: is it a right triangle?

Take the triangle with vertices A(0, 0), B(3, 4) and C(8, 4). The side lengths are AB = 5, BC = 5 and AC = √(64 + 16) = √80 = 4√5. Does it have a right angle? Check whether the squares of the two shorter sides add to the square of the longest: AB² + BC² = 25 + 25 = 50, but AC² = 80. They do not match, so it is not a right triangle.

0358101234567Segment from (1, 2) to (7, 10)x
The segment from (1, 2) to (7, 10) has length 10 and midpoint (4, 6).

Distance also gives the perimeter of any polygon whose vertices are known, and tells you whether a point lies on a circle: it does if its distance from the centre equals the radius.

Distance in three dimensions

The formula extends naturally. The distance between (x₁, y₁, z₁) and (x₂, y₂, z₂) is √((Δx)² + (Δy)² + (Δz)²). From (0, 0, 0) to (2, 3, 6) it is √(4 + 9 + 36) = √49 = 7. The midpoint again averages each coordinate.

Common mistakes

  • Forgetting to square root. d² is not d.
  • Subtracting inside the square wrongly. Square each difference; do not square the sum.
  • Adding instead of averaging for the midpoint. Divide by 2.
  • Mixing x and y. Subtract x from x and y from y.

For slopes and lines through the same points, see how to find the slope of a line, and check calculations with the scientific calculator.

Frequently asked questions

What is the distance formula?

d = √((x₂ − x₁)² + (y₂ − y₁)²), the Pythagorean theorem applied to the horizontal and vertical differences between two points.

How do I find the midpoint of two points?

Average the x-coordinates and average the y-coordinates.

Does the order of the points matter?

No. Squaring removes the sign of the differences, and addition is commutative.

How do I find the other endpoint if I know the midpoint?

Double the midpoint coordinates and subtract the known endpoint coordinates.

Written and reviewed by Mateuss M.

Mateuss M. writes and reviews mathematical content for CalcSolver, focusing on online calculators, formulas, equations, and practical math tools. He reviews calculator functionality, calculation methods, formulas, examples, and explanations to help ensure that each tool is clear, useful, and easy to understand.

Keep reading