Today we are talking about one of my favorite topics, dot products of vectors. Why is it one of my favorite topics? Because this topic refers to a situation in which I take two vectors, multiply them together, and get a “regular” number. It’s sort of like magic, that two “non-regular numbers” can give us a “regular” number when we multiply them together, and I love magic, and multiplication, and math.
But let’s back up and explain a few things, such as: What are vectors? What do I mean when I say “regular” numbers? How are they different from vectors? And what in the world are dot products?
What are Vectors?
So, vectors. The term vector means, “a quantity possessing both magnitude and direction.” This means that instead of a regular number like “5,” a vector could be “5 in the right direction,” or “5 in the left direction,” or “5 but pointed at an angle of 30 degrees…” or really any other direction you can think of. Because this kind of directional description can get cumbersome really quickly, we usually represent vectors by writing a number and then an arrow above the number. So for all of the vectors described above, we would write: Then we would have to separately specify what direction this particular vector is pointing in.
Real Life Examples of Vectors
You are probably thinking, OK, fine, but it still sounds kind of weird. Do we actually use vectors in real life? We sure do! Let’s use a really common example, like driving a car. When I drive my car, I can describe my travel by saying I am going 50 miles per hour, which is a speed. If I say I am going 50 miles per hour heading northeast, however, I have just described a vector! This description has both a number (50 miles per hour) and a direction (northeast), and we refer to this descriptor (“50 miles per hour heading northeast) as the velocity of my car. Compared to describing just the speed of the car, my velocity descriptor has more (and potentially useful!) information.
Scalars
So travel velocities are definitely vector quantities, but what is the term for speed, and other cases where we are just using numbers but don’t have directions? Can we just call them “non-vectors”? We could…but we actually have a unique name for these kinds of numbers: scalars. Scalars, unlike vectors, refer to numbers that don’t have a direction attached. So if I drive my car 50 miles per hour southwest, that has the same speed (or scalar quantity) as driving 50 miles per hour northeast. But if I am driving northeast, I am much more likely to get to my vacation rental in Maine, and if I am driving southwest, I will probably end up in Connecticut (i.e., not the target destination).
Component Parts
Now that we understand vectors and scalars, it’s time to talk about dot products. In general, if I want to do regular mathematical operations with vectors, I have unique rules. For addition and subtraction, for example, I have to add (or subtract) the component parts of each vector to get my answer. What are component parts, you might ask? Well, each vector can be broken up into a horizontal component (i.e., how far are we moving along a horizontal axis), and a vertical component (i.e., how far we are moving along a vertical axis). When we describe the vectors in terms of their component parts, then adding two vectors means that we add the two horizontal components and add the two vertical components, to arrive at our solution.
So, what about multiplying two vectors? Can we just multiply the component parts? Not precisely, but we have two options.
Dot Products
One option, which we will focus on today, is called the “dot product,” which is also known as the “scalar product.” In this option, we multiply two (or more vectors), and our answer is a single scalar value. How fun! How do we do this?
Let’s say we have two vectors, each of which has an x-component and a y-component. To get the dot product, we simply multiply the x-components together, and multiply the y-components together, and then add the two numbers together. The result is our “dot product,” which is a single, scalar number.
What if we have more than two dimensions (like an x-, y-, and z-direction)? Well then, we multiply all of the x-components, all of the y-components, and all of the z-components, and add our products together to arrive at the answer. Once again: a single (scalar) number as the answer to a more complicated-looking dot product problem.
How do I know that the question is asking to find a dot product? It usually is symbolized with a dot between the two vectors. This may even be how the “dot product” got its name!
Let’s do a few examples so that this (somewhat lengthy) explanation can actually make some sense.
Example 1:
Calculate the dot product of two vectors with the following vector components:
Vector A: (1, 3) and Vector B: (2, 4)
Solution strategy: We multiply the two x-components, separately multiply the two y-components, and add the two products together.
Actual solution: 1*2 + 3*4 = 2 + 12 = 14
Example 2:
Calculate the dot product of a = (1,2,0) and b = (4,-2,6).
Solution: The first step is to recognize that we are looking at vectors with three components: an x-component (listed first), a y-component (listed second), and a z-component (listed third).
We multiply the two x-components: 1*4 = 4
Then multiply the two y-components: 2*-2 = -4
Then multiply the two z-components: 0*6 = 0
And then we add all of the products together: 4-4+0 = 0
The dot product of these two vectors is: 0
Example 3:
What if we now have 4 components? How can we find the dot product of the two vectors show below?
Four components are no problem for us, since we can just multiply each component and then add the resulting products! We could have an infinite number of components, in fact, and use the same procedure (it just might take a while).
Here the solution is the following: (9*-3) + (5*-2) + (-4*7) + (2*-1) = -27-10-28-2= -67
Sometimes, though, we don’t know the various vector components, and then it can become more complicated to figure out the dot product of two vectors. What do we do then? Throw up our hands in frustration and go home?
Not at all! We can use a different formula to calculate dot products, in which we multiply the magnitude of the first vector times the magnitude of the second vector and times the cosine of theta, where theta is defined as the angle between the two vectors. We can represent this formula mathematically, in the way that is shown below:
How do we use this rule in real-life examples? Let’s see!
Example 4:
Let’s say that vector A has a magnitude of 10, vector B has a magnitude of 13, and the angle between the two vectors is 60 degrees. What is their dot product?
Solution: Here we have all of the information that we need to use the cosine rule – and so we just plug in our values:
The dot product of vectors A and B = 10 * 13 * cos (60 degrees) = 10 * 13 * 0.5 = 65.
So simple!
Let’s also look at a few unusual examples of dot products using the cosine formula.
Example 5:
What is the dot product of two vectors, where vector A has a magnitude of 5, vector B has a magnitude of 1, and the angle between them is 90 degrees?
Solution: Here we can also use the cosine formula, to calculate the following:
Dot product = 5 * 1 * cos (90) = 5 * 1 * 0 = 0.
It turns out that every time there is a 90-degree angle between two vectors, their dot product equals zero! Alternatively, we can use this information to say that two vectors are perpendicular when the angle between them is 90 degrees OR when their dot product equals zero, since both are equally true!
How about one final example? Sure!
Example 6:
What is the dot product of two vectors, where vector A has a magnitude of 3, vector B has a magnitude of 2, and the angle between them is 0 degrees?
If we use the cosine formula here, we will find that the dot product = 3 * 2 * cos (0) = 3 * 2 * 1 = 6.
So that if there is no angle between the two vectors (meaning they are pointing in exactly the same direction), then their dot product is simply the product of their magnitudes.
Have fun with your dot product calculations!
Author: Mindy Levine
Very clear. Awesome website. Will visit and use again!