If you're seeing this message, it means we're having trouble loading external resources on our website.

If you're behind a web filter, please make sure that the domains *.kastatic.org and *.kasandbox.org are unblocked.

Main content

The dot product

Introduction to the vector dot product. Created by Sal Khan.

Want to join the conversation?

Video transcript

Let's learn a little bit about the dot product. The dot product, frankly, out of the two ways of multiplying vectors, I think is the easier one. So what does the dot product do? Why don't I give you the definition, and then I'll give you an intuition. So if I have two vectors; vector a dot vector b-- that's how I draw my arrows. I can draw my arrows like that. That is equal to the magnitude of vector a times the magnitude of vector b times cosine of the angle between them. Now where does this come from? This might seem a little arbitrary, but I think with a visual explanation, it will make a little bit more sense. So let me draw, arbitrarily, these two vectors. So that is my vector a-- nice big and fat vector. It's good for showing the point. And let me draw vector b like that. Vector b. And then let me draw the cosine, or let me, at least, draw the angle between them. This is theta. So there's two ways of view this. Let me label them. This is vector a. I'm trying to be color consistent. This is vector b. So there's two ways of viewing this product. You could view it as vector a-- because multiplication is associative, you could switch the order. So this could also be written as, the magnitude of vector a times cosine of theta, times-- and I'll do it in color appropriate-- vector b. And this times, this is the dot product. I almost don't have to write it. This is just regular multiplication, because these are all scalar quantities. When you see the dot between vectors, you're talking about the vector dot product. So if we were to just rearrange this expression this way, what does it mean? What is a cosine of theta? Let me ask you a question. If I were to drop a right angle, right here, perpendicular to b-- so let's just drop a right angle there-- cosine of theta soh-coh-toa so, cah cosine-- is equal to adjacent of a hypotenuse, right? Well, what's the adjacent? It's equal to this. And the hypotenuse is equal to the magnitude of a, right? Let me re-write that. So cosine of theta-- and this applies to the a vector. Cosine of theta of this angle is equal to ajacent, which is-- I don't know what you could call this-- let's call this the projection of a onto b. It's like if you were to shine a light perpendicular to b-- if there was a light source here and the light was straight down, it would be the shadow of a onto b. Or you could almost think of it as the part of a that goes in the same direction of b. So this projection, they call it-- at least the way I get the intuition of what a projection is, I kind of view it as a shadow. If you had a light source that came up perpendicular, what would be the shadow of that vector on to this one? So if you think about it, this shadow right here-- you could call that, the projection of a onto b. Or, I don't know. Let's just call it, a sub b. And it's the magnitude of it, right? It's how much of vector a goes on vector b over-- that's the adjacent side-- over the hypotenuse. The hypotenuse is just the magnitude of vector a. It's just our basic calculus. Or another way you could view it, just multiply both sides by the magnitude of vector a. You get the projection of a onto b, which is just a fancy way of saying, this side; the part of a that goes in the same direction as b-- is another way to say it-- is equal to just multiplying both sides times the magnitude of a is equal to the magnitude of a, cosine of theta. Which is exactly what we have up here. And the definition of the dot product. So another way of visualizing the dot product is, you could replace this term with the magnitude of the projection of a onto b-- which is just this-- times the magnitude of b. That's interesting. All the dot product of two vectors is-- let's just take one vector. Let's figure out how much of that vector-- what component of it's magnitude-- goes in the same direction as the other vector, and let's just multiply them. And where is that useful? Well, think about it. What about work? When we learned work in physics? Work is force times distance. But it's not just the total force times the total distance. It's the force going in the same direction as the distance. You should review the physics playlist if you're watching this within the calculus playlist. Let's say I have a 10 newton object. It's sitting on ice, so there's no friction. We don't want to worry about fiction right now. And let's say I pull on it. Let's say my force vector-- This is my force vector. Let's say my force vector is 100 newtons. I'm making the numbers up. 100 newtons. And Let's say I slide it to the right, so my distance vector is 10 meters parallel to the ground. And the angle between them is equal to 60 degrees, which is the same thing is pi over 3. We'll stick to degrees. It's a little bit more intuitive. It's 60 degrees. This distance right here is 10 meters. So my question is, by pulling on this rope, or whatever, at the 60 degree angle, with a force of 100 newtons, and pulling this block to the right for 10 meters, how much work am I doing? Well, work is force times the distance, but not just the total force. The magnitude of the force in the direction of the distance. So what's the magnitude of the force in the direction of the distance? It would be the horizontal component of this force vector, right? So it would be 100 newtons times the cosine of 60 degrees. It will tell you how much of that 100 newtons goes to the right. Or another way you could view it if this is the force vector. And this down here is the distance vector. You could say that the total work you performed is equal to the force vector dot the distance vector, using the dot product-- taking the dot product, to the force and the distance factor. And we know that the definition is the magnitude of the force vector, which is 100 newtons, times the magnitude of the distance vector, which is 10 meters, times the cosine of the angle between them. Cosine of the angle is 60 degrees. So that's equal to 1,000 newton meters times cosine of 60. Cosine of 60 is what? It's square root of 3 over 2. Square root of 3 over 2, if I remember correctly. So times the square root of 3 over 2. So the 2 becomes 500. So it becomes 500 square roots of 3 joules, whatever that is. I don't know 700 something, I'm guessing. Maybe it's 800 something. I'm not quite sure. But the important thing to realize is that the dot product is useful. It applies to work. It actually calculates what component of what vector goes in the other direction. Now you could interpret it the other way. You could say this is the magnitude of a times b cosine of theta. And that's completely valid. And what's b cosine of theta? Well, if you took b cosine of theta, and you could work this out as an exercise for yourself, that's the amount of the magnitude of the b vector that's going in the a direction. So it doesn't matter what order you go. So when you take the cross product, it matters whether you do a cross b, or b cross a. But when you're doing the dot product, it doesn't matter what order. So b cosine theta would be the magnitude of vector b that goes in the direction of a. So if you were to draw a perpendicular line here, b cosine theta would be this vector. That would be b cosine theta. The magnitude of b cosine theta. So you could say how much of vector b goes in the same direction as a? Then multiply the two magnitudes. Or you could say how much of vector a goes in the same direction is vector b? And then multiply the two magnitudes. And now, this is, I think, a good time to just make sure you understand the difference between the dot product and the cross product. The dot product ends up with just a number. You multiply two vectors and all you have is a number. You end up with just a scalar quantity. And why is that interesting? Well, it tells you how much do these-- you could almost say-- these vectors reinforce each other. Because you're taking the parts of their magnitudes that go in the same direction and multiplying them. The cross product is actually almost the opposite. You're taking their orthogonal components, right? The difference was, this was a a sine of theta. I don't want to mess you up this picture too much. But you should review the cross product videos. And I'll do another video where I actually compare and contrast them. But the cross product is, you're saying, let's multiply the magnitudes of the vectors that are perpendicular to each other, that aren't going in the same direction, that are actually orthogonal to each other. And then, you have to pick a direction since you're not saying, well, the same direction that they're both going in. So you're picking the direction that's orthogonal to both vectors. And then, that's why the orientation matters and you have to take the right hand rule, because there's actually two vectors that are perpendicular to any other two vectors in three dimensions. Anyway, I'm all out of time. I'll continue this, hopefully not too confusing, discussion in the next video. I'll compare and contrast the cross product and the dot product. See you in the next video.