# How is the pythagorean theorem related to the distance formula?

We generally define the distance between two points using the Pythagorean theorem.

Consider a two dimensional Cartesian coordinate system (the same ideas can be extended to any number of dimensions. The natural way to think about the geometry of this coordinate system is using vectors.

The distance $d \left(0 , P\right)$ between the origin $0$ and a certain point $P$ in the coordinate system is given by:

$d \left(0 , P\right) = \sqrt{{x}_{1}^{2} + {x}_{2}^{2}} ,$

where ${x}_{1}$ and ${x}_{2}$ are the coordinates (or, thinking of the point as a vector, the lengths of it's components) of the point.

Since the Cartesian system is orthogonal, the components of any vector in this space are orthogonal. Therefore, they form the two smaller sides of a right triangle, with the distance being the length of the hypothenuse of this triangle, wich can be seen as the vector joining $0$ and $P$. Using the Pythagorian theorem, we get the aforementioned distance formula.

For the distances between two points $P$ and $Q$, just consider the vector obtained from the difference between vectors joining the origin to those points and aply the Pythagorian theorem to that vector, which should give you:

$d \left(P , Q\right) = \sqrt{{\left({x}_{1} - {y}_{1}\right)}^{2} + {\left({x}_{2} - {y}_{2}\right)}^{2}} ,$

where ${y}_{1}$ and ${y}_{2}$ are the coordinates of the point $Q$.

In more advanced Maths, it's useful to think of the distance as a more general concept, and different definitions of distance can arise, leading to the theory of metric spaces .