The distance between two points

The distance between two points in the coordinate plane comes from the Pythagorean theorem. Here we find the distance between A(1,2)A(1, 2) and B(4,6)B(4, 6).

Going from AA to BB moves 41=34 - 1 = 3 across and 62=46 - 2 = 4 up. Taking these horizontal and vertical differences as the two legs of a right triangle, the segment joining AA and BB is its hypotenuse. By the Pythagorean theorem,

AB=32+42=9+16=25=5AB = \sqrt{3^2 + 4^2} = \sqrt{9 + 16} = \sqrt{25} = 5

so the distance is 55.

In general, the distance between two points (x1,y1)(x_1, y_1) and (x2,y2)(x_2, y_2) is given, using the horizontal difference x2x1x_2 - x_1 and the vertical difference y2y1y_2 - y_1, by the following.

(x2x1)2+(y2y1)2\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}

Because the differences are squared, it does not matter if x2x1x_2 - x_1 is negative. The large dots on the graph are A(1,2)A(1, 2) and B(4,6)B(4, 6), and the length of the segment joining them is the distance 55 we found.