# The Distance Formula

Want practice with preliminary concepts first?

*the Distance Formula*: $$ \cssId{s7}{\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}} $$

Here, $\,x_1\,$ (read as ‘$\,x\,$ sub $\,1\,$’) denotes the $\,x$-value of the first point, and $\,y_1\,$ (read as ‘$\,y\,$ sub $\,1\,$’) denotes the $\,y$-value of the first point. Similarly, $\,x_2\,$ and $\,y_2\,$ denote the $\,x$-value and $\,y$-value of the second point.

This formula involves differences (subtraction problems) that are squared. Notice that $\,(a-b)^2\,$ is equal to $\,(b-a)^2\,$. Why? Firstly, $\,a-b\,$ and $\,b-a\,$ are opposites, since $\,a - b = (-1)(b - a)\,.$ Secondly, when you square a number and its opposite, you get the same result.

Alternatively, you could FOIL both out and observe that they're the same:

$$ \begin{align} \cssId{s21}{(a-b)^2}\ &\cssId{s22}{= (a-b)(a-b)}\cr &\cssId{s23}{= a^2 - ab - ab + b^2}\cr &\cssId{s24}{= a^2 - 2ab + b^2}\cr\cr \cssId{s25}{(b-a)^2}\ &\cssId{s26}{= (b-a)(b-a)}\cr &\cssId{s27}{= b^2 - ab - ab + a^2}\cr &\cssId{s28}{= a^2 - 2ab + b^2} \end{align} $$Thus, in the Distance Formula, you can do the subtractions in any order you want, and it won't affect your result. Also, because of the Commutative Property of Addition, you can work with the $\,x\,$ or $\,y\,$ values first—your choice. That is, $$ \begin{align} &\cssId{s33}{\sqrt{(x_2-x_1)^2 + (y_2-y_1)^2}}\cr &\quad \cssId{s34}{= \sqrt{(y_2-y_1)^2 + (x_2-x_1)^2}} \end{align} $$

In words, to find the distance between two points, do the following:

- Subtract the $\,x$-values of the two points (in any order), and square this result.
- Subtract the $\,y$-values of the two points (in any order), and square this result.
- Add together the previous two quantities.
- Take the square root of the result.

The Distance Formula follows easily from the Pythagorean Theorem, as suggested by the picture below:

By the Pythagorean Theorem, $$ \cssId{s42}{{\text{hypotenuse}}^2} \cssId{s43}{= (x_2-x_1)^2 + (y_2-y_1)^2} $$ Solve for the hypotenuse!

## Examples

Note: When the number inside a square root has a factor that is a perfect square, then it can be renamed. For example, $\,4\,$ goes into $\,8\,$ evenly, and $\,4\,$ is a perfect square. Thus, we can rename as follows: $$ \cssId{s72}{\sqrt{8}} \cssId{s73}{= \sqrt{4\cdot 2}} \cssId{s74}{= \sqrt{4}\sqrt{2}} \cssId{s75}{= 2\sqrt{2}} $$ In the solutions to this web exercise, both names ($\,\sqrt{8}\,$ and $\,2\sqrt{2}\,$) are given.