Main content

## Linear algebra

### 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

© 2023 Khan AcademyTerms of usePrivacy PolicyCookie Notice

# Dot and cross product comparison/intuition

Dot and Cross Product Comparison/Intuition. Created by Sal Khan.

## Want to join the conversation?

- Its difficult to imagine how useful the Dot and Cross products are in real world applications. Some examples would shed a lot of light(33 votes)
- First, anything with forces/vectors in different directions can use the dot product. The physics video https://www.khanacademy.org/video/the-dot-product? uses an example where you pull an object along the ground. How much work do you do?

Work = (Force)·(Distance).

Secondly, if you normalize the vectors, then |a| and |b| are both 1, and the dot product |a||b|cosθ is now just cosθ. This is useful any time you want the angle between two vectors.

For example: computers multiply and add much faster than they do trig functions, so dot and cross products are used all the time in 3D appplications. To a video game engine, the player 'camera' is a vector. When you walk around, the orientation of objects in relation to one another, and to you, are computed by a series of dot and cross products.

Cross products? Those too! Say light hits a surface. Is the light reflected to you? Can you see through the surface, or is the angle too steep? You want to know what direction the surface is facing. You want the vector orthogonal to the surface: the one sticking out into the world: You need its normal, i.e. the cross product.

Generalize inner products are only necessary when your problem requires a more abstract tool. The dot product is defined. That definition holds; so its definition is absolutely rigorous. You need only secure those properties you require.

One example in the direction crabhand is hinting, is signal processing. Say you break apart a signal into an arbitrary number of streams. If you want each stream to carry data which does NOT already exist in any of the others, you might call this property, 'Orthogonality.' You could say the streams are mutually orthogonal (all of 'em!). The metaphor sounds nice, but it's just a story. To make it mathematically valid, we must define these ideas in a way that can be carried into mathematics. In general, it may or may not be possible to obtain the desired analogy. In this particular case, it can be done.

Does that help at all?

(Also, Linear Algebra is abstract mathematics. The physics videos have concrete examples of vector products)(161 votes)

- if both dot and cross product of a vector is zero(0) does it imply that one of these vectors must be null vectors?(8 votes)
*Note that the null vector is the only vector with a magnitude of 0*

The dot product of vectors a and b is defined as:`a.b = |a||b|cos(p)`

The cross product magnitude of vectors a and b is defined as:`|a x b| = |a||b|sin(p)`

Where |a| and |b| are the magnitudes of the vector and p is the angle between the vectors.

The dot product can be 0 if:`The magnitude of a is 0`

`The magnitude of b is 0`

`The cosine of the angle between the vectors is 0, cos(p)`

The magnitude of the cross product can be zero if:`The magnitude of a is 0`

`The magnitude of b is 0`

`The sine of the angle between the vectors is 0, sin(p)`

In order for the dot and cross product magnitude to both be zero, the two angle related requirements cannot both be valid!

If the dot product requirement for a dot product of 0 is true:`The cosine of the angle between the vectors is 0, cos(p)`

Then the cross product requirement for a magnitude of 0:`The sine of the angle between the vectors is 0, sin(p)`

cannot be true, because sin and cos are not equivalent functions.

Therefore, if a dot and cross product are both equal to 0 for the same vectors a and b, then either a or b (or both) must be a null vector.(30 votes)

- Can I use cross product of two vectors to figure out angle between them ?

I know cross product will give us a vector but that doesn't matter ( If I'm right ). The magnitude of the cross product will give the measure of the angle and direction will signify that relative to which side we are defining the angle.

If I'm wrong, then sorry in advance !(6 votes)- Yes! Let
`v`

and`w`

be vectors in`R^3`

and let`theta`

be the angle between them, The exact formula you are looking for is`|v x w| = |v| |w| Sin(theta)`

. This should remind you of the dot product formula which has`|v . w| = |v| |w| Cos(theta)`

. Either one can be used to find the angle between two vectors in R^3, but usually the dot product is easier to compute. If you are not in 3-dimensions then the dot product is the only way to find the angle. A common application is that two vectors are orthogonal if their dot product is zero and two vectors are parallel if their cross product is zero.(9 votes)

- When handling the area of a parallelogram with the cross product, do units become arbitrary? Obviously, the magnitude (length) of a vector is a one-dimensional unit, whereas area is measured as a two-dimensional unit.

