Linear Algebra
Intermediate

Dot Product

Scalar product of two vectors.

Formula

a⃗⋅b⃗=∑iaibi=∣a∣∣b∣cos⁡θ\vec{a}\cdot\vec{b} = \sum_i a_i b_i = |a||b|\cos\theta

Variables

\vec{a},\vec{b}Vectors
\thetaAngle between them

Example

(1,2,3)·(4,5,6) = 4 + 10 + 18 = 32.

How it works

The dot product combines two vectors into a single number by multiplying matching components and adding the results. Geometrically, that number also equals the product of the vectors’ lengths times the cosine of the angle between them, so it measures how much one vector points in the direction of the other. This is why the dot product is zero for perpendicular vectors and largest when vectors point in the same direction.

When to use it

Use the dot product when you need to measure alignment, find the angle between vectors, or test whether vectors are orthogonal. It also appears in projection calculations, work done by a force, and many geometric and physics problems.

Worked example, step by step

Let a = (2, -1, 4) and b = (3, 0, -2). Compute matching products: 2·3 = 6, (-1)·0 = 0, 4·(-2) = -8. Add them: 6 + 0 + (-8) = -2. So a · b = -2.

Common mistakes to avoid

  • Adding the vector components instead of multiplying them pairwise first
  • Forgetting that negative components affect the sign of each product
  • Using the dot product formula for the angle without checking that the vectors are nonzero

Did You Know?

The dot product is zero exactly when two vectors are perpendicular — a quick orthogonality test.

Share this formula

Reviewed & maintained by the FormulaWon editorial teamLast reviewed September 2026