The distance AB between two points with Cartesian coordinates A(x1, y1) and B(x2, y2) is given by the following formula:
The distance formula is really just the Pythagorean Theorem in disguise.
To calculate the distance AB between point A(x1, y1) and point B(x2, y2), first draw a right triangle which has the segment as its hypotenuse.
If the lengths of the sides are a and b, then by the Pythagorean Theorem,
(AB)2 = (AC)2 + (BC)2
Solving for the distance AB, we have:
Since AC is a horizontal distance, it is just the difference between the x-coordinates: |(x2 – x1)|. Similarly, BC is the vertical distance |(y2 – y1)|.
Since we're squaring these distances anyway (and squares are always non-negative), we don't need to worry about those absolute value signs.
Find the distance between points A and B in the figure above.
In the above example, we have:
A(x1, y1) = (–1, 0), B(x2, y2) = (2, 7)
or approximately 7.6 units.