The distance between two points (x₁, y₁) and (x₂, y₂) is d = √((x₂ − x₁)² + (y₂ − y₁)²), and the midpoint of the segment joining them is M = ((x₁ + x₂)/2, (y₁ + y₂)/2). In words: subtract, square, add and take the root for the distance; average the x-coordinates and average the y-coordinates for the midpoint.
Below, both formulas run on the same pair of points so one checks the other, followed by negative coordinates, radical answers, a missing endpoint, a triangle and a map problem.
The Two Formulas
(x₁, y₁) and (x₂, y₂):d = √((x₂ − x₁)² + (y₂ − y₁)²)M = ((x₁ + x₂)/2, (y₁ + y₂)/2)The distance is a single number (a length). The midpoint is a point, so it has two coordinates.
Both formulas appear in this form in OpenStax College Algebra, section 2.1. Notice the one sign that separates them: distance subtracts coordinates (it measures a gap), and midpoint adds them (it averages). Mixing those up is the most common slip on this topic.
A useful special case: when one point is the origin, the distance from (0, 0) to (x, y) is just √(x² + y²).
Where the Distance Formula Comes From
Plot two points that are not on the same horizontal or vertical line. From the first point, walk horizontally until you are directly below (or above) the second point, then walk vertically to reach it. Those two walks are the legs of a right triangle, and the straight segment between the points is the hypotenuse.
- The horizontal leg has length
|x₂ − x₁|. - The vertical leg has length
|y₂ − y₁|. - The Pythagorean theorem says
d² = |x₂ − x₁|² + |y₂ − y₁|².
Squaring a number removes its sign, so |x₂ − x₁|² = (x₂ − x₁)² and the absolute value bars can go. Take the square root of both sides (a length is never negative, so only the positive root counts) and you have the distance formula.
x₂ − x₁ and x₁ − x₂ are opposites, like 6 and −6, and opposites have the same square. So you can call either point "point 1". The only rule is to stay consistent inside each bracket: if you start the x-difference with point B, start the y-difference with point B too. (For the midpoint you add, and addition never cared about order.)
How to Use the Distance Formula
- Label the points
Write
(x₁, y₁)and(x₂, y₂)above the numbers so negatives don't get lost. - Find the two differences
Compute
x₂ − x₁andy₂ − y₁, putting every negative coordinate in brackets. - Square, add, take the root
Square each difference (both results are now positive), add them, and take the square root. Simplify the radical if it isn't a perfect square.
Find the distance between A(−2, 3) and B(4, −5).
Horizontal difference: x₂ − x₁ = 4 − (−2) = 6.
Vertical difference: y₂ − y₁ = −5 − 3 = −8.
Square and add: 6² + (−8)² = 36 + 64 = 100.
Root: d = √100 = 10.
Swap the order as a test: (−2 − 4)² + (3 − (−5))² = (−6)² + 8² = 36 + 64 = 100. Same total, same distance.
AB = 10 unitsThe legs here are 6 and 8, a scaled-up 3-4-5 right triangle, which is why the answer came out whole. Most pairs of points don't do that.
How to Use the Midpoint Formula
The midpoint sits halfway along the segment in both directions at once. Halfway between two numbers on a number line is their average, so the midpoint's x-coordinate is the average of the x-coordinates, and the same goes for y. Each coordinate is averaged separately; you never mix an x with a y.
Find the midpoint M of A(−2, 3) and B(4, −5), the same points as Example 1.
x-coordinate: (−2 + 4)/2 = 2/2 = 1.
y-coordinate: (3 + (−5))/2 = −2/2 = −1.
Check with the distance formula: AM = √((1 − (−2))² + (−1 − 3)²) = √(9 + 16) = √25 = 5 and MB = √((4 − 1)² + (−5 − (−1))²) = √(9 + 16) = 5.
Both halves are 5, and 5 + 5 = 10, the full length from Example 1. So M really is halfway.
M = (1, −1)Find the distance and the midpoint for P(−4, 1) and Q(−1, 7).
Differences: −1 − (−4) = 3 and 7 − 1 = 6.
Square and add: 3² + 6² = 9 + 36 = 45, so d = √45.
Simplify: 45 = 9 × 5, so √45 = √9 × √5 = 3√5 ≈ 6.708.
Midpoint: ((−4 + (−1))/2, (1 + 7)/2) = (−5/2, 8/2) = (−2.5, 4).
PQ = 3√5 ≈ 6.71, M = (−2.5, 4)Exact or decimal? If the question doesn't say, give the simplest radical form (3√5), since that's exact, and add a rounded decimal when the context is a real measurement. The guide to simplifying radicals covers pulling out the perfect-square factor. A midpoint with a half in it is completely normal: it happens whenever the two coordinates add to an odd number.
Writing 4 − (−2) as 4 − 2 = 2. In Example 1 that turns the horizontal leg from 6 into 2 and the distance into √(4 + 64) = √68 ≈ 8.25 instead of 10. It happens because the brackets get dropped when the numbers are copied into the formula. Three related slips: treating √(36 + 64) as 6 + 8 = 14 (a square root does not split across a plus sign), using the midpoint formula with a minus sign, which gives half the gap between the points instead of the point in the middle, and adding the coordinates but forgetting to divide one of them by 2.
How to Find a Missing Endpoint
Sometimes you know the midpoint M(m, n) and one endpoint (x₁, y₁), and need the other end. Run the midpoint formula backwards: (x₁ + x₂)/2 = m gives x₂ = 2m − x₁, and in the same way y₂ = 2n − y₁. The picture behind it: the step from the known endpoint to the midpoint is repeated once more to reach the far end.
M(2, −1) is the midpoint of segment AB, and A = (−3, 4). Find B.
x: x₂ = 2(2) − (−3) = 4 + 3 = 7.
y: y₂ = 2(−1) − 4 = −2 − 4 = −6.
Step view: from A to M is +5 in x and −5 in y. Repeat it from M: (2 + 5, −1 − 5) = (7, −6).
Check: ((−3 + 7)/2, (4 + (−6))/2) = (4/2, −2/2) = (2, −1), the given midpoint.
B = (7, −6)A tempting wrong move is to average A and M, which gives (−0.5, 1.5). That point is a quarter of the way along the segment, not the far end. If your "endpoint" lands between A and M, this is what happened.
Using Both Formulas on a Triangle
Side lengths from the distance formula let you classify a triangle drawn on a grid. Equal sides mean isosceles, and if the two shorter sides satisfy a² + b² = c² with the longest side, the triangle has a right angle (the converse of the Pythagorean theorem).
Triangle ABC has vertices A(1, 1), B(4, 5) and C(8, 2). Is it isosceles? Is it a right triangle?
AB = √((4 − 1)² + (5 − 1)²) = √(9 + 16) = √25 = 5.
BC = √((8 − 4)² + (2 − 5)²) = √(16 + 9) = √25 = 5.
AC = √((8 − 1)² + (2 − 1)²) = √(49 + 1) = √50 = 5√2 ≈ 7.07.
Two sides equal 5, so it is isosceles. Converse test with the longest side AC: AB² + BC² = 25 + 25 = 50 = AC², so the angle at B is a right angle.
Bonus: the midpoint of the hypotenuse AC is ((1 + 8)/2, (1 + 2)/2) = (4.5, 1.5), and its distance to B is √(0.5² + 3.5²) = √12.5 ≈ 3.54, exactly half of √50. In any right triangle, the midpoint of the hypotenuse is the same distance from all three vertices.
isosceles right triangle, right angle at BDistance and Midpoint Word Problems
A quick note on the search term: "distance word problems" also covers rate problems built on distance = rate × time. That is a different topic. The problems below give locations as coordinates and ask how far apart they are or where halfway is.
On a town map with a 1 km grid, Maya's school is at (−3, −2) and the library is at (5, 4). How far apart are they in a straight line? Where is the point exactly halfway? If the streets run along the grid lines, how far is the shortest walk?
Differences: 5 − (−3) = 8 km east and 4 − (−2) = 6 km north.
Straight line: d = √(8² + 6²) = √(64 + 36) = √100 = 10 km.
Halfway point: ((−3 + 5)/2, (−2 + 4)/2) = (2/2, 2/2) = (1, 1).
Along the streets she must cover the full 8 km east and 6 km north, so the walk is 8 + 6 = 14 km.
10 km apart; halfway at (1, 1); 14 km by streetThe gap between 10 km and 14 km shows what the distance formula measures: "as the crow flies", the hypotenuse, not the two legs added together. When a problem says "straight-line distance" or "shortest distance", use the formula. When it says the route follows a grid of streets, add the legs.
Distance and Midpoint in 3D
In three dimensions you add one more squared difference: d = √((x₂ − x₁)² + (y₂ − y₁)² + (z₂ − z₁)²), as given in OpenStax Calculus Volume 3, section 2.2. The midpoint averages all three coordinates. For (1, 2, 3) and (3, 5, 9): d = √(2² + 3² + 6²) = √(4 + 9 + 36) = √49 = 7, and the midpoint is (2, 3.5, 6).
How to Check Your Answer
- Size check. The distance can't be shorter than the longer leg or longer than the two legs added. In Example 3 the legs are 3 and 6, so the answer must lie between 6 and 9;
3√5 ≈ 6.71fits. An answer outside that window means a subtraction or a square went wrong. - Midpoint check. Measure from the midpoint to each endpoint. Both distances must be equal and must add up to the full length, as in Example 2.
- Endpoint check. Put your answer and the known endpoint back into the midpoint formula and confirm you get the given midpoint.
- Sketch. A ten-second plot shows whether the midpoint sits between the points and roughly how long the segment is.
The distance formula is also the engine behind the circle equation: a circle is every point at distance r from a center, which is why (x − h)² + (y − k)² = r² looks the way it does (more in the conic sections guide). Once you have finished a problem by hand, Solver AI can scan it and show the steps, so you can see exactly where your working and its working part ways.
Practice Problems
Do each one by hand, then run one of the checks above.
- Find the distance from the origin to
(−5, 12). - Find the midpoint of
(−7, 2)and(3, −8). - Find the distance between
(2, −3)and(7, 4), exact and to two decimal places. M(−1, 3)is the midpoint of a segment with one endpoint at(4, −2). Find the other endpoint.- A diameter of a circle runs from
(−1, 2)to(5, 10). Find the center, the radius and the equation of the circle, then decide whether(6, 3)lies on it.
1. √(25 + 144) = √169 = 13. 2. (−2, −3). 3. √(25 + 49) = √74 ≈ 8.60. 4. (2(−1) − 4, 2(3) − (−2)) = (−6, 8). 5. The center is the midpoint, (2, 6). The diameter is √(6² + 8²) = 10, so the radius is 5 and the circle is (x − 2)² + (y − 6)² = 25. For (6, 3): (6 − 2)² + (3 − 6)² = 16 + 9 = 25, so yes, it lies on the circle.