# The Distance Formula

You know that the distance $AB$ between two points in a plane with Cartesian coordinates $A\left({x}_{1},{y}_{1}\right)$ and $B\left({x}_{2},{y}_{2}\right)$ is given by the following formula:

$AB=\sqrt{{\left({x}_{2}-{x}_{1}\right)}^{2}+{\left({y}_{2}-{y}_{1}\right)}^{2}}$

The distance formula is really just the Pythagorean Theorem in disguise.

To calculate the distance $AB$ between point $A\left({x}_{1},{y}_{1}\right)$ and $B\left({x}_{2},{y}_{2}\right)$ , first draw a right triangle which has the segment $\stackrel{¯}{AB}$ as its hypotenuse.

If the lengths of the sides are $a$ and $b$ , then by the Pythagorean Theorem,

${\left(AB\right)}^{2}={\left(AC\right)}^{2}+{\left(BC\right)}^{2}$

Solving for the distance $AB$ , we have:

$AB=\sqrt{{\left(AC\right)}^{2}+{\left(BC\right)}^{2}}$

Since $AC$ is a horizontal distance, it is just the difference between the $x$ -coordinates: $|\left({x}_{2}-{x}_{1}\right)|$ . Similarly, $BC$ is the vertical distance $|\left({y}_{2}-{y}_{1}\right)|$ .

Since we're squaring these distances anyway (and squares are always non-negative), we don't need to worry about those absolute value signs.

$AB=\sqrt{{\left({x}_{2}-{x}_{1}\right)}^{2}+{\left({y}_{2}-{y}_{1}\right)}^{2}}$

Example:

Find the distance between points $A$ and $B$ in the figure above.

In the above example, we have:

$A\left({x}_{1},{y}_{1}\right)=\left(-1,0\right),B\left({x}_{2},{y}_{2}\right)=\left(2,7\right)$

so

$\begin{array}{l}AB=\sqrt{{\left(2-\left(-1\right)\right)}^{2}+{\left(7-0\right)}^{2}}\\ \text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}=\sqrt{{3}^{2}+{7}^{2}}\\ \text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}=\sqrt{9+49}\\ \text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}\text{\hspace{0.17em}}=\sqrt{58}\end{array}$

or approximately $7.6$ units.