Vector dot and cross products
Defining a plane in R3 with a point and normal vector
Let's take a little bit of a hiatus from our more rigorous math where we're building the mathematics of vector algebra and just think a little bit about something that you'll probably encounter if you ever have to have to write a three-dimensional computer program or have to do any mathematics dealing with three dimensions. And that's the idea of just the equation of a plane in R3. And you know what a plane is. I mean we live in a three-dimensional world and we see planes all around us. The surface of your monitor, of your computer monitor is a plane, regardless of what angle you hold it at. And I can draw here in three dimensions. Let me do a little bit better job than that. So let's say that that is the x-axis. This is my y-axis. And then that's my z-axis. And we know what a plane looks like. it looks something like that. I'm just drawing it at an arbitrary angle and it goes off in every direction. Now, the equation of a plane-- and you've probably seen this before. It's a linear function of x, y and z. So it's ax plus by plus cz is equal to d. If this is the graph on that plane, then that means that every point on this plane, every x, y and z on this plane satisfies this equation. Now another way, just as valid a way to specify a point or specify a plane is to give you an actual point on the plane. So we'll say, look, that's the point on the plane. Let's say that this is the point x0, y0, and z0. It could be one of the instances of this point right here, but I'm just saying this is another point that's on the plane. That obviously by itself isn't going to specify the plane. You could pivot the plane around that point in an infinite number of ways. But if you specify that point and you specify a vector that's perpendicular to the plane-- and I can draw that starting from here, but I can shift a vector wherever. But let me just draw it right there. So if I also specify a normal vector to the plane. And I just used a word that I haven't defined for you yet. But when I say a normal vector, so n is a normal vector. Or which just means that it's perpendicular to the plane. It's perpendicular to everything on the plane. It's perpendicular to every vector on the plane. Perpendicular to, I guess the best way to say it, I'll just say it in very imprecise terms-- everything on the plane. So if you have some vectors lying on the plane, if I have some vector here, let's say that's lying on the plane. If you imagine the plane as a piece of cardboard, that yellow arrow I just drew-- I would've actually drawn that on the cardboard. It's sitting on the plane. If this yellow vector, let me call it vector a, then if this is just some arbitrary vector sitting on the plane and this is the normal vector through the plane, we know from our definition of vector angles that this is perpendicular to this if and only if, n dot a-- only if the dot product of these two things are equal to 0. And that's true for any vector that we pick that actually lies on the plane. So let's see if we can use this definition of a plane, if we can use the-- I'll call it the normal or let me call it the n plus-- let me do it this way. The n plus some x0, y0, z0 definition. And if I can go from that to just the standard linear equation definition, ax plus by plus cz is equal to 0. Let's see if there's some way based on what we already know and using this information that we can do that. So the way to think about it, this point, this little blue point that lies on the plane, I can specify it by a position vector. So let me set some position vector x0 to be equal to-- so I'm going to define x0 to be equal to the scalar x0, y0, z0. And I want to be very clear. This specifies the coordinate that lies on the plane. This vector does not lie entirely on the plane. The way I drew it right here, it's starting at the origin. It's a position vector. And the way I drew it it's behind the plane. The tip of its arrow sits on the plane. But this vector itself, it's not necessarily drawn on the plane. This plane might not even go through the origin, while this vector does touch on the origin. It just specifies some point on the plane. Similarly, let me define another vector. I said this was some other arbitrary point on the plane xyz, and so you know, this is true for any point on the plane. Let me define another vector x, and I'm going to define that as x, y, and z. So once again, like x0, the vector x-- let me draw it right there. This vector x does not lie on the plane. It goes from the origin. It's a position vector that specifies a point on the plane. So it goes from the origin and it goes out. And you can almost view them as if the plane was like a coffee table that this would kind of be these vectors. Let me see if I can draw it. If this was the flat surface of the plane that the vector x0 is going from the origin to specify some point on the plane. And then the vector x is also going from the origin to specify-- let me do it in a different color. The vector x is also going from the origin to specify some other point on the plane right there. I just took the plane and made it flat, so you see it right along its side. If you could imagine sitting right at the surface of the plane and then you could see that these guys clearly do not lie in the plane. But using these guys, I can construct a vector that does lie on the plane. What does the vector x minus x0 look like? Well, I just drew a little triangle here. x minus x0-- I'll do it in this green color. It'll look exactly like this. x minus x0 will be this green line right here. This is x minus x0. We could view x0 plus this vector plus x minus x0 is going to be equal to x. If I were to do it on this graph, it's going to look like this. It's going to be like this. So let me draw it better than that. It's going to go from that point from x0, the point specified by x0 to the point specified by x. And it's going to lie along the plane. So this right here is x minus x0. I know this drawing is getting very dirty, but you can see that this is definitely lying on the plane. So this vector right here must be perpendicular to n. Perpendicular to our normal vector. Now, if my normal vector-- let's say my normal vector n. So this vector is perpendicular to this guy right here. It's perpendicular to the vector n1, n2, n3. Now using this information, how can we get to this type of an expression, just this linear equation of x, y and z? Well, we know that n-- let me switch to a neutral color. We know that n-- actually, I didn't want to do this caret here. n is not a unit vector. But let's say n, so it's perpendicular to this. So the dot product of it, we saw that right there. We saw it in the previous video. The dot product of n with this vector right here-- actually, let me draw it. You know, I already drew the plane sideways, so I can actually draw my n vector. My n vector's going to look something like this. It's going to be popping straight out of the plane. And I could shift it over, but it's always going to be in that same direction. It's going to be perpendicular to this vector right here. So n is perpendicular to x minus x0. Which means that their dot product is equal to 0. Well what does x minus x0 look like? So this is going to look like this expression. If I write out the vectors themselves it's the vector n1, n2, n3 being dotted with-- well, if I take x minus x0, that's just the scalar x minus the scalar x0. The first term subtracted. And then the scalar y minus the scalar y0. And then the scalar z minus the scalar z0. We know that this whole thing has to be equal to 0 because they're perpendicular. And then if we take the dot product here, we get n1 times x minus x0 plus n2 times y minus y0 plus n3 times z minus z0 is equal to 0. And you might not completely recognize it, but this is-- you'll have to do a little algebra to clean it up-- but this is the form ax plus by plus cz is equal to d. And actually, I think I made a mistake here. This should be not 0, this is equal to d. This is the general form for a plane in R3. A plane is just a linear surface in R3. I shouldn't have written a 0 there. So this does take this form. And if you don't believe me, we can do it with an actual example. So let's say we have-- I gave you my normal-- I specify a plane. If I give you a normal vector and I tell you that normal vector is the point 1, 3, minus 2 and I say that it intersects the point, or a point that lies on the plane-- The normal vector and the point don't necessarily have to intersect. But let's say for a point that lies on the plane, I have the point 1, 2 and 3. And I say give me the equation for this plane. Well, I would say well, if I take any other point on that plane-- so if I take any other point on that plane, xyz and it's specified by this vector, the vector that's defined by the difference between these two is going to lie on the plane. This point and this point lie on the plane, so the difference between these two vectors, the whole vector will lie on the plane. Let me take the difference. So x minus x0 is equal to x minus 1, y minus 2, and then z minus 3. I'm saying this will lie on the plane. This is on the plane. And it's going to be perpendicular to our normal vector. So if I dot my normal vector, 1, 3, minus 2, with this thing right here, with x minus 1, y minus 2, z minus 3, I should get 0. Because this has to be perpendicular to anything that lies on the plane. So what do we get? We get 1 times x minus 1 is x minus 1. Plus 3 times y minus 2. Just taking the dot product. Minus 2 times z minus 3 is equal to 0. Let's if we can do a little bit of algebra here to clean this up a little bit. I get x minus 1 plus 3y minus 6 minus 2z plus 6 is equal to 0. And let's see. Minus 6 and a plus 6 cancel out. And then I can take this minus 1. I could add 1 to both sides and I get x plus 3y minus 2z-- add that 1 to both sidess-- is equal to 1. And there you have it. Just by using the simple fact that this is a point on the plane and this is a normal vector, I was able to use the idea that this has to be normal or its dot product with any point, with any vector that lies on the plane, I was able to get this right here. I didn't have to go through this whole business right here. You could have just used this formula right here. You could have just said n1 is 1 times x minus x1. Or x0 I could call it. So x minus this 1 plus n2, 3 times y minus 2 plus minus 2 times z minus 3 is equal to 0. And then if you just did a little bit of math. a little bit of algebra, you would've gotten there. So hopefully find this reasonable useful. This is actually quite useful if you ever have to do anything that involves any type of three-dimensional mathematics. And if you ever become a game programmer this would be-- there's thousands of other applications. But this is kind of a useful byproduct of some of the formal mathematics that we've been doing.