Main content

## Get ready for Precalculus

### Unit 5: Lesson 5

Distance formula# Distance formula

CCSS.Math:

Learn how to find the distance between two points by using the distance formula, which is an application of the Pythagorean theorem. We can rewrite the Pythagorean theorem as d=√((x_2-x_1)²+(y_2-y_1)²) to find the distance between any two points. Created by Sal Khan and CK-12 Foundation.

## Want to join the conversation?

- OK, this helps a lot, but what about when the triangle does not have a right angle and it's an isosceles triangle or any other triangle?(68 votes)
- when dealing with graphs, this is automatically a right triangle. trig can (with a little geometry) be applied to acute or obtuse triangles.(25 votes)

- What should you do when you are asked to find the distance between a point and a liner equation?(17 votes)
- To be a bit more detailed:

1) You solve the original line equation for y if it isn't already.

2) The perpendicular line to that will be the most direct route to your point. Just take the negative inverse (if your line has a slope of 2, the negative inverse is -1/2). Which will be the slope of your perpendicular line.

3) To find the y-intercept of the perpendicular line you align it with the point you are given (if you have P(2|3) and a slope of -1/2 you can solve y=mx+c for c: 3=-1/2*2+c => c=4 and the perpendicular line will be y=-1/2x+4)

4) Then setting both lines equal you can find out where they intersect, which gets you the second point.

5) Finally you can find out the distance with Pythagoras with the distance between the points as the hypotenuse.

That's the mechanics. If you understand why you do that you have figured out almost all about linear equations.(25 votes)

- What is delta? (To be a little more specific.)(15 votes)
- Delta is a greek letter that in this case stands for change.

Delta x is the change in x. If the first point (3, 1) and the second point is (1,1), then delta x is the change in x is 3-1 or 2. Delta y is the change in y is 1=1 or 0.(26 votes)

- What if the points end up in a straight line, what is the correct way of solving the remainder of the equation?(10 votes)
- Well, for example:

-2,1 and 5,1 will be a straight line. We could just say, 'Well the length is just the change in X, since its a straight line - thats 5 - -2 = 7.' However, we want to use the distance formula.

To use the formula we need the change in x and y, dx and dy:

The Change in x is 5 - -2 = 7, dx = 7.

The change in y is 1 - 1 = 0, dy = 0.

The formula is: sqareRoot((dx*dx)+(dy*dy)).

Plugging in values, squareRoot((7*7)+(0*0))

Simplifying: squareRoot(49)

And the squareRoot of 49 is 7, or only the change in X.

You can see that either dx or dy is 0, that is the line is perfectly vertical, the formula becomes overkill :)

Hope that helps!(30 votes)

- Can you also use rise-over-run for this?(5 votes)
- Rise over run is the formula that basically describes the slope. Slope can also be calculated using the y2 - y1 / x2 - x1 formula. However, the distance formula is different. It's used to describe the length of a line segment or the distance between 2 points. Since the two formulas are used for 2 completely different things, you wouldn't be able to replace one with the other.

Good question, though. Hope this made sense!(8 votes)

- Can someone please tell me what hypotenuse means?(0 votes)
- In geometry, a hypotenuse is the longest side of a right-angled triangle, which is the side opposite the right angle. The length of the hypotenuse of a right triangle can be found using the Pythagorean theorem, which states that the square of the length of the hypotenuse equals the sum of the squares of the lengths of the other two sides. For example, if one of the other sides has a length of 3 metres (when squared, 9 m²) and the other has a length of 4 m (when squared, 16 m²), then their square(11 votes)

- What about when one of the points is a
**variable**?(6 votes)- You can still use the formula, and simplify like you would any other algebraic expression.(4 votes)

- so the distance formula = the formula of pythagorean theorem, right? because pythagorean theorem = a^2 + b^2 = c^2 and distance = d^2 = (delta x)^2 + (delta y)^2 why do people call it the distance formula eve in my school its basically the pythagorean theorem right(5 votes)
- Yes, it is basically a slight variation of the pythagorean theorem. It provides for finding delta X and delta Y.(4 votes)

