Dot Product Calculator
Calculate the scalar dot product of two 2D or 3D vectors and find the angle between them.
Results
The Dot Product
The dot product (also called the scalar product or inner product) takes two vectors and produces a scalar number. It is one of the most important operations in linear algebra and has direct physical meaning in terms of projection and work.
The Formula
A·B = AxBx + AyBy (2D), or A·B = AxBx + AyBy + AzBz (3D). This algebraic formula equals the geometric formula |A||B|cos(θ), where θ is the angle between the vectors. The two formulas give the same result and are different ways of computing the dot product.
Geometric Interpretation
The dot product measures how much one vector projects onto the other. A·B = |A| × (projection of B onto A) = |B| × (projection of A onto B). When vectors point in the same direction (θ=0°), the dot product equals |A||B| (maximum positive). When perpendicular (θ=90°), the dot product is 0. When pointing opposite (θ=180°), the dot product is −|A||B| (maximum negative).
Physics Applications
Work W = F·d = |F||d|cos(θ). Only the component of force along the direction of motion does work. If you push a box at 30° to its direction of travel, only cos(30°) ≈ 86.6% of your force contributes to work. Power P = F·v (force dot velocity).
Orthogonality Test
Two vectors are orthogonal (perpendicular) if and only if their dot product equals zero. This is used extensively in signal processing (orthogonal signals don't interfere), Gram-Schmidt orthogonalization, and testing whether vectors form a valid coordinate basis.
Worked Example: 3D Vectors
Let A = (1, 2, 3) and B = (4, 5, 6). A·B = 1×4 + 2×5 + 3×6 = 4 + 10 + 18 = 32. The magnitude of A: |A| = √(1²+2²+3²) = √14 ≈ 3.742. The magnitude of B: |B| = √(4²+5²+6²) = √77 ≈ 8.775. The angle: θ = arccos(32 / (3.742 × 8.775)) = arccos(32/32.83) = arccos(0.9747) ≈ 12.9°. These vectors are closely aligned.
| Dot Product Value | Angle (θ) | Interpretation |
|---|---|---|
| Positive (max = |A||B|) | 0° to 90° | Vectors point in similar directions |
| Zero | 90° | Vectors are perpendicular (orthogonal) |
| Negative (min = −|A||B|) | 90° to 180° | Vectors point in opposing directions |
| = |A||B| | 0° | Vectors are parallel, same direction |
Frequently Asked Questions
A·B = AxBx + AyBy (+ AzBz in 3D). It produces a scalar equal to |A||B|cos(θ). It measures how much the vectors align — maximum when parallel, zero when perpendicular.
The vectors are perpendicular (orthogonal). cos(90°)=0, so A·B=0. Example: (1,0) · (0,1) = 1×0+0×1 = 0 — these basis vectors are orthogonal.
The angle between vectors exceeds 90°. The vectors have significant components pointing in opposite directions. A·B < 0 means cos(θ) < 0 means θ > 90°.
Work = Force · Displacement = |F||d|cos(θ). Push a 10N force at 60° angle over 5m: W = 10×5×cos(60°) = 10×5×0.5 = 25 joules. Only the aligned component does work.
Dot product: scalar result, measures alignment (cos θ). Cross product: vector result (perpendicular to both inputs), measures how perpendicular they are (sin θ). Both are essential in 3D math.
Rearrange the geometric formula: θ = arccos(A·B / (|A| × |B|)). Calculate the dot product algebraically, divide by the product of both magnitudes, and take the inverse cosine. The result is always between 0° and 180°.
Yes. A·B = B·A always. This follows from the algebraic definition: AxBx + AyBy = BxAx + ByAy. Commutativity makes the dot product simpler to work with than the cross product, which is anti-commutative (A×B = −B×A).