How distance and midpoint are calculated
The distance formula applies the Pythagorean theorem to the x- and y-coordinate differences between the two points. The midpoint simply averages the x-coordinates and the y-coordinates separately.
- x1, y1 — coordinates of point 1
- x2, y2 — coordinates of point 2
- d — distance between the two points
More detail
Where the formula comes from
Draw a right triangle with legs (x2−x1) and (y2−y1); the segment joining the two points is the hypotenuse. The distance formula is just the Pythagorean theorem (a² + b² = c²) applied to that triangle.
Quick check. Points (0,0) and (3,4) form a 3-4-5 right triangle, so the distance comes out to exactly 5 — a fast way to sanity-check the calculator.
Frequently asked questions
How is the distance between two points calculated?
Square the x-coordinate difference and the y-coordinate difference, add them, then take the square root: d = √((x2−x1)² + (y2−y1)²). For (0,0) and (3,4) that's √(3²+4²) = √25 = 5.
How is the midpoint calculated?
Average the two x-coordinates and the two y-coordinates separately: midpoint = ((x1+x2)/2, (y1+y2)/2). For (0,0) and (3,4) the midpoint is (1.5, 2).
Can I enter negative or zero coordinates?
Yes. x and y can be any real number, positive, negative, or zero — and if both points share the same coordinates the distance simply comes out to 0.
Does this formula work in 3D?
The formula above is for a 2D plane (x, y) only. In 3D you'd add a squared z-coordinate difference: d = √((x2−x1)² + (y2−y1)² + (z2−z1)²).