- Wait, Im stuck, how come the equation "d = √(x2 - x1) + (y2 - y1)" is the same thing as," d^2 = (∆y)^2 + (∆x)^2 ??(4 votes)
- Because the ∆y is the same as y2-y1 and vice versa with x(5 votes)

- isn't sq root of x^2+y^2=x+y(2 votes)
- Going backwards, (x+y)^2=x^2+2xy+y^2, so that is not correct because you are missing the middle term.(5 votes)

## Video transcript

In this video, we're going to
learn how to take the distance between any two points in our
x, y coordinate plane, and we're going to see, it's really
just an application of the Pythagorean theorem. So let's start with
an example. Let's say I have the point, I'll
do it in a darker color so we can see it on
the graph paper. Let's say I have the point
3 comma negative 4. So if I were to graph it,
I'd go 1, 2, 3, and then I'd go down 4. 1, 2, 3, 4, right there,
is 3 comma negative 4. And let's say I also have
the point 6 comma 0. So 1, 2, 3, 4, 5, 6, and then
there's no movement in the y-direction. We're just sitting
on the x-axis. The y-coordinate is 0,
so that's 6 comma 0. And what I want to figure out is
the distance between these two points. How far is this blue point away
from this orange point? And at first, you're like, gee,
Sal, I don't think I've ever seen anything about
how to solve for a distance like this. And what are you even talking
about the Pythagorean theorem? I don't see a triangle there! And if you don't see
a triangle, let me draw it for you. Let me draw this triangle right
there, just like that. Let me actually do several
colors here, just to really hit the point home. So there is our triangle. And you might immediately
recognize this is a right triangle. This is a right angle
right there. The base goes straight left to
right, the right side goes straight up and down, so we're
dealing with a right triangle. So if we could just figure out
what the base length is and what this height is, we could
use the Pythagorean theorem to figure out this long side, the
side that is opposite the right angle, the hypotenuse. This right here, the distance
is the hypotenuse of this right triangle. Let me write that down. The distance is equal
to the hypotenuse of this right triangle. So let me draw it a
little bit bigger. So this is the hypotenuse
right there. And then we have the side on the
right, the side that goes straight up and down. And then we have our base. Now, how do we figure
out-- let's call this d for distance. That's the length of
our hypotenuse. How do we figure out the lengths
of this up and down side and the base
side right here? So let's look at the base first.
What is this distance? You could even count it on this
graph paper, but here, where x is equal to-- let
me do it in the green. Here, we're at x is equal to 3
and here we're at x is equal to 6, right? We're just moving
straight right. This is the same distance as
that distance right there. So to figure out that distance,
it's literally the end x point. And you could actually go either
way, because you're going to square everything, so
it doesn't matter if you get negative numbers, so the
distance here is going to be 6 minus 3, right? 6 minus 3. That's this distance right here,
which is equal to 3. So we figured out the base. And to just remind ourselves,
that is equal to the change in x. That was equal to your finishing
x minus your starting x. 6 minus 3. This is our delta x. Now, by the same exact line of
reasoning, this height right here is going to be
your change in y. Up here, you're at
y is equal to 0. That's kind of where
you finish. That's your higher y point. And over here, you're at y
is equal to negative 4. So change in y is equal
to 0 minus negative 4. I'm just taking the larger
y-value minus the smaller y-value, the larger x-value
minus the smaller x-value. But you're going to see we're
going to square it in a second, so even if you did it
the other way around, you'd get a negative number, but
you'd still get the same answer, so this is equal to 4. So this side is equal to 4. You can even count it on the
graph paper if you like. And this side is equal to 3. And now we can do the
Pythagorean theorem. This distance is the
distance squared. Be careful. The distance squared is going
to be equal to this delta x squared, the change
in x squared plus the change in y squared. This is nothing fancy. Sometimes people will call this
the distance formula. It's just the Pythagorean
theorem. This side squared plus that
side squared is equal to hypotenuse squared, because
this is a right triangle. So let's apply it with these
numbers, the numbers that we have at hand. So the distance squared is going
to be equal to delta x squared is 3 squared plus
delta y squared plus 4 squared, which is equal to 9
plus 16, which is equal to 25. So the distance is equal to--
let me write that-- d squared is equal to 25. d, our distance, is equal to--
you don't want to take the negative square root, because
you can't have a negative distance, So it's only the
principal root, the positive square root of 25, which
is equal to 5. So this distance right
here is 5. Or if we look at this distance
right here, that was the original problem. How far is this point
from that point? It is 5 units away. So what you'll see here, they
call it the distance formula, but it's just the Pythagorean
theorem. And just so you're exposed to
all of the ways that you'll see the distance formula,
sometimes people will say, oh, if I have two points, if I have
one point, let's call it x1 and y1, so that's just
a particular point. And let's say I have another
point that is x2 comma y2. Sometimes, you'll see this
formula, that the distance-- you'll see it in
different ways. But you'll see that the distance
is equal to-- and it looks as though there's this
really complicated formula, but I want you to see that
this is really just the Pythagorean theorem. You see that the distance is
equal to x2 minus x1 minus x1 squared plus y2 minus
y1 squared. You'll see this written in
a lot of textbooks as the distance formula. And it's a complete waste of
your time to memorize it because it's really just the
Pythagorean theorem. This is your change in x. And it really doesn't matter
which x you pick to be first or second, because even if you
get the negative of this value, when you square it,
the negative disappears. This right here is
your change in y. So it's just saying that the
distance squared-- remember, if you square both sides of
this equation, the radical will disappear and this will
be the distance squared is equal to this expression
squared, delta x squared, change in x-- delta means change
in-- delta x squared plus delta y squared. I don't want to confuse you. Delta y just means
change in y. I should have probably said
that earlier in the video. But let's apply it to a couple
more, and I'll just pick some points at random. Let's say I have the point,
let's see, 1, 2, 3, 4, 5, 6. Negative 6 comma negative 4. And let's say I want to find the
distance between that and 1 comma 1, 2, 3, 4, 5, 6, 7, and
the point 1 comma 7, so I want to find this distance
right here. So it's the exact same idea. We just use the Pythagorean
theorem. You figure out this distance,
which is our change in x, this distance, which is
our change in y. This distance squared plus this
distance squared is going to equal that distance
squared. So let's do it. So our change in x, you
just take-- you know, it doesn't matter. In general, you want to take the
larger x-value minus the smaller x-value, but you
could do it either way. So we could write the distance
squared is equal to-- what's our change in x? So let's take the larger x minus
the smaller x, 1 minus negative 6. 1 minus negative 6 squared
plus the change in y. The larger y is here. It's 7. 7 minus negative 4. 7 minus negative 4 squared. And I just picked these numbers
at random, so they're probably not going to come
out too cleanly. So we get that the distance
squared is equal to 1 minus negative 6. That is 7, 7 squared, and you'll
even see it over here, if you count it. You go, 1, 2, 3, 4, 5, 6, 7. That's that number right here. That's what your
change in x is. Plus 7 minus negative 4. That's 11. That's this distance right here,
and you can count it on the blocks. We're going up 11. We're just taking 7 minus
negative 4 to get a distance of 11. So plus 11 squared is
equal to d squared. So let me just take the
calculator out. So the distance if we take 7
squared plus 11 squared is equal to 170, that distance is
going to be the square root of that, right? d squared
is equal to 170. So let's take the square root
of 170 and we get 13.0, roughly 13.04. So this distance right
here that we tried to figure out is 13.04. Hopefully, you found
that helpful.