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.

## Multivariable calculus

### Course: Multivariable calculus>Unit 1

Lesson 2: Vectors and matrices

# Dot products

Learn about the dot product and how it measures the relative direction of two vectors.
The dot product is a fundamental way we can combine two vectors. Intuitively, it tells us something about how much two vectors point in the same direction.

## Definition and intuition

We write the dot product with a little dot dot between the two vectors (pronounced "a dot b"):
a, with, vector, on top, dot, b, with, vector, on top, equals, \|, a, with, vector, on top, \|, \|, b, with, vector, on top, \|, cosine, left parenthesis, theta, right parenthesis
If we break this down factor by factor, the first two are \|, a, with, vector, on top, \| and \|, b, with, vector, on top, \|. These are the magnitudes of a, with, vector, on top and b, with, vector, on top, so the dot product takes into account how long vectors are. The final factor is cosine, left parenthesis, theta, right parenthesis, where theta is the angle between a, with, vector, on top and b, with, vector, on top. This tells us the dot product has to do with direction.
Specifically, when theta, equals, 0, the two vectors point in exactly the same direction. Not accounting for vector magnitudes, this is when the dot product is at its largest, because cosine, left parenthesis, 0, right parenthesis, equals, 1. In general, the more two vectors point in the same direction, the bigger the dot product between them will be.
When theta, equals, start fraction, pi, divided by, 2, end fraction, the two vectors are precisely perpendicular to each other. This corresponds to the dot product between them being 0, because cosine, left parenthesis, start fraction, pi, divided by, 2, end fraction, right parenthesis, equals, 0.
It's also possible for a dot product to be negative if the two vectors are pointing in opposite directions, which is when start fraction, pi, divided by, 2, end fraction, is less than, theta, is less than, start fraction, 3, pi, divided by, 2, end fraction.
Another way to think about theta is to imagine one vector dropping a shadow on to the other. When the angle is small, the shadow lands far from the origin and the dot product is large.
When theta is close to start fraction, pi, divided by, 2, end fraction, the shadow lands close to the origin and the dot product is small.
Keep in mind that the dot product of two vectors is a number, not a vector. That means, for example, that it doesn't make sense to ask what a, with, vector, on top, dot, b, with, vector, on top, dot, c, with, vector, on top equals. Once we evaluated a, with, vector, on top, dot, b, with, vector, on top to be some number, we would end up trying to take the dot product between a number and a vector, which isn't how the dot product works.

## A better way to compute the dot product

When we need to find a dot product in multivariable calculus, we typically have only the coordinates of a, with, vector, on top and b, with, vector, on top. Calculating \|, a, with, vector, on top, \|, \|, b, with, vector, on top, \|, cosine, left parenthesis, theta, right parenthesis would force us to find two square roots and a cosine, which is a lot of work! Luckily, there is an easier way. Just multiply corresponding components and then add:
\begin{aligned} \vec{a} &= (a_1, a_2, a_3) \\ \\ \vec{b} &= (b_1, b_2, b_3) \\ \\ \vec{a} \cdot \vec{b} &= a_1b_1 + a_2b_2 + a_3b_3 \end{aligned}
Although the example above features 3D vectors, this formula extends for vectors of any length.
This makes calculating dot products straightforward if you know the components of each vector.
\begin{aligned} &\vec{v} = 4 \hat{\imath} - 1 \hat{\jmath} + 2 \hat{k} \\ \\ &\vec{w} = 1 \hat{\imath} + 2 \hat{\jmath} + 4 \hat{k} \\ \\ &\vec{v} \cdot \vec{w} = 4 \cdot 1 + (-1) \cdot 2 + 2 \cdot 4 = 10 \end{aligned}
Let's try an example.
Problem 1
What is the dot product of a, with, vector, on top, equals, left parenthesis, 1, comma, 3, right parenthesis and b, with, vector, on top, equals, left parenthesis, minus, 5, comma, 2, right parenthesis?

Even though we now have a nice formula in terms of coordinates, the intuition behind the dot product remains how it measures relative direction. Try to predict the sign of the dot product based on just a picture.
Problem 2
• Current
Is the sign of the dot product between the two vectors positive, negative, or zero?

That's all we'll need to know about dot products for now. If you want to learn more, check out this video.

## What's next

Now that we've covered the dot product, there's just one more vector operation to learn about: the cross product. As we'll see, the cross product nicely complements the dot product but is slightly more limited.

## Want to join the conversation?

• why do we use dot products? what can it be used for, like in computers or something? • It can also be used in physics; like the mathematical definition of "Work" is the dot product of force * displacement (change in position AKA distance)

If you're wondering about cross products too, then a good example is that torque is the cross product of the force vector and the displacement vector from the point at which the axis is (the center of rotation) and the point and which force is applied.

Hope this helps!
• Any further hint about the proof of why is the dot product the sum of the product of the components? Can't really crack this nut. • Hi Michele, here's an idea.

Referring to the diagram in the hint, expand out each norm as v*v = v_1*v_1 + ... + v_n*v_n. Note that this follows from the Pythagorean theorem, so it is not circular logic! (Make sure to square everything to get rid of nasty square roots.) When you get to the norm ||a-b||^2, you will get many terms because (a-b)*(a-b) expands out linearly into four dot products. Some of these will cancel out however...

Now write out what the Law of Cosines tells you: ||b-a||^2 = ||a||^2 + ||b||^2 - 2*||a||*||b||*cos(theta). Using your simplified expansions for ||b-a||^2, ||a||^2, and ||b||^2, cancel any remaining terms and move everything else to one side of the equation. Divide by 2 to find a new expression for ||a||*||b||*cos(theta).

What do you find?  