# Distance Formula

### Distance Between Two Points

The distance between two points with the same $x$- or $y$-coordinate is the length of a horizontal or vertical line segment connecting those points. This can be found by counting grid squares or subtracting the coordinates that are not equal.
The distance between two points on a number line is the absolute value of the difference between the endpoints.
On the coordinate plane, the same principle is applied when the $x$-coordinates or the $y$-coordinates of two points are equal.

The distance between pairs of points can be found by subtracting the coordinates or by counting squares on the grid.

### The Distance between Points with an Identical Coordinate

$A (5, 11)$ and $B (5, -4)$ $A (-3, 3)$ and $B (5, 3)$
The $x$-values are equal. So, the distance between the points along the $y$-axis is $|-4-11|=15$ units. The $y$-values are equal. So, the distance between the points along the $x$-axis is $|5-(-3)|=8$ units.

There are two ways to determine the distance between two points with the same coordinate: subtracting the coordinates that are not the same or counting the number of units from the first point to the second point.

### Using the Pythagorean Theorem to Find Distance

The distance between two points that do not have the same $x$- or $y$-coordinate can be found by drawing a right triangle with the line segment between the points as the hypotenuse and using the Pythagorean theorem.
For two points in a plane that do not have equal $x$- or $y$-coordinates, the distance between the points can be found by using the Pythagorean theorem: If $a$ and $b$ are the legs of a right triangle and $c$ is the hypotenuse, then:
$a^2+b^2=c^2$
First, sketch a right triangle. The line segment joining the two points is the hypotenuse, while horizontal and vertical line segments form the legs. Then apply the Pythagorean theorem to find the length of the hypotenuse.
Step-By-Step Example
Using the Pythagorean Theorem
Determine the distance between point $A$ $(-3, 13)$ and point $B$ $(5, -2)$ using the Pythagorean theorem.
Step 1
Plot point $A$ and point $B$. Then draw a right triangle to locate point $C$ $(-3, -2)$ to draw a right triangle.
Step 2

Determine the length of the horizontal leg, or line segment $a$, of the triangle.

Point $B$ $(5,-2)$ and point $C$ $(-3, -2)$ have the same $y$-coordinates. So, calculate the distance between the $x$-coordinates or count the number of squares between the points.
\begin{aligned}{\text{Line segment}}\;a &= |x_{2}-x_{1}|\\&=|5-(-3)|\\&=|5+3|\\&=|8|\end{aligned}
Step 3

Determine the length of the vertical leg, or line segment $b$, of the triangle.

Point $A$ $(-3,13)$ and point $C$ $(-3, -2)$ have the same $x$-coordinates. So, calculate the distance between the $y$-coordinates or count the number of squares between the points.
\begin{aligned}{\text{Line segment}}\;b &= |y_{2}-y_{1}|\\&=|13-(-2)|\\&=|13+2|\\&=|15|\end{aligned}
Step 4
Use the Pythagorean theorem:
$a^2+b^2=c^2$
Line segment $a$ is 8 units. Line segment $b$ is 15 units.

The hypotenuse of the triangle, line segment $c$, is the distance between the points.

Substitute the lengths of each leg in the theorem:
\begin{aligned}a^{2}+b^{2}&=c^{2}\\ 8^{2}+15^{2}&=c^{2} \\ 64+225&=c^{2} \\ 289&=c^{2}\\ \sqrt{289}&=c\\17&=c\end{aligned}
Solution
The distance between point $A$ $(-3, 13)$ and point $B$ $(5, -2)$ is 17 units.

### Deriving and Applying the Distance Formula

Using a right triangle, a formula can be derived for the distance between any two points in the coordinate plane.
The distance formula is used to calculate the distance between the points $A$ $(x_2, y_2)$ and $B$ $(x_1, y_1)$ in the coordinate plane. The distance formula is derived from the Pythagorean theorem. For a right triangle $\Delta ABC$ with hypotenuse $\overline{AB}$, the lengths of the horizontal and vertical legs are:
\begin{aligned} |x_{2}-x_{1}|\\ |y_{2}-y_{1}|\end{aligned}
Substitute the lengths of the legs into the Pythagorean theorem. Let $d$ represent the distance between the two points, or the hypotenuse, line segment $c$.
$d^2=|x_{2}-x_{1}|^{2}+|y_{2}-y_{1}|^{2}$
Then take the square root of both sides of the equation to get the distance formula.
$d=\sqrt{(x_{2}-x_{1})^{2}+(y_{2}-y_{1})^{2}}$
Since the squared values are always positive, the absolute-value signs are no longer needed.
Step-By-Step Example
Using the Distance Formula
Calculate the distance between $A$ $(-3, 3)$ and $B$ $(9, -2)$ using the distance formula.
Step 1
Substitute the coordinates of the points in the distance formula.
\begin{aligned}d&=\sqrt{(x_{2}-x_{1})^{2}+(y_{2}-y_{1})^{2}} \\ &=\sqrt{[(9-(-3)]^{2}+(-2-3)^{2}} \end{aligned}
Step 2
Simplify the equation.
\begin{aligned}d&=\sqrt{(9+3)^{2}+(-5)^{2}}\\ &=\sqrt{12^{2}+25}\\&=\sqrt{144+25}\\&=\sqrt{169}\\&=13\end{aligned}
Solution
The distance between point $A$ $(-3, 3)$ and point $B$ $(9, -2)$ is 13 units.