0 energy points

# Point distance to plane

Distance between a point and a plane in three dimensions. Created by Sal Khan.
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.