Hey everyone, today we're going to be talking about the dot product. Namely,
we're gonna be talking about what it is, how to calculate it,
some important results, and its applications - right so "why are we even
calculating the dot product in the first place?".
Next week I'm gonna be doing a video on the cross product, and the reason why I'm
doing this series is because I wanted to tackle a really interesting vector
identity in my video after that so if those are already up, the links to them
will be on the screen and in the description. And if they're not up yet,
then be sure to subscribe so that you don't miss it. So let's start by talking
about the intuitive definition of what the dot product is. The dot product is
one way that we can multiply two vectors, and gives us a measure of how much the
two vectors point in the same direction. It's worth noting that the dot product
gives us a scalar, so we give it two vectors and it gives us a number and
that number tells us how aligned they are relative to their length. So let's
talk about how we would compute it in Cartesian coordinates. Let's say that
this vector is a and it goes along a distance a sub x in the x-direction and
a sub y in the y-direction. We'll call this vector b and say it goes along b sub x in
the x-direction and b sub y in the y-direction. So our dot product a dot b is
given by our two x-coordinates multiplied together added to our two
y-coordinates multiplied together. Notice again that we're giving in two vectors
and we're getting out one number. So, why does this fit our definition? If we were
to imagine sliding a along towards the right notice that they would be getting
closer to being in the same direction also, our a sub x value would be
increasing, which would mean that our entire dot product is increasing, so as
our vectors get closer to pointing in the same direction, our dot product will
increase. When we talk about how aligned two things are, a natural thought might
be to consider the angle between them. If we're dealing with two vectors that are
directly in a line, it's pretty natural to say that we want the dot product to
be at a maximum there. Remember that the dot product is a measure of how in-line
they are, scaled to their magnitudes. Then the angle between them which we'll
call theta is equal to zero and then we'll want the dot product to be equal
to the magnitude of a, times the magnitude of b. What happens when the two
vectors are perpendicular? Well then the angle between them is going to be equal
to pi on 2. The dot product measures how in line two vectors are, if they're
perpendicular then they're not pointing in the same direction at all,
they're as far away from each other as they can be, so in this case the dot
product is going to be equal to zero. The last case we'll consider is when they
are pointing in opposite directions or the angle between them is equal to pi.
Here they're still pointing in the same direction but they're just opposite of
each other, so we'll want the dot product to be equal to the negative magnitude of
a times the magnitude of b. If we're trying to come up with a general case,
right, so not just for these specific angles but any angle in between. You
might look at it notice so we're starting at one when the angle is zero,
at pi on 2, we're going to 0 and then at pi it reaches negative one. This might
look familiar because this is just a cosine curve, so, in general, we're going
to say that a dot b is equal to the magnitude of a times the magnitude of B
times the cosine of the angle between them. So, so far, we have two different
definitions for the dot product. One works when we're talking about angles
and the other is when we're talking about Cartesian positions. It turns out,
of course, that these two things are equal. We can prove this using the law of
cosines. I've done the set up here but I'm gonna leave the actual proof to you!
So, we've talked a little bit about what the dot product is and how to calculate
it, but before we get into the applications, I want to give you some
main takeaways or some important things to remember. Now this first one, we've
actually talked a little bit about but it's such an important point that I'm
going to re-emphasize it here if you take the vector a and dot it with the
vector b and the result is 0, that is equivalent to saying that a and b are
orthogonal or perpendicular. Another important thing to note is that
if you take a vector and dot it with itself you're going to get the magnitude
of that vector squared. The next thing I want to talk about is how we can
generalize this into three dimensions or even higher. If we have a three
dimensional vector, it's going to have an x component a y component and a z
component, and we can dot that with another vector.
And just like before, we're going to start by multiplying the two x terms
then we multiply the two y terms, and now since we're in three dimensions, we also
need to add the multiple of the two z terms. Lastly, I want to talk about how we
can find the angle between two vectors using the dot product. We defined a dot b
as equal to the magnitude of the first time's the magnitude of the second times
the cosine of the angle between them, well if we divide both sides by the two
magnitudes and then take cosine inverse on both sides, were left with the angle
between the two vectors. I wanted to leave this video talking about a couple
of applications of the dot product and we're gonna start by talking about
physics. The first one that you're likely to run into is the calculation for work.
So let's say we apply some force on an object, but it moves in a different
direction. Now how would we find the work done by this force? Well you can sort of
think of it as we want to find how much of the force is going in the delta r
direction, and as we've talked about that's just as easy as calculating F dot
delta r. Another application in physics of the dot product is in quantum
mechanics. In quantum mechanics you're actually working with a more general
version of the dot product and that's called an inner product. If you've seen
this notation, that's essentially what it represents is an inner product. Another
common place you'll see dot products is in linear algebra, a lot, and linear
algebra is one of the most important areas of math when it comes to
applications. If you're talking about matrices, a really important subset of
them has this property of orthogonality which basically means the columns of the
matrix are orthogonal. Now, we're not gonna get too much into this, but
orthogonality is really important and as we've shown before, you can show
orthogonality using the dot product. Another place the dot product is really
important is when you're looking at projections. So let's say I have some
line and I have some point how am I going to project the point onto the line?
Well, to project it with the least error, we're
going to do it orthogonal to the line. In this case we're projecting one point on
to a line, but you also might project a point onto a plane, and dot products actually
build the foundation for us to be able to do more complex things like
projecting points onto planes or maybe even lines onto planes, etc. Another use
case for the dot product is when you're working with weighted sums. If you look
at the first formula for dot products that we looked, at let's say we have some
vector a and we're dotting it with another vector w. If we expand that out
it's gonna be a 1 times w 1 plus a 2 times w 2 and this goes on and on and on
until you know we eventually reach however many dimensions the vector is
in. And you can kind of see that this acts as a weighted sum so w 1 would be
the weight of the first component w 2 would be the weight of the second, and
this ends up being really important if you're looking in machine learning and
neural networks use a lot of weighted sums and that's essentially the
foundations for how neural networks work. So dot products are incredibly important
in a lot of different applications. If you don't want to miss my video on the
cross product, be sure to subscribe. If you enjoyed the video give it a like, and
if you have any questions or spotted any mistakes feel free to leave a comment.
Thanks for watching.