The distance between two points is the length of the straight segment joining them. In Cartesian coordinates, horizontal and vertical changes form perpendicular legs of a right triangle. Their signs disappear after squaring, but the distance itself is always nonnegative.
Build the distance formula from Pythagoras
Subtract the x-coordinates and the y-coordinates in a consistent order, square both differences, add and take the nonnegative square root. The formula works for every pair of points in the plane, including horizontal and vertical pairs.
If one coordinate is equal, the corresponding difference is zero and the calculation reduces to the absolute difference of the other coordinates. Coincident points have distance zero. Reversing the point order leaves the distance unchanged.
Worked example: A(2, 3) and B(3, 1)
The horizontal change is 1 and the vertical change −2. Their squares are 1 and 4, so the distance is the square root of 5, not the square root of 2. Keep the exact root before rounding.
Extend the same reasoning to three dimensions
Add the square of the z-coordinate difference under the same square root. Pythagoras is applied first in a plane and then to the remaining perpendicular direction.
For A(1, 2, 3) and B(4, 3, 1), the coordinate changes are 3, 1 and −2. Their squared sum is 14.
If both z-coordinates are zero, the points still belong to three-dimensional space but lie in its coordinate plane. The two-dimensional formula then gives the same result.
Move point B in the coordinate plane
Point A stays at (2, 3). Move B with the sliders to compare the straight distance with its horizontal and vertical components.
Coordinates must use compatible units and perpendicular axes. This Euclidean formula does not directly measure routes along streets or distances from latitude and longitude. Compare separation with a line’s slope, which describes direction rather than length.
