In this explainer, we will learn how to find the dot product of two vectors in 2D.
There are three ways to multiply vectors. Firstly, you can perform a scalar multiplication in which you multiply each component of the vector by a real number, for example, . Here, we would multiply each component in vector by the number three. Secondly, we can multiply a vector by another vector; here, there are two different methods, the dot product and the cross product. In this explainer, we are only going to look at the dot product.
Suppose we have a vector that is and a vector that is . Their dot product is written as . Notice here that the dot is central to the two vectors, not at the base of each. Now, to calculate the dot product, we need to write out the two vectors in component form, multiply the corresponding components of each vector, and add the resulting numbers.
Definition: Dot Product of Two Vectors
The dot product of two vectors and is given by multiplying the corresponding components of each vector and adding the resulting numbers:
This is demonstrated in example 1.
Example 1: Finding the Dot Product of Two-Dimensional Vectors
Given the vector and the vector , find .
Recall that the dot product of two vectors and is given by
Hence, we have
Notice in this example that we have written “,” which is another way of writing “.” We use the first notation to avoid any possible confusion with the vector cross product, which, as the name suggests, uses a cross instead of a dot. Notice, too, that the dot product produces an answer that is a numerical value, or a scalar. It is worth noting here that the dot product is also called the scalar product for this reason.
Let us see what happens when we carry out the dot product , where is a nonzero real number and and . The components of are then and we find that
Similarly, we find that and
As this is an important property, let us take note of it here.
Property: Scalar Multiplication and Dot Product
For real numbers and , we have
Additionally, we find from the definition that which, given that multiplication is commutative, leads to
This proves the commutativity of the dot product.
Property: Commutativity of the Dot Product
The dot product is commutative:
Let us now consider three vectors , , and and work out the dot product . We have ; hence,
We finally find that
This equation shows that the dot product is distributive.
Property: Distributivity of the Dot Product
The dot product is distributive:
Let us consider a useful property that the dot product has when we take the dot product of a vector with itself, which we will calculate in the following example.
Example 2: Calculating the Dot Product of a Vector with Itself
Given that , find .
Recall that the dot product of two vectors and is given by
Since , we have
To see how this result is significant, let us calculate the magnitude of the same vector. First, we draw a sketch of the vector.
We can work out its magnitude by finding its length using the Pythagorean theorem. So, the magnitude of , usually denoted by , is calculated as follows:
If we compare the magnitude and the dot product, we find the following property.
Property: Dot Product and Magnitude
The magnitude of a vector is equal to the square root of its dot product with itself:
The dot product of two vectors can be interpreted geometrically, as given in the following definition box.
Definition: Geometrical Definition of the Dot Product
The dot product of two vectors and equals the product of their magnitudes with the cosine of the angle between them: where is the angle between and .
The geometrical interpretation shows us that the “closer” the two vectors are, the larger the dot product, because the smaller the angle, the larger its cosine. Therefore, the maximum value of the dot product of two vectors of given magnitudes occurs when the two vectors have the same direction, that is, when the angle between them is zero.
The dot product of two collinear vectors having the same direction is which, since , gives
This is consistent with what we have found before for the dot product of a vector with itself.
When two vectors and are collinear but have opposite directions, the angle between them is , with a cosine of , so that their dot product is then given by
On the other hand, when two vectors and are perpendicular, their dot product is zero since the cosine of the angle between them () is zero. It is an important property that can be used to check whether two vectors of given components are perpendicular.
Property: Dot Product of Two Perpendicular Vectors
The dot product of two perpendicular vectors is zero. Conversely, when the dot product of two vectors is zero, the two vectors are perpendicular.
Let us look at an example where we need to use this property.
Example 3: Finding the Dot Product of Two Vectors in a Square
Square has a side of 10 cm. What is ?
We can start answering this question by sketching square and vectors and .
We see that and are perpendicular since two adjacent sides of a square are perpendicular. The angle between the two vectors is , and, as , we have
The answer is .
Let us look at another example where we need to use the property of perpendicular vectors.
Example 4: Finding the Missing Component of a Vector Given That It Is Perpendicular to Another
Given that , , and , determine the value of .
and are two perpendicular vectors; this means that their dot product is zero. Let us therefore calculate their dot product using their components: where are the components of and are those of .
Substituting into our equations the actual components of and , we get
As and are perpendicular, their dot product is zero, which gives
With our last example, we will see how to find a dot product using its geometric definition.
Example 5: Finding the Dot Product of Two Vectors in a Triangle
Given that is an isosceles triangle, where and , determine .
Let us first sketch triangle and vectors and .
We are asked to find . For this, we need to work out the angle between and and the magnitude of .
To find the angle between the two vectors, we draw a vector equivalent to so that the initial points of and are coincident.
In isosceles triangle , . The angle between and is ; therefore, we have
To find the magnitude of , since we are given the lengths of and , we simply consider that the magnitudes of the vectors are given here by their lengths in centimetres. Hence, we need to find length . For this, we can use the sine rule in triangle . It gives
We can now find by writing that where is the angle between and . Substituting the magnitudes of and and the value of into our equation gives us
With , we find
As a final note, let us see how to derive the law of cosines using the distributivity of the dot product and its geometrical definition. For any three points , , and , we can write
Expanding the parentheses, we find that
Since , we have
Let be the angle between and as shown in the diagram above. We have
The angle between and is ; therefore, we have
And, as for any , we find which corresponds to the law of cosines, with , , , and .
Let us summarize what we have learned in this explainer.
- The dot product of two vectors and is given by multiplying the corresponding components of each vector and adding the resulting numbers:
- We have .
- The dot product is commutative: .
- The dot product is distributive: .
- The dot product of two vectors and equals the product of their magnitudes with the cosine of the angle between them: where is the angle between and .
- The dot product of two perpendicular vectors is zero. Conversely, when the dot product of two vectors is zero, the two vectors are perpendicular.