For students who already know the **Pythagorean Theorem**, calculating the distance between two points is no more than applying this theorem. If we take any two points and with them we imagine a third point, so that all three form a right triangle, the calculation of the distance between the first two points, correspond to calculate the value of the hypotenuse of that triangle. Thus, by solving the **Pythagoras Theorem** in order to hypotenuse, we obtain the following formula: `d = sqrt ((x_2-x_1) ^ 2 + (y_2-y_1) ^ 2)`. In this case `x_2 - x_1` represents one of triangle's legs and` y_2 - y_1` represents the other leg.

Created with GeoGebra by Vitor Nunes

You can move the **A** and **B** points and see how the formula gives us the value of the distance between these two points.

If the line segment is exactly vertical or horizontal, the formula above will still work fine, but there is an easier way. For a horizontal line, its length is the difference between the x-coordinates. For a vertical line its length is the difference between the y-coordinates. The Pythagorean Theorem is perhaps one of the most useful formulas you will learn in mathematics because there are so many applications of it in real world settings. Architects and engineers use this formula extensively when building ramps, bridges, and buildings.