Dot Product Calculator
Multiply matching vector components and add them to get the dot product and the angle between the vectors.
What it does
The dot product takes two vectors and returns a single number. You multiply each pair of matching components and add the products. Because it collapses two vectors into a scalar, it is also called the scalar product.
This tool accepts vectors of one to six components. Enter them as comma separated numbers. Both vectors must have the same length, and at least one component in each vector must be nonzero.
The geometric meaning is just as useful as the arithmetic. The dot product equals the product of the two lengths times the cosine of the angle between them. A positive value means the vectors point generally together, a negative value means they point apart, and zero means they are orthogonal.
The page also reports each magnitude. Magnitude is the square root of the dot product of a vector with itself, which is the familiar distance formula in two or three dimensions. These lengths let you check the angle calculation by hand.
Dot products appear whenever you project one direction onto another, measure work as force along displacement, or test whether two directions are independent. Keeping the component formula and the cosine formula side by side makes those uses easier to follow.
How to use
- Type the components of vector a, separated by commas.
- Type the same number of components for vector b.
- Read the main result, which is the dot product.
- Check the two magnitudes to see the lengths used in the angle calculation.
- Look at the angle in degrees and the relation label for a quick geometric reading.
- Try (1, 0) and (0, 5) to see a zero dot product and a right angle.
Formula
- a_i, b_i
- The components of the two vectors, matched by position.
- |a|, |b|
- The magnitudes, each the square root of the sum of squared components.
- theta
- The angle between the vectors, reported here in degrees.
For two dimensional vectors (p, q) and (r, s), the dot product is p times r plus q times s. For three dimensions, add the third product. The angle follows from cos(theta) equal to the dot product divided by the product of magnitudes, after clamping the ratio to the range minus one to one.
Worked example
Example: two three dimensional vectors
The page opens with a = (1, 2, 3) and b = (4, 5, 6).
- Multiply matching components: 1 times 4 is 4, 2 times 5 is 10, and 3 times 6 is 18.
- Add the products: 4 plus 10 plus 18 gives a dot product of 32.
- Magnitude of a is the square root of 1 plus 4 plus 9, which is the square root of 14, or 3.742.
- Magnitude of b is the square root of 16 plus 25 plus 36, which is the square root of 77, or 8.775.
- The cosine of the angle is 32 divided by 3.742 times 8.775, about 0.9746.
- Taking the inverse cosine gives an angle of 12.93 degrees, so the relation is At an angle.
- The tool reports dot 32, magnitudes 3.742 and 8.775, and angle 12.93 degrees.
Reference table
| Vectors a and b | Dot product | Angle | Relation |
|---|---|---|---|
| (1, 0) and (0, 5) | 0 | 90.00 ° | Orthogonal |
| (2, 4) and (1, 2) | 10 | 0.00 ° | Parallel |
| (3, -1) and (2, 6) | 0 | 90.00 ° | Orthogonal |
| (1, 2, 3) and (4, 5, 6) | 32 | 12.93 ° | At an angle |
Limits
- Each vector is limited to 6 components.
- Components must be numbers between minus 1,000,000 and 1,000,000.
- A vector with all zero components is rejected because its angle is undefined.
- Angles are reported in degrees with two decimal places.
Common mistakes
- Multiplying components across instead of matching them by position.
- Adding the components first and then multiplying the totals.
- Forgetting to take the square root when finding magnitudes.
- Reading a negative dot product as a negative angle.
- Ignoring a zero dot product, which always means a right angle for nonzero vectors.
Try it yourself
Quick checks. Answers sit tucked under each question.
Dot product of (1, 0) and (0, 5)?
0. The vectors are orthogonal, and the tool shows an angle of 90.00 °.
Dot product of (2, 4) and (1, 2)?
10. The second vector is half the first, so the angle is 0.00 ° and the relation is Parallel.
Magnitudes of (1, 2, 3) and (4, 5, 6)?
3.742 and 8.775, from the square roots of 14 and 77. Their dot product is 32.
Questions
What is the dot product used for?
It measures how much two vectors point in the same direction and underlies projection and work calculations.
What does a zero dot product mean?
For nonzero vectors it means they are orthogonal, so the angle between them is 90 degrees.
Can a dot product be negative?
Yes. A negative value means the angle between the vectors is greater than 90 degrees.
Must both vectors have the same length?
They must have the same number of components. Their geometric lengths can differ.
How is the angle found?
Divide the dot product by the product of the two magnitudes, then take the inverse cosine.
What is the dot product of a vector with itself?
It is the squared magnitude, so taking its square root gives the vector length.
Sources
- MIT 18.022, section 2.2: dot or scalar product
- MIT 18.022 lecture notes: dot product, norm and angle
- MIT, calculus for beginners, chapter 7: vectors in two dimensions