For finding the distance d between two points (x1, y1) and (x2, y2) in a plane, a right triangle can be formed. The length of the vertical side of the triangle is the | y2 − y1| and the length of the horizontal side is |x2 − x1|. Then, from the pythagorean theorem:
d 2 = |x2 − x1| 2 + | y2 − y1| 2
Then, the distance d between the points (x1, y1) and (x2, y2) in a plane is:
d = √ | (x2 − x1)2 + ( y2 − y1)2 |