Main content

### Course: Linear algebra > Unit 1

Lesson 5: Vector dot and cross products- Vector dot product and vector length
- Proving vector dot product properties
- Proof of the Cauchy-Schwarz inequality
- Vector triangle inequality
- Defining the angle between vectors
- Defining a plane in R3 with a point and normal vector
- Cross product introduction
- Proof: Relationship between cross product and sin of angle
- Dot and cross product comparison/intuition
- Vector triple product expansion (very optional)
- Normal vector from plane equation
- Point distance to plane
- Distance between planes

© 2024 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Point distance to plane

Distance between a point and a plane in three dimensions. Created by Sal Khan.

## Want to join the conversation?

- Where can I practice? I feel like the materials I absorbed previously faded away after a new lesson(19 votes)
- how come there can be no negative distance i mean is it possible or would the answer end up just being no solution or zero? @-@ (confused face)(12 votes)
- distance should be seen in absolute terms there is no direction to it

it can be measured in some direction but itself has no direction in particular(4 votes)

- At4:42,It is said that the angle between vector f and d is same as that of vector f and normal vector n.How?(10 votes)
- d is the smallest distance between the point (x0,y0,z0) and the plane. to have the shortest distance between a plane and a point off the plane, you can use the vector tool. This vector will be perpendicular to the plane, as the normal vector n. So you can see here thar vector n and pseudovector d have the same direction but not necessary the same magnitude, because n could have all the magnitude, on the contrary, the magnitude of d is fixed by the magnitude and the dircetion of f. So given that d and n have same directions, and n is not FIXED (it's a vector), the angle is the same, sorry for my English, hope it will help you(5 votes)

- Since the method for deriving this formula takes advantage of the dot product (as opposed to the cross product), does that imply this point distance to plane formula can be generalized to N-dimensions?(7 votes)
- I do not know if this answers your question but.

The plane formula Ax + By +Cz +D = 0 only works in R3.

But the parameter form of a plane works in all Rn dimensions.

Similarly, The form of a line: ax +by + c = 0 only works for R2.

But the parameter form of a line works in all Rn.(5 votes)

- Why is the cross product defined only for R3?(5 votes)
- Can anyone point out why this formula is very similar to the point-line distance formula: | ax+by+c | / Sqrt(a^2 + b^2) ?(3 votes)
- The equation of a line in R^2 is the equation of a plane in R^3. Namely
`mx+b = y`

is a plane in R^3 since z isn't constrained by that equation.(5 votes)

- At around the 3.5 minute mark (around3:33), Sal writes magnitude as "|f|". This pattern continues and later on at5:25, he does something similar when depicting the magnitude of the normal vector. Should it not have a double pipe on both sides as in "||f||"? This is how it was described in earlier videos.(3 votes)
- Yeah, he probably should have, if only to be consistent with his notation. But, to be honest, there's no reason I know of that the ||
**v**|| notation for vector magnitude should be different from the | x | notation for absolute value. Actually, when I learned it, my professor told us to use the single bar notation throughout unless we were working with someone who would be fussy over unimportant details, so he probably didn't know a good reason either. ^_^(4 votes)

- is normal vector a kinda position vector?(2 votes)
- Normal vector is really a direction vector (as it specifies the
**direction**from a location), not a position vector.(5 votes)

- Sal starts using the vector notation x = a(i hat) + b(j hat) + c(k hat) rather than the big bracket vertical notation used in the previous videos. Is there a video where he explains this new notation?(3 votes)
- There is. It seems to be brand new (didn't exist when you asked the question). It's at Linear Algebra -> Vectors and Spaces -> Vectors -> Unit vector notation(1 vote)

- I got the same formula using another way that seemed more straightforward to me:

1. Vector p0 is the position of an arbitrary point in R3.

3. Nonzero vector n and scalar D define a plane formed by all position vectors p such that n*p=D (this is equivalent to ax+by+cz=D if you do the dot-multiplication of n=[a,b,c] and p=[x,y,z]).

4. p1 is the position vector of the closest point on the plane to p0.

5. d is the vector that goes from p1 to p0.

6. Because of 4 and 5, we know that d must be parallel to n.

7. Because of 6, d=kn for some scalar k.

8. From 7, take length of each side: |d|=k|n|. !This is what we're looking for!

9. Because of 5, d=p0-p1.

10. Substitute 7 into 9: kn=p0-p1

11. From 10, add (p1-kn) to each side: p1=p0-kn.

12. 4 tells us that p1 is on the plane defined in 3, so n*p1=D.

13. Substitute 11 into 12: n*(p0-kn)=D.

14. From 13, distribute: n*p0-kn*n=D.

15. Any vector dot itself is its length squared, so 14 becomes n*p0-k|n|^2=D.

16. From 15, add (k|n|^2-D) to each side: n*p0-D=k|n|^2.

17. From 16, divide each side by |n|: (n*p0-D)/|n|=k|n|.

18. Substitute 8 into 17: (n*p0-D)/|n|=|d|.

And that's it! We've solved for the shortest distance between an arbitrary point and an arbitrary plane.

If you like, you can expand the convert all the vectors to scalars to get exactly Sal's formula:

n=[a,b,c]

p0=[x0,y0,z0]

([a,b,c)]*[x0,y0,z0]-D)/|(a,b,c)|=|d|

(ax0+by0+cz0-D)/sqrt(a^2+b^2+c^2)=|d|(3 votes)- You're the best! What I'm seeking, I find comfort(2 votes)

## Video transcript

What I want to do
in this video is start with some point
that's not on the plane, or maybe not necessarily
on the plane. So let me draw a
point right over here. And let's say the coordinates
of that point are x 0 x sub 0, y sub 0, and z sub 0. Or it could be specified
as a position vector. I could draw the position
vector like this. So the position vector-- let
me draw a better dotted lines. The position vector for this
could be x0i plus y0j plus z0k. It specifies this
coordinate right over here. What I want to do
is find the distance between this point
and the plane. And obviously, there could
be a lot of distance. I could find the distance
between this point and that point, and this
point and this point, and this point this point. And when I say I want
to find the distance, I want to find the
minimum distance. And you're actually going to
get the minimum distance when you go the perpendicular
distance to the plane, or the normal
distance to the plane. And we'll, hopefully,
see that visually as we try to figure out how
to calculate the distance. So the first thing we can
do is, let's just construct a vector between
this point that's off the plane and some
point that's on the plane. And we already have a point
from the last video that's on the plane, this x
sub p, y sub p, z sub p. So let's construct
a vector here. Let's construct this
orange vector that starts on the plane, it's
tail is on the plane, and it goes off the plane. I want to do that in orange. It goes off the plane to
this vector, to this position x0 y0 z0. So how could we specify this
vector, right over here? Well, that vector, let
me call that vector, well, I'll just call that
vector, what letters have I'm not used yet? Let me call that vector f. Vector f is just going to
be this yellow position vector, minus this
green position vector. So it's going to
be, this x component is going to be the difference
of the x-coordinates, it's y-coordinate is going the
difference of the y-coordinate. S So it's going to
be x0 minus x sub p. I subtracted the
x-coordinates, i. Plus y0 minus ypj plus-- we'll
go to the next line-- plus z0 minus zp minus zpk. So fair enough. That's just some vector
that comes off of the plane and onto this point. But what we want to find
out is this distance. We want to find out
this distance in yellow, the distance that if I were
take a normal off of the plane and go straight to
the point, that's going to be the
shortest distance. And actually, you can
see it visually now. Because if look at-- we can
actually form a right triangle here-- so this base of the right
triangle is along the plane. This side is normal
to the plane. So this is a right angle. And you can see, if I take
any point, any other point on the plane, it will form a
hypotenuse on a right triangle. And obviously the shortest
side here, or the shortest way to get to the
plane, is going to be this distance, right here,
as opposed to the hypotenuse. This side will always be
shorter than that side. So given that we know
this vector here, how can we figure
out this length here? How can we figure out
this length here in blue? Well, we could figure out
the magnitude of this vector. So the length of
this side right here is going to be the
magnitude of the vector, so it's going to be the
magnitude of the vector f. That'll just give
us this length. But we want this blue length. Well, we could think about it. If this was some angle-- I know
the writing is getting small. If this was some angle theta, we
could use some pretty straight up, pretty straightforward
trigonometry. If the distance
under question is d, you could say cosine of theta
is equal to the adjacent side over the hypotenuse. Or is is equal to d-- d
is the adjacent side-- is equal to d over the hypotenuse. Well, the hypotenuse is the
magnitude of this vector. It's the magnitude
of the vector f. Or we could say the
magnitude of the vector f times the cosine of
theta-- I'm just multiplying both sides times the magnitude
of vector x-- f is equal to d. But still you might say, OK,
well Sal, we know what f is. We can figure that out. We can figure out its magnitude. But we don't know what theta is. How do we figure out what theta? And to do that, let's just
think about it a little bit. This angle, this angle of
theta, is the same angle. So this distance here
isn't necessarily the same as the length
of the normal vector. But it's definitely going
in the same direction. So this angle here, is
really the same thing as the angle between this
vector and the normal vector. And so you might remember
from earlier linear algebra, when we talk about the dot
product of two vectors, it involves something
with the cosine of the angle between them. And to make that fresh
in your mind, let's multiply and divide both sides. Let me multiply and divide
the left side of this equation by the magnitude of
the normal vector. So I'm obviously not
changing its value. I'm multiplying and
dividing by the same number. So I'm going to multiply by the
magnitude of the normal vector. And I'm going to divide by the
magnitude of the normal vector. So I'm just essentially
multiplying by 1. So I have not changed this. But when you do it in
this, it might ring a bell. This expression up here,
this expression right here, is the dot product of the
normal vector and this vector right here, f. So this right here
is the dot product. This is n dot f, up there. It's equal to the product
of their magnitudes times the cosine of
the angle between them. So the distance, that shortest
distance we care about, is a dot product between this
vector, the normal vector, divided by the magnitude
of the normal vector. So let's do that. Let's take the dot product
between the normal and this. And we already figured
out, in the last video, the normal vector, if you
have the equation of a plane, the normal vector is
literally, its components are just the coefficients
on the x, y, and z terms. So this is a normal
vector right over here. So let's literally
take the dot product. So n dot f is going to be
equal to A times x0 minus xp. I'll do that in pink. So it'll be Ax0 minus Axp. And then plus B times
the y component here. So plus By0. I'm just distributing
the B, minus Byp. And then plus-- I'll
do another color here, that's too close of a color--
plus C times the z component. So plus Cz0 minus Czp. And all of that over the
magnitude of the normal vector. So what's the magnitude of
the normal vector going to be? It's just the square
root of the normal vector dotted with itself. So it's just each of these
guys squared added to themself, and you're taking
the square root. So it's the square
root-- maybe I can do a nicer looking radical
sign than that-- of A squared plus B squared plus C squared. Now, what is this up
here simplified to? Let me just rewrite this. So this is the
distance in question. This right here is
equal to the distance. But let's see if
we can simplify it. So first, we can take all
of the terms with the x0. These involve the point
that sits off the plane. Remember, x0, y0, z0
sat off the plane. So this is Ax0
plus By0 plus Cz0. And then what are
these terms equal to? What are these terms? Negative Axp minus
Byp minus Czp? Well, if you remember
here, D in the equation of in the equation
of a plane, D, when we started
in the last video when we tried to figure out
what the normal to a plane is, D is-- if this point
xp sits on the plane-- D is Axp plus Byp plus Czp. Or another way you
could say it is, negative D would be
negative A-- and it's just the difference between lowercase
and uppercase here, right? We're saying that lowercase is
the same as this uppercase A. So it's negative Axp
minus Byp minus Czp. I'm just using what we
got from the last video. This is what D is so negative
D will be this business. And that's exactly
what we have over here. We have negative Axp
negative Byp negative Czp. So all of this term,
this term, and this term simplifies to a minus D. And
remember, this negative capital D, this is the D from the
equation of the plane, not the distance d. So this is the numerator
of our distance. And then the denominator
of our distance is just the square root of A
squared plus B squared plus C squared. And we're done. This tells us the distance
between any point and a plane. And this is a pretty
intuitive formula here. Because all we're
doing, if I give you-- let me give
you an example. Let's say I have the plane. If I have the plane 1x minus
2y plus 3z is equal to 5. So that's some plane. And let me pick some point
that's not on the plane. So let's say I have the point,
I don't know, let me say I have the 2, 2, 3. And let me make sure
it's not on the plane. So it's 2 minus 6 is
negative-- yeah, so this won't. Let me just pick a random 1. So this definitely
is not on the plane, because we have
2 minus 6 plus 3. That gives us negative
1, which is not 5. So this is definitely
not on the plane. We can find the distance
between this point and the plane using the formula
we just derived. We literally just evaluate at--
so this will just be 1 times 2. Let me use that same color. 1 times 2 minus 2
times-- I'm going to fill it in-- plus 3
times something, minus 5. All of that over, and I
haven't put these guys in. Let me do that right now. So 1 times 2 minus 2
times 3 plus 3 times 1. This 1 minus 5, you're
kind of bringing it over to the left hand side. All of that over
the square root of 1 squared, which is
1, plus negative 2 squared, which is 4, plus
3 squared, which is 9. So it's going to be equal to,
let's see, this is 2 minus 6, or negative 6. And then you have plus 3. And then minus 5. So this is what? This is 5. 2 plus 3 is 5 minus 5. So those cancel out. So this is negative 6. So it's equal to negative
6 over the square root of 5 plus 9 is 14. Over the square root of 14. And you're done. So hopefully, you
find that useful. And hopefully, we can apply this
in the other example problems.