Distance and midpoint: two formulas, one triangle

The distance between two points is not a new formula: it is the Pythagorean theorem applied to the right triangle whose legs are the differences of the coordinates. Δx = x₂ − x₁ is the horizontal leg, Δy = y₂ − y₁ the vertical one, and the hypotenuse √(Δx² + Δy²) is the segment you are measuring. Seeing it this way also explains why the signs do not matter: the legs get squared.

The midpoint is simpler still, and it is the average of the coordinates taken separately: the x of the midpoint is the mean of the two x values, the y is the mean of the two y values. There is no square root, and the answer is exact even when the distance is irrational. That is a difference worth noticing: two points with whole-number coordinates almost always have a rational midpoint and an irrational distance.

The components Δx and Δy are reported because they are the real geometric content of the calculation: together they form the vector that takes you from P₁ to P₂, and from them follow the slope of the segment, its direction and every translation the exercise will ask for later.

Common mistakes

  • Adding the coordinates instead of subtracting them in the distance: the formula uses differences, and with points in the first quadrant the mistake still returns a positive, believable number.
  • Confusing midpoint and distance by halving the distance: the midpoint is a pair of coordinates, not a length. Half the distance is how far the midpoint sits from each endpoint, which is a different thing.
  • Getting the signs wrong with negative coordinates: −3 − (−7) is +4, not −10. It is the step where most coordinate-geometry exercises are lost.

Frequently asked questions

What is the distance formula between two points?

d = √((x₂ − x₁)² + (y₂ − y₁)²). It is the Pythagorean theorem applied to the triangle whose legs are the differences of the x and y values. Since the differences are squared, the order of the points does not affect the result.

How do you calculate the coordinates of the midpoint?

Average the matching coordinates: xM = (x₁ + x₂)/2 and yM = (y₁ + y₂)/2. The midpoint always lies on the line through the endpoints and sits half the segment's length from each.

Can the distance come out negative?

Never. It is the square root of a sum of squares, so it is zero or positive. If you get a negative number you have a sign error or you forgot to square one of the differences.

How this calculation works

Components: Δx = x₂ − x₁, Δy = y₂ − y₁. Distance: d = √(Δx² + Δy²). Midpoint: M = ((x₁+x₂)/2; (y₁+y₂)/2). Slope of the segment: m = Δy/Δx, undefined when Δx = 0. Direction: θ = atan2(Δy; Δx), measured from P₁ towards P₂ and reported in [0°; 360°). Reflection of P₁ about P₂: P′ = (2x₂ − x₁; 2y₂ − y₁), the point that has P₂ as its midpoint with P₁.