How-to guides · 4 min read
Distance and Midpoint Formulas With Worked Examples

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)
Order-of-operations steps 6 steps
Start: √((7 − 1)^2 + (10 − 2)^2)
- Subtract
7 − 1 = 6→ √(6^2 + (10 − 2)^2) - Subtract
10 − 2 = 8→ √(6^2 + 8^2) - Exponent
6^2 = 36→ √(36 + 8^2) - Exponent
8^2 = 64→ √(36 + 64) - Add
36 + 64 = 100→ √(100) - 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 A | Point B | Differences | d² | Distance (exact) | Decimal |
|---|---|---|---|---|---|
| (0, 0) | (3, 4) | 3, 4 | 25 | 5 | 5 |
| (1, 2) | (7, 10) | 6, 8 | 100 | 10 | 10 |
| (−2, 3) | (4, −1) | 6, −4 | 52 | 2√13 | 7.2111 |
| (2, 5) | (5, 1) | 3, −4 | 25 | 5 | 5 |
| (−3, −2) | (2, 4) | 5, 6 | 61 | √61 | 7.8102 |
| (0, 0) | (1, 1) | 1, 1 | 2 | √2 | 1.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 A | Point B | Midpoint |
|---|---|---|
| (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.
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.
Keep reading
How to Find the Slope of a Line: Formula and Examples
Slope = rise ÷ run = (y₂ − y₁) ÷ (x₂ − x₁). Find slope from two points, an equation or a graph, and use it for parallel and perpendicular lines.
How-to guidesHow to Simplify Square Roots and Radicals Step by Step
Simplify radicals like √72 = 6√2 by pulling out perfect squares. Includes a table of perfect squares, adding radicals and rationalising denominators.
ConceptsPythagorean Triples: A Full List and How to Generate Them
Whole-number right triangles such as 3-4-5 and 5-12-13. A computed list of primitive triples and Euclid’s formula for making your own.
How-to guidesQuadratic Formula Step by Step: Worked Examples
Use the quadratic formula in five clear steps. Worked examples show two solutions, one repeated solution and no real solutions, with a graph.