Vector Dot Product Calculator

The dot product multiplies matching components and adds them. It also equals |a||b|cos θ, so it tells you the angle between the vectors.

Also called: Scalar product calculator · Inner product calculator · Angle between vectors calculator

  • Last updated
  • Formula tested against reference values

Your numbers

Components separated by commas or spaces; any dimension up to 100.

Result

a · b
—

Calculating…

|a|
—
|b|
—
cos θ
—
Angle θ between a and b
—
Relationship
—

How to use this calculator

  1. Enter or choose vector a.
  2. Enter or choose vector b.
  3. The a · b updates as you type. Use Copy result or Share to keep it.

Method

a · b = Σ aᵢbᵢ = |a||b| cos θ; θ = 2·atan2(|â − b̂|, |â + b̂|)

aᵢ, bᵢ
the components
|a|, |b|
the lengths
θ
the angle between the vectors
â, b̂
the unit vectors

Worked example

  1. a · b = 1·4 + 2·(−5) + 3·6 = 4 − 10 + 18 = 12.
  2. |a| = √14 ≈ 3.7417 and |b| = √77 ≈ 8.7750.
  3. cos θ = 12 ÷ (3.7417 × 8.7750) ≈ 0.36549, so θ ≈ 68.56°.

(1, 2, 3) · (4, −5, 6) = 12, and the vectors are about 68.56° apart.

What the result means

A positive dot product means the angle is acute, a negative one obtuse, and zero means the vectors are perpendicular (orthogonal).

Assumptions and limits

  • Both vectors are in the same Euclidean space with the standard dot product.
  • The angle is undefined if either vector is the zero vector.

Questions

Why is the angle not just arccos of cos θ?

arccos loses accuracy for nearly parallel vectors. The calculator uses the equivalent formula 2·atan2(|â − b̂|, |â + b̂|), which stays accurate at every angle.

What is the dot product used for?

Work done by a force (F · d), projections, testing perpendicularity, and similarity scores between vectors.