Analytic (Coordinate) Geometry

the distance formula

How far apart are two points whose addresses you know? If a friend is at (1, 1) and you are at (4, 5), you cannot just subtract the numbers — you need the straight-line distance across the plane. The distance formula answers this, and it is nothing but the Pythagorean theorem wearing coordinates.

Here is the picture. Given P_1 = (x_1, y_1) and P_2 = (x_2, y_2), draw the segment between them, then complete a right triangle by going horizontally and then vertically. The horizontal leg has length |x_2 - x_1| (the change in x), the vertical leg has length |y_2 - y_1| (the change in y), and the segment P_1 P_2 is the hypotenuse. Pythagoras says hypotenuse squared = leg squared + leg squared, so the distance d satisfies d^2 = (x_2 - x_1)^2 + (y_2 - y_1)^2, giving d = sqrt((x_2 - x_1)^2 + (y_2 - y_1)^2). For our example, d = sqrt((4 - 1)^2 + (5 - 1)^2) = sqrt(9 + 16) = sqrt(25) = 5.

Because the differences are squared, it does not matter which point you call first — (x_2 - x_1)^2 equals (x_1 - x_2)^2 — so distance has no direction, only size, and is never negative. This single formula underlies the equation of a circle (all points a fixed distance from a center), tests for which triangle is which, and almost every measurement in coordinate geometry. The same recipe stretches to space: in three dimensions you simply add (z_2 - z_1)^2 under the root.

Is the triangle with vertices A(0, 0), B(6, 0), C(3, 4) isosceles? Compute |AC| = sqrt(3^2 + 4^2) = 5 and |BC| = sqrt((3-6)^2 + 4^2) = sqrt(9 + 16) = 5. Two sides equal — yes, it is isosceles.

The distance formula turns 'measure the sides' into pure arithmetic.

Keep the subtractions inside the squares; squaring first cannot fix a sign error if you instead wrote |x_2| - |x_1|. The correct legs are differences x_2 - x_1 and y_2 - y_1, then squared.

Also called
distance between two points兩點間距離公式