Furthermore, when dealing with vectors outside of R^3, does the same analogy still hold, or does the cross product simply not exist in those cases?(8 votes)- Yes units are always arbitrary. Generally in most of your math classes, even advanced classes, dimensional analysis are even mentioned. It's up to you to decide if your working with a micro meter or a mile. As for the second question, the cross product is not defined for spaces greater than R3. But the operation is still used in finding a determinate of a matrix which can be far greater that R3. Just augment the matrix and treat is as as many 2x2 matrices as are needed. You can find examples in just about any Linear Algebra book.(3 votes)

- can someone tell me why we cant find cross product between two parallel vectors? why is it zero?

i mean if there are two lines parallel in xy plane........ we can get a perpendicular to both of the lines................. which will be along z axis..

then why cross product between two parellel lines is zero?(3 votes)- The simple answer is: because the angle between them is zero. That means the sine of that angle is zero, and therefore the product of ||a|| ||b|| sin(<ab) is zero (here I use "<ab" to mean "the angle between vectors a and b).

You are right that there is a vector along the z axis which is perpendicular to both - and that is exactly what the cross product is: it's that vector perpendicular to both a and b. But the**length**of that vector is defined by the formula ||a|| ||b|| sin(<ab), and that length is zero. So yes, there is such a vector, but its length is zero.(8 votes)

- at12:22and earlier, could we have constructed the triangle to have the right angle at the tip of a? ..and would this have any other effect besides flipping the projection from a→b to b→a?(4 votes)
- "a·b" and "b·a" yield the same result, so switching the vectors is fine as long as you evaluate them consistently.

For simplicity, I would call the shorter vector "a" so I'm doing most of my work with smaller values. Sal was also unclear on what happens when the projection of "a" is*shorter*than the length of "b." I doubt it would be an issue but am having trouble visualizing the "area" in that situation.(2 votes)

- I understand that the dot product gives you an indicator of our similar the two vectors are in direction. But not the part when it is explained by |b| adj. can someone explain what that product means intuitively?(3 votes)
- To find how much the vectors go together, we multiply their parallel parts together. By dropping a perpendicular line from
**a**, Sal forms a right triangle. The adjacent side of the right triangle is how much of**a**goes parallel with**b**. So, we can say that the dot product is the product of**b**with that adjacent side of the right triangle made from**a**.(3 votes)

- Seeing that one is proportional to sine and the other to cosine made me think of derivatives. Would it be correct to say that the derivative of a function that outputs the cross product of 2 constant vectors when the angle between them varies is the dot product of the same thing?(2 votes)
- Close. The derivative of a function that outputs
*the magnitude*of the cross product of two vectors of fixed magnitude is the same function that returns their dot product.

We need the function to give the magnitude, because the derivative of a vector-valued function is another vector-valued function.(4 votes)

- Sir,

When to use Dot product and Cross Product and how can we multiply ( -6i+8k ) X ( 8j + 6k ) / | -6i+8k | | 8j + 6k | . Note vector symbol is on top on every i,j,k multiples(3 votes)- You might be able to get the zero vector that is orthogonal to all vectors and parallel to all. But the magnitude of the cross product uses sine of theta. Because the sine of zero is zero. And zero times anything is zero.(2 votes)

- Hi, I have a question I hope someone can help me with.

Take any arbitrary vector like A = ( 2i + 2j +2k), if I was to dot that with just ' i ', would I change ' i ' into a vector ( i + 0j + 0k) and dot that with A or should all the componants of ' A ' be dotted with ' i ' to get something like ( 2i.i + 2j.i + 2k.i) ? Or what should be done? Please and thank you(2 votes)- î already is a vector, and yes it is equal to 1î + 0ĵ + 0ƙ. So, you can dot it with
**A**normally.(3 votes)

## Video transcript

We've known for several videos
now that the dot product of two nonzero vectors, a and b,
is equal to the length of vector a times the length of
vector b times the cosine of the angle between them. Let me draw a and b just
to make it clear. If that's my vector a and
that's my vector b right there, the angle between
them is this angle. And we defined it in this way. And actually, if you ever want
to solve-- if you have two vectors and you want to solve
for that angle, and I've never done this before explicitly. And I thought, well, I might
as well do it right now. You could just solve
for your theta. So it would be a dot b divided
by the lengths of your two vectors multiplied by each
other is equal to the cosine of theta. And then to solve for theta
you would have to take the inverse cosine of both sides,
or the arc cosine of both sides, and you would get theta
is equal to arc cosine of a dot b over the magnitudes or
the lengths of the products of, or the lengths of each of
those vectors, multiplied by each other. So if I give you two arbitrary
vectors-- and the neat thing about it is, this might be
pretty straightforward. If I just drew something in two
dimensions right here, you could just take your protractor
out and measure this angle. But if a and b each have a
hundred components, it becomes hard to visualize the
idea of an angle between the two vectors. But you don't need to visualize
them anymore because you just have to calculate
this thing right here. You just have to calculate
this value right there. And then go to your calculator
and then type in arc cosine, or the inverse cosine that are
the equivalent functions, and it'll give you an angle. And that, by definition, is the
angle between those two vectors, which is a
very neat concept. And then you can start
addressing issues of perpendicularity and
whatever else. This was a bit of a tangent. But the other outcome that I
painstakingly proved to you in the previous video was that
the length of the cross product of two vectors is equal
to-- it's a very similar expression. It's equal to the product of the
two vectors' lengths, so the length of a times the length
of b times the sine of the angle between them. Times the sign of the
angle between them. So it's the same angle. So what I want to do is take
these two ideas and this was a bit of a diversion there just
to kind of show you how to solve for theta because I
realized I've never done that for you before. But what I want to do is I want
to take this expression up here and this expression up
here and see if we can develop an intuition, at least in R3
because right now we've only defined our cross product. Or the cross product of two
vectors is only defined in R3. Let's take these two ideas in
R3 and see if we can develop an intuition. And I've done a very similar
video in the physics playlist where I compare the dot product
to the cross product. Now, if I'm talking about--
let me redraw my vectors. So the length of a--
so let me draw a. b, I want to do it
bigger than that. So let me do it like that. So that is my vector b. So this is b. That is a. What is the length of a times
the length of b times the cosine of the angle? So let me do that right there. So this is the angle. So the length of a if I were to
draw these vectors is this length right here. This is the length of a. It's this distance right
here, the way I've drawn this vector. So this is, literally, the
length of vector a. And I'm doing it in R3 or maybe
a version of it that I can fit onto my little
blackboard right here. So it'll just be the length
of this line right there. And then the length of
b is the length of that line right there. So that is the length of b. Let me rewrite this
thing up here. Let me write it as b, the length
of b times the length-- and I want to be careful. I don't want to do the dot there
because you'll think it's a dot product. Times a cosine of theta. All I did is I rearranged
this thing here. It's the same thing
as a dot b. Well what is a times the
cosine of theta? Let's get out our basic
trigonometry tools-- SOH CAH TOA. Cosine of theta is equal to
adjacent over hypotenuse. So if I drop, if I create a
right triangle here, and let me introduce some new colors
just to ease the monotony. If I drop a right triangle
right here and I create a right triangle right there, and
this is theta, than what is the cosine of theta? It's equal to this. Let me do it another color. It's equal to this,
the adjacent side. It's equal to this little
magenta thing. Not all of b, just this
part that goes up to my right angle. That's my adjacent. I want to do it a little
bit bigger. It's equal to the adjacent
side over the hypotenuse. So let me write this down. So cosine of theta is equal to
this little adjacent side. I'm just going to write
it like that. Is equal to this adjacent side
over the hypotenuse. But what is the hypotenuse? It is the length of vector a. It's this. That's my hypotenuse
right there. So my hypotenuse is the
length of vector a. And so if I multiply both sides
by the length of vector a I get the length of vector a
times the cosine of theta is equal to the adjacent side. I'll do that in magenta. So this expression right here,
which was just a dot b can be rewritten as-- I just told you
that the length of vector a times cosine of theta is equal
to this little magenta adjacent side. So this is equal to
the adjacent side. So you can view a dot b as being
equal to the length of vector b-- that length-- times
that adjacent side. And you're saying, Sal, what
does that do for me? Well what it tells you
is you're multiplying essentially, the length of
vector b times the amount of vector a that's going in the
same direction as vector b. You can kind of view this as
the shadow of vector a. And I'll talk about projections
in the future. And I'll more formally define
them, but if the word projection helps you, just
think of that word. If you have a light that shines
down from above, this adjacent side is kind of like
the shadow of a onto vector b. And you can imagine, if these
two vectors-- if our two vectors looked more like this,
if they were really going in the same direction. Let's say that's vector a and
that's vector b, then the adjacent side that I care about
is going to-- they're going to have a lot
more in common. The part of a that is going in
the same direction of b will be a lot larger. So this will have a larger
dot product. Because the dot product is
essentially saying, how much of those vectors are going
in the same direction? But it's just a number, so it
will just be this adjacent side times the length of b. And what if I had vectors that
are pretty perpendicular to each other? So what if I had two vectors
that were like this? What if my vector a looked
like that and my vector b looked like that? Well now the adjacent, the way
I define it here, if I had to make a right triangle
like that, the adjacent side's very small. So you're dot product, even
though a is still a reasonably large vector, is now much
smaller because a and b have very little commonality
in the same direction. And you can do it
the other way. You could draw this down like
that and you could do the adjacent the other way, but it
doesn't matter because these a's and b's are arbitrary. So the take away is the fact
that a dot b is equal to the lengths of each of those times
the cosine of theta. To me it says that the dot
product tells me how much are my vectors moving together? Or the product of the
part of the vectors that are moving together. Product of the lengths of the
vectors that are moving together or in the
same direction. You could view this adjacent
side here as the part of a that's going in the
direction of b. That's the part of a that's
going in the direction of b. So you're multiplying
that times b itself. So that's what the
dot product is. How much are two things going
in the same direction. And notice, when two things are
orthogonal or when they're perpendicular-- when a dot b is
equal to 0, we say they're perpendicular. And that makes complete sense
based on this kind of intuition of what the dot
product is doing. Because that means that
they're perfectly perpendicular. So that's b and that's a. And so the adjacent part of a,
if I had to draw a right trianlge, it would come
straight down. And if I were to say the
projection of a and I haven't draw that. Or if I put a light shining down
from above and I'd say what's the shadow of a onto b? You'd get nothing. You'd get 0. This arrow has no width, even
though I've drawn it to have some width. It has no width. So you would have
a 0 down here. The part of a that goes in
the same direction as b. No part of this vector
goes in the same direction as this vector. So you're going to have this 0
kind of adjacent side times b, so you're going to get
something that's 0. So hopefully that makes
a little sense. Now let's think about
the cross product. The cross product tells us well,
the length of a cross b, I painstakingly showed, you is
equal to the length of a times the length of b times the sin
of the angle between them. So let me do the same example. Let me draw my two vectors. That's my vector a and
this is my vector b. And now sin-- SOH CAH TOA. So sin of theta, let
me write that. Sin of theta-- SOH CAH TOA-- is
equal to opposite over the hypotenuse. So if I were to draw a little
right triangle here, so if I were to draw a perpendicular
right there, this is theta. What is the sin of theta equal
to in this context? The sin of theta is
equal to what? It's equal to this
side over here. Let me call that just
the opposite. It's equal to the opposite
side over the hypotenuse. So the hypotenuse is
the length of this vector a right there. It's the length of
this vector a. So the hypotenuse is the length
over my vector a. So if I multiply both sides of
this by my length of vector a, I get the length of vector a
times the sin of theta is equal to the opposite side. So if we rearrange this a little
bit, I can rewrite this as equal to-- I'm just
going to swap them. I have to do the dot
product as well. This is equal to b, the length
of vector b, times the length of vector a sin of theta. Well this thing is just the
opposite side as I've defined it right here. So this right here is just
the opposite side, this side right there. So when we're taking the cross
product, we're essentially multiplying the length of vector
b times the part of a that's going perpendicular
to b. This opposite side is the
part of a that's going perpendicular to b. So they're kind of
opposite ideas. The dot product, you're
multiplying the part of a that's going in the same
direction as b with b. While when you're taking the
cross product, you're multiplying the part of
a that's going in the perpendicular direction to
b with the length of b. It's a measure, especially when
you take the length of this, it's a measure of
how perpendicular these two guys are. And this is, it's a measure of
how much do they move in the same direction? And let's just look at
a couple of examples. So if you take two
right triangles. So if that's a and that's-- or
if you take two vectors that are perpendicular to each other,
the length of a cross b is going to be equal to-- if we
just use this formula right there-- the length of a
times the length of b. And what's the sin
of 90 degrees? It's 1. So in this case you kind of have
maximized the length of your cross product. This is as high as it can go. Because sin of theta, it's
a maximum value. Sin of theta is always less
than or equal to 1. So this is as good as you're
ever going to get. This is the highest possible
value when you have perfectly perpendicular vectors. Now, when is-- actually, just to
kind of go back to make the same point here. When do you get the maximum
value for your cosine of-- for your dot product? Well, it's when your two
vectors are collinear. If my vector a looks like that
and my vector b is essentially another vector that's going
in the same direction, then theta is 0. There's no angle between them. And then you have a dot b is
equal to the magnitude or the length of vector a times the
length of vector b times the cosine of the angle
between them. The cosine of the angle between
them, the cosine of that angle is 0. Or the angle is 0, so the
cosine of that is 1. So when you have two vectors
that go exactly in the same direction or they're collinear,
you kind of maximize your dot product. You maximize your cross product
when they're perfectly perpendicular to each other. And just to make the analogy
clear, when they're perpendicular to each other
you've minimized-- or at least the magnitude of your
dot product. You can get negative dot
products, but the absolute size of your dot product, the
absolute value of your dot product is minimized
when they're perpendicular to each other. Similarly, if you were to take
two vectors that are collinear and they're moving in the same
direction, so if that's vector a, and then I have vector b that
just is another vector that I want to draw them
on top of each other. But I think you get the idea. Let's say vector
b is like that. Then theta is 0. You can't even see it. It's been squeezed out. I've just brought these two
things on top of each other. And then the cross product in
this situation, a cross b is equal to-- well, the length of
both of these things times the sin of theta. Sin of 0 is 0. So it's just 0. So two collinear vectors, the
magnitude of their cross product is 0. But the magnitude of their dot
product, the a dot b, is going to be maximized. It's going to be as high
as you can get. It's going to be the length of
a times the length of b. Now the opposite scenario
is right here. When they're perpendicular to
each other, the cross product is maximized because it's
measuring on how much of the vectors-- how much of the
perpendicular part of a is-- multiplying that times
the length of b. And then when you have two
orthogonal vectors, your dot product is minimized,
or the absolute value of your dot product. So a dot b in this case,
is equal to 0. Anyway, I wanted to make all
of this clear because sometimes you kind of get into
the formulas and the definitions and you lose the
intuition about what are all of these ideas really for? And actually, before I move on,
let me just make another kind of idea about what the
cross product can be interpreted as. Because a cross product tends
to give people more trouble. That's my a and that's my b. What if I wanted to figure
out the area of this parallelogram? If I were to shift a and have
that there and if I were to shift b and draw a line parallel
to b, and if I wanted to figure out the area of this
parallelogram right there, how would I do it just using
regular geometry? Well I would drop a
perpendicular right there. This is perpendicular and this
length is h for height. Then the area of this, the area
of the parallelogram is just equal to the length of my
base, which is just the length of vector b times my height. But what is my height? Let me just draw a little
theta there. Let me do a green theta,
it's more visible. So theta. So we know already that the sin
of this theta is equal to the opposite over
the hypotenuse. So it's equal to the height
over the hypotenuse. The hypotenuse is just the
length of vector a. So it's just the length
of vector a. Or we could just solve for
height and we'd get the height is equal to the length
of vector a times the sin of theta. So I can rewrite this here. I can replace it with that and
I get the area of this parallelogram is equal to the
length of vector b times the length of vector a sin theta. Well this is just the length
of the cross product of the two vectors, a cross b. This is the same thing. I mean you can rearrange
the a and the b. So we now have another way of
thinking about what the cross product is. The cross product of two
vectors, or at least the magnitude or the length of the
cross product of two vectors-- obviously, the cross product
you're going to get a third vector. But the length of that third
vector is equal to the area of the parallelogram that's defined
or that's kind of-- that you can create from
those two vectors. Anyway, hopefully you found this
a little bit intuitive and it'll give you a little bit
more of kind of a sense of what the dot product and cross
product are all about.