Dot Product Calculator
The vector dot product calculator comes in handy when you are solving vector multiplication problems. Instead of calculating the scalar product by hand, you can simply input the components of two vectors into this tool and let it do the math for you. Keep reading to learn the dot product formula our calculator uses, how to estimate the dot product of two vectors, and how to generalize the formula for matrix dot product. Together with the cross product calculator, you'll learn that vector algebra isn't anything to worry about!
Vector multiplication types
There are two main types of vector multiplication: the dot product (also called the scalar product), denoted with the symbol "·", and the cross product, denoted with the symbol "×". The main difference is that the product of the dot operation is a single number, while the outcome of the cross operation is a vector.
What is the dot product formula?
Let's assume that all our calculations will be performed in 3D space. That means that every vector can be written down using three components:
a = [a₁, a₂, a₃]
b = [b₁, b₂, b₃]
Geometrically, the dot product is described as the product of the vectors' magnitudes multiplied by the cosine of the angle between them. It can be expressed using the equation:
a·b = |a| * |b| * cosα
If you are not sure what the magnitude of a vector is or how to calculate it, head to the unit vector calculator for more details on the subject.
You can probably notice that if the angle between two vectors is equal to 90°, then the scalar product will always be equal to 0, regardless of the vectors' magnitudes. Similarly, if the angle is equal to 0° (the vectors are collinear), then the dot product is found by multiplying the multitudes only. In other words, the bigger the relative slope between two vectors, the higher the value of dot product.
Algebraically, the dot product is the sum of products of the vectors' components. For three-component vectors, the dot product formula looks as follows:
a·b = a₁ * b₁ + a₂ * b₂ + a₃ * b₃
In a space that has more than three dimensions, you simply need to add more terms to the summation. If, on the other hand, you want to multiply vectors in a 2D space, you have to omit the third term of the formula.
cosα = a·b / (|a| * |b|).
Determining the vector dot product
So, how does our vector multiplication calculator work? Follow this step-by-step example to get a better understanding of the principle behind this process.
- Choose your vector a. For example, we will take a = [4, 5, -3].
- Choose your vector b. Let's assume it is equal to b = [1, -2, -2].
- Calculate the product of the first component of each vector. In this case, it is equal to
4 * 1 = 4.
- Calculate the product of the second (middle) component of each vector. In this case, it is equal to
5 * (-2) = -10.
- Calculate the product of the third component of each vector. In this case, it is equal to
(-3) * (-2) = 6.
- Add all of these results together to find the dot product of the vectors a and b.
4 + (-10) + 6 = 0
The result is 0. This is the scalar product of these two vectors. It means that they are perpendicular to each other (the angle between them is equal to 90°).
Scalar product in spherical coordinates
It is also possible to calculate the scalar product of two vectors if they are written in spherical coordinates. To deal with the challenge, we need to express our new coordinates with the radius
r and two angles
x₁ = r₁ * sinφ₁ * cosθ₁,
y₁ = r₁ * sinφ₁ * sinθ₁,
z₁ = r₁ * cosφ₁
And analogically for
z₂. Then, the result will be:
a·b = x₁*x₂ + y₁*y₂ + z₁*z₂ = r₁*r₂ * sinφ₁*cosθ₁ * sinφ₂*cosθ₂ + r₁*r₂ * sinφ₁*sinθ₁ * sinφ₂*sinθ₂ + r₁*r₂ * cosφ₁*cosφ₂.
If we use the equation for the cosine of the angles difference the formula simplifies to:
a·b = r₁*r₂ * (sinφ₁*sinφ₂ * cos(θ₁-θ₂) + cosφ₁*cosφ₂).
Matrix dot product
Actually, the dot product operation can not only be done for vectors but also for more general cases - matrices. As a result, we obtain another matrix
C, such that:
cij = ai1b1j + ai2b2j + … + ainbnj = Σk aikbkj.
It's analogous to the scalar product of simple vectors, but the procedure has to be repeated several times for each element.
However, not every two matrices can be multiplied. If we consider
m x n and
k x l matrices, then for the resulting matrix
C = A·B
n has to be equal to
k, and, for matrix
D = B·A,
l must be the same as
m. In other words, the number of columns of the left matrix has to match the number of rows in the second one.
As you may have already noticed, products
B·A are different in general, which means that the scalar product of two matrices is noncommutative. In particular, the dimensions of the resulting matrices aren't the same.
The dot product of two vectors - graphical interpretation
Let's take a look at the dot product formula in detail. If we draw both vectors separated by the angle and then try to find the image of the scalar product, we will realize that this consists of the multiplication of two parts: the projection of one vector to the direction of the second one and the same but for the second vector. Since they are both parallel, the result is just the product of their lengths. As shown in the picture, the operation can be performed in two ways, but the result is always the same. As a conclusion of this section, we can say that the dot product is a multiplication of a vectors' lengths, projected in the direction of one of the other.
A particular case is the dot product of a vector with itself,
a² = a·a. Since the projection and the vector is the same thing, the outcome is the square of the vector's length. In other words, we can find the length of any vector using the square root over the following dot product:
|a| = √(a·a).
Triple product - how to calculate the volume of a parallelepiped?
Besides the scalar product and the cross product there is another mathematical tool which makes it possible to provide a calculation for three vectors. We can define a triple product (or mixed product) as a combination of a dot product and a vector product. The formula of the triple product can be expressed as:
V = a · (b × c).
b × c is a vector which means that the overall result is a scalar product of two vectors, and is just a number. The letter
V isn't a coincidence because there's a direct correlation between the mixed product and the volume.
Let's look at an example:
- Construct a parallelepiped in the Cartesian coordinate system.
- Denote its sides as
c- we can interpret them as vectors attached in one point.
- The value of
b × c = |b||c|sinαresembles the formula for the area of a parallelogram. As a result, we get the vector which length is equivalent to the area of the base, and it's perpendicular to it.
- The last step is to calculate the dot product of
a·d. As we know from the previous section, it's the projection of
ato the direction of
d. If we take a closer look, we can realize that this projection is actually the height of our polyhedron and the resulting product is nothing but its volume!
One important remark - the triple product can be estimated in a few equivalent ways:
a · (b × c) = b · (c × a) = c · (a × b)
The crucial thing is that the order
a-b-c-a-b-c-... has to be conserved. Otherwise, the result will be negative. We can always circumvent the problem working out the volume as an absolute value of the triple product.
β are equal 90°, then the outcome is nothing else but the volume of rectangular prism!
Applications of dot product
There are several areas where scalar product turns out to be handy.
- The law of cosines can be proved with the usage of the dot product: If we create a triangle out of 3 vectors, we can write that e.q.
c = b - a. If we want to find
c², we can expand the formula as:
c² = (b-a)·(b-a) = b·b – b·a – a·b + a·a = a² + b² - |b| * |a| * cosa - |a| * |b| * cosa = a² + b² – 2 * |a| * |b| * cosα.
The last step is obviously possible because the multiplication of lengths is commutative. And that's it - another way to prove the cosine law!
As it was mentioned at the beginning - the scalar product is the simplest way to find if two vectors are perpendicular to each other.
Many physical quantities are defined as a scalar product: