Coordinate geometry
How To Calculate A Midpoint
The midpoint of two points sits exactly halfway between them in every direction. You get it by averaging the x coordinates and averaging the y coordinates.
Quick Answer
midpoint = ((x1 + x2) / 2, (y1 + y2) / 2)
- x1, y1
- The coordinates of the first point
- x2, y2
- The coordinates of the second point
- d
- The distance between the two points
- m
- The slope of the line through the two points
Add the two x values and halve them, then add the two y values and halve them. The points 2, 3 and 8, 11 have a midpoint of 5, 7, they are 10 units apart, and the slope of the line between them is 1.33.
What Is A Midpoint?
The midpoint is the point that divides a segment into two equal parts. It is equidistant from both endpoints, which is the definition rather than a consequence of the arithmetic.
Finding it is the same operation twice: average the x coordinates for the x value of the midpoint, and average the y coordinates for the y value. Nothing about the points needs to be rearranged first.
The formula generalises to three dimensions by averaging a third coordinate, and to any number of dimensions by averaging each one in turn.
The distance between the points comes from Pythagoras. The horizontal and vertical differences are the two shorter sides and the segment itself is the hypotenuse.
The slope is the vertical difference divided by the horizontal difference. It is the same for any two points on a line, which is why a line only needs two points to be fully determined.
A perpendicular bisector is the line through the midpoint at right angles to the segment. Every point on it is equidistant from the two endpoints, which is the basis of several geometric constructions.
In a triangle the three midpoints of the sides form the medial triangle, whose sides are half the length of the original and parallel to them.
The midpoint formula is the one dimensional case of a weighted average. Give one point a higher weight and the same arithmetic returns a point somewhere else along the segment.
Computer graphics uses the same idea constantly. Splitting a line at its midpoint repeatedly is how a subdivision curve is built, and the result approaches a smooth curve without any trigonometry.
Numerical methods use midpoints for bisection. A root is bracketed, the midpoint of the bracket is tested, and half the interval is discarded each round.
The midpoint formula carries a bracket around the two coordinates because the result is an ordered pair rather than two separate answers. Dropping either coordinate loses the point.
Averaging is a linear operation, which is why the formula extends so easily. The midpoint of three points is the average of all three, and the midpoint of a thousand points is still just the average of each column.
The segment from one endpoint to the midpoint is half the length of the original and parallel to it. That single fact is what makes the medial triangle half scale in every direction.
Surveying and navigation use the same arithmetic. Two bearings fix a position, and the midpoint of that segment is the best estimate when both measurements are equally trustworthy.
The midpoint of a chord of a circle is the foot of the perpendicular from the centre. That construction is how a compass finds the centre of a circle you are handed drawn on paper.
Weighted averaging generalises the formula. Give one endpoint weight two and the other weight one and the point lands a third of the way along, which is the same arithmetic with a different divisor.
Formula
M = ((x1 + x2) / 2, (y1 + y2) / 2)
Formula page →Each coordinate of the midpoint is the average of the matching coordinates.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| M | Midpoint | coordinate | The point halfway between the two given points. |
| x1, x2 | x coordinates | units | The x values of the two points. |
| y1, y2 | y coordinates | units | The y values of the two points. |
d = sqrt((x2 - x1)^2 + (y2 - y1)^2)
Formula page →Pythagoras applied to the horizontal and vertical differences.
| Symbol | Meaning | Unit | Notes |
|---|---|---|---|
| d | Distance | units | The length of the segment joining the two points. |
| x2 - x1 | Horizontal change | units | The run between the two points. |
| y2 - y1 | Vertical change | units | The rise between the two points. |
How To Calculate A Midpoint
- 1
Write the two points down
Keep the order straight but do not worry about which is labelled first. Averaging is symmetric, so swapping them gives the same midpoint.
- 2
Average the x coordinates
2 plus 8 is 10, and halving it gives 5. That is the x coordinate of the midpoint.
- 3
Average the y coordinates
3 plus 11 is 14, and halving it gives 7. Together with the previous step the midpoint is the point 5, 7.
- 4
Check the distance if you need it
The horizontal difference is 6 and the vertical difference is 8, and the square root of 36 plus 64 is 10.
- 5
Check the slope if you need it
Eight divided by 6 is 1.33, so the line rises by 1.33 units for every unit it moves to the right.
Examples
Example 1: The points 2, 3 and 8, 11
- x1
- 2
- y1
- 3
- x2
- 8
- y2
- 11
| Step | Calculation | Result |
|---|---|---|
| Sum of the x coordinates | 2 + 8 | 10 |
| Midpoint x | 10 / 2 | 5 |
| Sum of the y coordinates | 3 + 11 | 14 |
| Midpoint y | 14 / 2 | 7 |
| Horizontal difference | 8 - 2 | 6 |
| Vertical difference | 11 - 3 | 8 |
Result: The midpoint is the point 5, 7. The two points differ by 6 horizontally and 8 vertically, which is the familiar six eight ten triangle, so they sit 10 units apart on a slope of 1.33.
Example 2: A segment with negative coordinates
- x1
- -4
- y1
- -7
- x2
- 6
- y2
- 5
| Step | Calculation | Result |
|---|---|---|
| Sum of the x coordinates | -4 + 6 | 2 |
| Midpoint x | 2 / 2 | 1 |
| Sum of the y coordinates | -7 + 5 | -2 |
| Midpoint y | -2 / 2 | -1 |
| Horizontal difference | 6 - -4 | 10 |
| Vertical difference | 5 - -7 | 12 |
Result: The midpoint is the point 1, -1, which sits in the fourth quadrant even though both endpoints start in the third. The separation is 10 across and 12 up, giving a distance of about 15.62.
Example 3: Two points sharing an x coordinate
- x1
- 3
- y1
- -2
- x2
- 3
- y2
- 10
| Step | Calculation | Result |
|---|---|---|
| Sum of the x coordinates | 3 + 3 | 6 |
| Midpoint x | 6 / 2 | 3 |
| Sum of the y coordinates | -2 + 10 | 8 |
| Midpoint y | 8 / 2 | 4 |
| Horizontal difference | 3 - 3 | 0 |
| Vertical difference | 10 - -2 | 12 |
Result: The midpoint is the point 3, 4. Because the horizontal difference is zero the segment is vertical, so the slope is undefined and the distance is simply 12 units.
Calculator
Midpoint x coordinate
5
- Midpoint y coordinate
- 7
- Distance between the points
- 10
- Slope of the line
- 1.3333
Values update as you type. This calculator covers the single scenario its formula assumes — see Common Mistakes for what it leaves out.
Prefer a full-width tool? Open the A Midpoint calculator page.
Common Mistakes
Adding the coordinates instead of averaging them
The midpoint is the mean, not the sum. Forgetting the division by two gives a point twice as far from the origin as the real answer.
Averaging an x with a y
Pair x with x and y with y. Mixing them produces a point that has nothing to do with either endpoint.
Assuming the order matters
Averaging is symmetric. Swapping the two endpoints gives exactly the same midpoint, so there is no wrong order to enter them in.
Confusing the midpoint with the distance
The midpoint is a point and the distance is a length. The formula for one is addition and halving, the other is Pythagoras.
Treating the slope as a length
The slope is a ratio with no units. A slope of 1.33 does not mean 1.33 units of rise, it means 1.33 units of rise for every unit of run.
Using a two dimensional formula in three
In three dimensions there is a third coordinate to average and a third square to add. Leaving one out silently gives a two dimensional answer.
FAQ
What is the midpoint formula?
It is the average of each coordinate: ((x1 + x2) / 2, (y1 + y2) / 2). Each coordinate of the midpoint is the mean of the matching coordinates.
Does it matter which point is first?
No. Addition commutes, so swapping the endpoints gives the same midpoint. The distance and slope are unchanged too.
What is the midpoint of a line with one coordinate?
In one dimension it is just the average of the two numbers, so the midpoint of 4 and 10 is 7.
How do I find the midpoint from just one endpoint?
You cannot. Two points are needed, or one point plus the midpoint itself, or one point plus the length and direction of the segment.
What is the difference between a midpoint and a median?
A midpoint is a point on a segment. A median of a triangle is a line from a vertex to the midpoint of the opposite side.
Can a midpoint be outside the segment?
Not between the two endpoints. The midpoint is always inside the segment by construction, though weighted averages with weights outside zero to one fall outside it.
References
- [1]Wikipedia, Midpoint — https://en.wikipedia.org/wiki/Midpoint
- [2]Wikipedia, Coordinate system — https://en.wikipedia.org/wiki/Coordinate_system
- [3]Wikipedia, Euclidean distance — https://en.wikipedia.org/wiki/Euclidean_distance