Guide

Midpoint and distance between two points

By Viktor Lassen4 min readUpdated 3 September 2026

The distance between two points is the hypotenuse of a right-angled triangle, so the distance formula is just Pythagoras. The midpoint is a kind of average of the coordinates. Both, worked through step by step.

When we have two points in a coordinate system, we can use the distance formula to find the distance between them. We mark the distance between two points AA and BB with two vertical bars, โˆฃABโˆฃ|AB|, which means the length of the line segment between AA and BB. And with the midpoint formula we can find the point that sits exactly halfway between them.

When do I use this?

Whenever a problem is set on coordinate axes and asks how long something is, or where the middle of it is: the length of a side of a triangle drawn on a grid, the centre of a rectangle, or the radius of a circle when you know the centre and a point on it. Both formulas belong to coordinate geometry, where figures are described with coordinates and equations.

The distance formula

The formula looks like this:

โˆฃABโˆฃ=(x2โˆ’x1)2+(y2โˆ’y1)2|AB| = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

The points here are A(x1,y1)A(x_1, y_1) and B(x2,y2)B(x_2, y_2). So the formula says: take the square root of the difference between the points' x-coordinates squared, plus the difference between the points' y-coordinates squared.

Let's try an example. We have the two points (2,3)(2, 3) and (4,8)(4, 8) and want the distance between them. We put the points into the formula and work it out:

โˆฃABโˆฃ=(4โˆ’2)2+(8โˆ’3)2=22+52=4+25=29|AB| = \sqrt{(4 - 2)^2 + (8 - 3)^2} = \sqrt{2^2 + 5^2} = \sqrt{4 + 25} = \sqrt{29}

29โ‰ˆ5.39\sqrt{29} \approx 5.39

So the distance between the two points is about 5.395.39.

That was a small example of the distance formula, but where does it come from? Let's look at that now.

Why does the distance formula look like that?

You may already have noticed that the distance formula reminds you a lot of Pythagoras' theorem, and that's because it comes from there. Let's see how we use Pythagoras to find the distance between two points.

We start by drawing the two points and joining them with a line segment, which we call โˆฃABโˆฃ|AB|. That's the distance we want a formula for.

The distance |AB| between A(2, 3) and B(4, 8) is the hypotenuse of a right-angled triangle with shorter sides d and f

Now we draw in a right-angled triangle where the hypotenuse is the distance we want, โˆฃABโˆฃ|AB|. We call one of the shorter sides dd and the other one ff. That means we can write Pythagoras as

d2+f2=โˆฃABโˆฃ2d^2 + f^2 = |AB|^2

On our figure we can describe both dd and ff in another way.

The same triangle with the shorter sides written as coordinate differences: d = x_2 - x_1 and f = y_2 - y_1

Here the coordinates of AA and BB are drawn in, A(x1,y1)A(x_1, y_1) and B(x2,y2)B(x_2, y_2). We can see that dd is actually the difference between the two points' x-coordinates. At the same time, ff is actually the difference between the two points' y-coordinates. So:

d=x2โˆ’x1andf=y2โˆ’y1d = x_2 - x_1 \quad \text{and} \quad f = y_2 - y_1

We can now swap those into Pythagoras' theorem:

(x2โˆ’x1)2+(y2โˆ’y1)2=โˆฃABโˆฃ2(x_2 - x_1)^2 + (y_2 - y_1)^2 = |AB|^2

We don't want our length squared, so we get rid of the square by taking the square root on both sides:

(x2โˆ’x1)2+(y2โˆ’y1)2=โˆฃABโˆฃ\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2} = |AB|

And now we've arrived at our formula, which really is just Pythagoras' theorem.

The midpoint formula

The midpoint formula is a formula we use to find the middle between two points. You can see it as finding the middle of the distance between the two points.

The midpoint M of the segment from A(3, 4) to B(5, 7) sits halfway along, at (4, 5.5)

We find the midpoint with this formula:

M=(x1+x22,y1+y22)M = \left( \frac{x_1 + x_2}{2}, \frac{y_1 + y_2}{2} \right)

The formula tells us how to find the midpoint, which we call MM, with coordinates (x,y)(x, y). We find the x-coordinate first, by taking the x-coordinates of the two points, adding them together and then dividing by 22. We find the y-coordinate of the midpoint the same way: add the y-coordinates of the points together and divide by 22. It's actually a kind of average of the x-values and of the y-values.

Let's take an example. Say we had the two points (3,4)(3, 4) and (5,7)(5, 7). To find the midpoint between them we put the points into the formula:

M=(3+52,4+72)M = \left( \frac{3 + 5}{2}, \frac{4 + 7}{2} \right)

Then we just work it out:

M=(82,112)=(4,5.5)M = \left( \frac{8}{2}, \frac{11}{2} \right) = (4, 5.5)

So the midpoint is (4,5.5)(4, 5.5). If you look at the figure, it sits exactly halfway along the segment from AA to BB.

Common mistakes

  • Stopping at โˆฃABโˆฃ2|AB|^2. Pythagoras gives you the distance squared. The last step is always the square root, otherwise you have 2929 instead of 5.395.39.
  • Mixing up which difference is which. dd is the difference between the x-coordinates and ff is the difference between the y-coordinates. Keep the x's together and the y's together inside the formula.
  • Averaging only one of the coordinates for the midpoint. The midpoint needs both: the average of the x-coordinates and the average of the y-coordinates.

Frequently asked questions

Read next

Want to get good at maths?

Mathara explains every topic step by step with videos, exercises and personal feedback.

๐Ÿ‘‰ Get started for free