The Distance Formula

Introduction

We use what's known as the distance formula to learn the distance between any two points in space. Suppose you need to determine the distance between the points (2,0) and (5,0). Here's how they look on a graph:

First example showing point (2,0) and (5,0)

With just a quick glance, you can tell they are 3 units apart. They're both on the x axis, so it's just a straight line measurement. In fact, you may not have even needed the graph at all to figure that one out. But, how can you measure the distance between two random points on a graph? Why, use the distance formula of course!

[tex]\text{distance}= \sqrt{\big(x_{2}-x_{1}\big)^2+\big(y_{2}-y_{1}\big)^2}[/tex]

Breaking it down

At first glance, that formula looks like a real mess! But just think about the [tex]x_{2}-x_{1}[/tex] and [tex]y_{2}-y_{1}[/tex] as the length in each direction. Using those two values we mathematically construct an imaginary triangle with two legs whose length we can calculate. Let me show you what I mean visually:

graphical description

We're just measuring the distance along each axis, and then using the pythagorean theorem to compute the length of the hypotenuse, which is the imaginary line directly between our two points. It doesn't matter which point is [tex](x_{1},y_{1})[/tex] and which is [tex](x_{2},y_{2})[/tex]. The key idea to get from this plot is that you only care about the change in x and the change in y. You'll use each of those measurements as the side of a triangle, where the hypotenuse is the distance between the two points. You could express the distance formula like this:

[tex]\text{distance}= \sqrt{\big(\text{change in x}\big)^2+\big(\text{change in y}\big)^2}[/tex]

How did we come up with that formula? It's simply the pythagorean theorem, which allows us to find the hypotenuse of a right triangle. In our case, the hypotenuse is the distance between the two points!

Let's look at a simple example now:

Example:

Find the distance between the two points (5,5) and (1,2) by using the distance formula.

Solution:

Rather than blindly plugging numbers into a formula, draw a graph so you know what's going on.

distance between two points

Those are your two points. Remember that the important values are the change in x and the change in y. That's equivalent to saying, what is x2-x1 and what is y2-y1.

Here, the change in x is 4 units, and the change in y is 3 units. You can even count the lines on the graph to make sure that's correct.

[tex]\text{distance}= \sqrt{\big(4\big)^2+\big(3\big)^2}[/tex]

[tex]\text{distance}= \sqrt{16+9}[/tex]

[tex]\text{distance}= \sqrt{25}[/tex]

[tex]\text{distance}= 5[/tex]

Once we knew that [tex]x_{2}-x_{1}[/tex] was 4 and [tex]y_{2}-y_{1}[/tex] was 3, we just inserted those numbers into the distance formula to solve.

You might be wondering what happens if you switch the points? Remember that we are dealing with distances, which are inherently positive. The distance is the same in eiter direction, going from point 1 to point 2 or vice versa. So, just use the positive distance between two points. If you look at the formula, you'll notice that [tex]x_{2}-x_{1}[/tex] and [tex]y_{2}-y_{1}[/tex] are squared, which automatically makes them positive anyway. So it doesn't matter which point is which -- you'll still get a positive distance!

Let's look at another example and solve it without using a graph:

Example:

Find the distance between the two points (8,-2) and (3, 9).

Solution:

Now that you understand how the distance formula works, you can plug the numbers straight into the formula:

[tex]\text{distance}= \sqrt{\big(8-3\big)^2+\big(-2-9\big)^2}[/tex]

[tex]\text{distance}= \sqrt{25+121}[/tex]

[tex]\text{distance}= \sqrt{146}[/tex]

[tex]\text{distance}= 12.08[/tex]

The distance formula is not complicated -- you just need to practice with a graph so you understand what's going on. You're simply making a triangle and finding the length of the hypotenuse. The distance formula is just the pythagorean theorem!

What about a three-dimensional space? How would we find the distance between the points (1,5,0) and (2,0, 8)? It's certainly a lot harder to draw a graph and measure the distance! The three-dimensional distance formula is actually super simple. Just add another term into the formula because we have to account for the z-axis now.

[tex]\text{distance}= \sqrt{\big(x_{1}-x_{2}\big)^2+\big(y_{2}-y_{1}\big)^2+\big(z_{2}-z_{1}\big)^2}[/tex]

If you've made it this far, hopefully you have a better understanding of the distance formula. If that's not the case, here's another distance formula lesson available online.

image of student looking for math help

Interactive problem solver: