Math · 93 calculators
Dot Product Of Two Vectors Calculator
The dot product turns two vectors into a single number. Multiply matching components, add the results, and you have a scalar that records how much of one vector points along the other. The same number can be read geometrically as the product of the two lengths and the cosine of the angle between them. This page shows both views, works through three pairs of vectors and explains the related ideas of cosine similarity and scalar projection.
Last updated
Dot product
32
- Magnitude of the first vector
- 3.7417
- Magnitude of the second vector
- 8.775
- Cosine similarity
- 0.9746
- Scalar projection of a onto b
- 3.6467
Values update as you type. This calculator covers the single scenario its formula assumes — see Common Mistakes for what it leaves out.
The formula this calculator uses
a · b = a1b1 + a2b2 + a3b3
- a
- The first vector, written (a1, a2, a3)
- b
- The second vector, written (b1, b2, b3)
- a · b
- The dot product, a single scalar number
How to check the result by hand
- 1
Write down the components in matching order
Label the first vector (a1, a2, a3) and the second (b1, b2, b3) before doing any arithmetic. With the default inputs these are (1, 2, 3) and (4, 5, 6). Matching positions matter: a1 pairs with b1, a2 with b2 and a3 with b3. Getting the order wrong is the fastest way to a plausible but incorrect answer.
- 2
Multiply matching components
Form the three products a1b1, a2b2 and a3b3 separately. For the defaults these are 1 x 4 = 4, 2 x 5 = 10 and 3 x 6 = 18. Keep a note of the sign of each product, because a negative component multiplied by a positive one stays negative. At this stage the quantities are still ordinary numbers rather than a vector.
- 3
Add the products to obtain the scalar
Sum the three results to obtain the scalar a · b. Here 4 + 10 + 18 = 32. A positive total means the vectors are separated by an acute angle, a negative total means an obtuse angle and zero means a right angle. Check the sign against the components before moving on, because a dropped minus sign flips the interpretation completely.
- 4
Compute the two magnitudes
Square and add the components of each vector and take the square root. For a this is sqrt(1 + 4 + 9) = sqrt(14), about 3.7416573867739413, and for b it is sqrt(16 + 25 + 36) = sqrt(77), about 8.774964387392123. These lengths are needed for every derived measure and are already computed by the calculator.
- 5
Derive the similarity and the projection
Divide the dot product by both magnitudes to get cosine similarity, 32 divided by (sqrt14 x sqrt77), about 0.9746318461970762. Divide by the magnitude of b alone to get the scalar projection, 32 divided by sqrt(77), about 3.6467384467084143. The similarity is dimensionless and must lie between -1 and 1, while the projection is a signed length in the units of a. Neither step requires measuring an angle.
Common Questions
How does the Dot Product Of Two Vectors Calculator work?
Pair each component of a with the component of b in the same position, multiply the pairs and add them. For a = (1, 2, 3) and b = (4, 5, 6) the result is 4 + 10 + 18 = 32. The geometric form |a||b|cos(theta) explains why the answer is positive for acute angles, zero for perpendicular vectors and negative for obtuse ones.
What do I need to enter in the Dot Product Of Two Vectors Calculator?
It takes 6 inputs: First vector x component, First vector y component, First vector z component, Second vector x component, Second vector y component, Second vector z component. Fields that expect a unit say so next to the label.
Where does Dot product come from?
It comes from a · b = a1b1 + a2b2 + a3b3 — multiply the components that occupy the same position in each vector, then add the three products to obtain a single scalar.
What is the most common mistake with the Dot Product Of Two Vectors Calculator?
Treating the result as a vector. The dot product has no components and no direction. It is one scalar number, so writing an answer such as (32, 0, 0) is a category error. If a vector answer is required, the operation wanted is the vector projection, which multiplies the scalar projection by the unit vector b/|b|.
For worked examples, common mistakes and the limits of this formula, read the full How To Calculate The Dot Product Of Two Vectors page.
