Dot Product Calculator
Calculate the dot product of two vectors from their components, plus each vector's magnitude and the angle between them via arccos.
Dot Product Calculator
Calculator
Adjust values & calculateEnter your values below. Every result is computed in your browser — no data is sent to any server.
Formula: A·B = a₁b₁ + a₂b₂ + a₃b₃ | Angle θ = arccos(A·B / (|A| × |B|))
Worked example — A dot B = 32 | angle = 12.93 degrees
Formula
A·B = a₁b₁ + a₂b₂ + a₃b₃ | Angle θ = arccos(A·B / (|A| × |B|))
The dot product (scalar product) of two vectors equals the sum of products of corresponding components. It also equals |A||B|cos(θ), where θ is the angle between them. Dot product = 0 means vectors are perpendicular.
Worked Examples
Example 1: Dot product and angle between two 3D vectors
Problem:A = (1, 2, 3) and B = (4, 5, 6). Find A dot B and the angle between them.
Solution:A dot B = (1)(4) + (2)(5) + (3)(6) = 4 + 10 + 18 = 32 |A| = sqrt(1 + 4 + 9) = sqrt(14) = 3.7417 |B| = sqrt(16 + 25 + 36) = sqrt(77) = 8.7750 cos(theta) = 32 / (3.7417 x 8.7750) = 32 / 32.8329 = 0.97463 theta = arccos(0.97463) = 12.93 degrees A small angle and a large positive dot product both say the vectors point in nearly the same direction.
Result:A dot B = 32 | angle = 12.93 degrees
Example 2: Work done by a force (the physics use of the dot product)
Problem:A force F = (12, 5) newtons drags a crate along a displacement d = (8, 0) metres. How much work is done?
Solution:Work is the dot product of force and displacement: W = F dot d. W = (12)(8) + (5)(0) = 96 + 0 = 96 joules Only the component of the force along the motion does work; the 5 N vertical component contributes nothing because the crate does not move vertically. Check via magnitudes: |F| = sqrt(144 + 25) = 13, |d| = 8, so cos(theta) = 96/(13 x 8) = 96/104 = 0.92308 and theta = 22.62 degrees. Scalar projection of F onto d = (F dot d)/|d| = 96/8 = 12 N, exactly the horizontal component.
Result:W = 96 J | angle between F and d = 22.62 degrees | projection of F onto d = 12 N
Example 3: Testing whether two vectors are perpendicular
Problem:Are A = (3, -2, 4) and B = (2, 5, 1) perpendicular?
Solution:A dot B = (3)(2) + (-2)(5) + (4)(1) = 6 - 10 + 4 = 0 A dot product of exactly zero means cos(theta) = 0, so theta = 90 degrees. Neither vector is the zero vector (|A| = sqrt(29) = 5.385, |B| = sqrt(30) = 5.477), so the zero is genuine orthogonality rather than a degenerate case. This zero test is the fastest perpendicularity check there is: no square roots and no inverse cosine required.
Result:A dot B = 0, so the vectors are perpendicular (90 degrees)
Frequently Asked Questions
What does the dot product represent?
Geometrically, A·B = |A||B|cos(θ). It measures how much one vector projects onto another. Positive = same general direction, negative = opposite, zero = perpendicular.
Dot product vs cross product?
Dot product gives a scalar (number). Cross product (3D only) gives a vector perpendicular to both inputs with magnitude |A||B|sin(θ). Dot product measures alignment; cross product measures perpendicularity.
How is the dot product used in machine learning and AI?
The dot product is one of the most fundamental operations in machine learning. Neural network layers compute weighted sums using dot products between input vectors and weight matrices. In natural language processing, word embeddings and sentence embeddings are compared using cosine similarity, which normalizes the dot product by the product of the vector magnitudes. Attention mechanisms in transformers (the foundation of large language models) compute dot products between query and key vectors to determine which parts of the input to focus on. High dot product values indicate high similarity or relevance between vectors.
What is the vector projection formula using the dot product?
The scalar projection of vector A onto vector B is the dot product A·B divided by the magnitude of B, giving the length of the shadow A casts along B. The vector projection multiplies this scalar by the unit vector of B, giving the actual projected vector component along B's direction. Projections are used in physics to decompose forces into components along an inclined plane, in computer graphics for lighting and shading calculations, and in statistics for finding the portion of variation explained by a particular direction in principal component analysis.
How do I test whether two vectors are orthogonal with this tool?
Orthogonality means the dot product is exactly zero, which by A.B = |A||B|cos(theta) forces the angle to 90 degrees whenever neither vector is zero. Because component values are held in floating point, Dot Product Calculator treats any magnitude below 1e-10 as zero and reports 'Perpendicular', which avoids a tiny rounding residue being read as a real angle. A positive dot product means the angle is acute, a negative one means it is obtuse.
What algebraic properties does the dot product obey?
It is commutative, A.B = B.A, and distributive over vector addition, A.(B + C) = A.B + A.C. Scalars pull straight out: (kA).B = k(A.B). It is not associative, because A.B is a scalar and a scalar cannot be dotted with the vector C, so the expression A.B.C is meaningless. These properties are what let you expand |A + B|^2 as |A|^2 + 2 A.B + |B|^2, the vector form of the law of cosines.
Why must both vectors have the same number of components?
The dot product is defined as a sum of products of corresponding components, so every entry in A needs a partner in B. A three-component vector has no fourth term to pair with, and the sum is undefined, which is why Dot Product Calculator returns no result when the two lists differ in length. Geometrically the two vectors must live in the same space before an angle between them means anything, so pad or trim your data before comparing.
What does the dot product of a vector with itself give you?
A.A equals the sum of the squares of the components, which is exactly the square of the magnitude: A.A = |A|^2. That identity is how the tool obtains |A| and |B| for the angle calculation, and it is the algebraic form of the Pythagorean theorem in any number of dimensions. It also means A.A is never negative and equals zero only for the zero vector, the property that makes the dot product a valid inner product.
How does the dot product describe the work done by a force?
Work is the dot product of the force vector and the displacement vector, W = F.d = |F||d|cos(theta), so only the component of the force lying along the direction of motion contributes. A force applied at right angles to the motion, such as the tension in a string swinging a mass in a circle, has cos(90 degrees) = 0 and does no work at all. A force opposing the motion gives a negative dot product and therefore removes energy.
When is the reported angle undefined or unreliable?
If either vector is the zero vector its magnitude is zero, the cosine expression divides by zero and no angle exists, because a zero vector has no direction. Near-parallel or near-antiparallel vectors are the other awkward case: accumulated rounding can push the computed cosine slightly past 1 or -1, so the value is clamped into that range before the arccosine is taken. Angles very close to 0 or 180 degrees are therefore the least precise part of the output.
References
Reviewed for accuracy by Manoj Kumar, Mathematics Educator · Editorial policy
Related Calculators
🧮Product Rule Calculator
Calculate product rule with inputs, formulas, and instant results.
🧮Cross Product Calculator
Calculate cross product with inputs, formulas, and instant results.
🧮Kronecker Product Calculator
Calculate kronecker product with inputs, formulas, and instant results.
🧮Tensor Product Calculator
Calculate tensor product with inputs, formulas, and instant results.
🧮Hadamard Product Calculator
Calculate hadamard product with inputs, formulas, and instant results.
🧮Annulus Area Calculator
Calculate annulus area with inputs, formulas, and instant results.
🧮Area Calculator
Calculate area with inputs, formulas, and instant results.
🧮Area of a Rectangle Calculator
Calculate the area, perimeter, and diagonal of a rectangle. Find missing sides from known area. Convert between metric and imperial area units.