Visual Tools
Calculators
Tables
Mathematical Keyboard
Converters
Other Tools

How to Compute the Dot Product

The dot product turns two vectors into one number. Multiply the matching components and add the products; the sign of the result tells you whether the vectors point roughly the same way.

Recognize the task

Two vectors of the same dimension joined by a dot: u⋅v\mathbf{u} \cdot \mathbf{v}, (3,−2)⋅(1,4)(3, -2) \cdot (1, 4), aTb\mathbf{a}^T\mathbf{b}, or "the angle between" and "orthogonal" in the question. Test: is the answer a single number built from two vectors?
The dot product is defined in the dot product lesson.

Two ways to do it

Componentscoordinates known
u⋅v=u1v1+u2v2+⋯+unvn\mathbf{u} \cdot \mathbf{v} = u_1 v_1 + u_2 v_2 + \cdots + u_n v_n
The algebraic dot product: use it whenever you have the components.
Lengths and anglegeometry known
u⋅v=∥u∥ ∥v∥cos⁡θ\mathbf{u} \cdot \mathbf{v} = \|\mathbf{u}\|\,\|\mathbf{v}\| \cos\theta
The geometric dot product: use it when the problem gives the lengths and the angle instead of coordinates.

Steps

StepOn (2,−1,3)⋅(4,0,−2)(2, -1, 3) \cdot (4, 0, -2)
1Check the dimensions match. The dot product is defined only for two vectors with the same number of components.both in R3\mathbb{R}^3
2Multiply matching components. First with first, second with second, and so on. Keep the signs.2⋅4=82 \cdot 4 = 8,  (−1)⋅0=0\ (-1) \cdot 0 = 0,  3⋅(−2)=−6\ 3 \cdot (-2) = -6
3Add the products. The result is a scalar, not a vector.8+0−6=28 + 0 - 6 = 2
4Read the sign. Positive: the angle is acute. Zero: the vectors are orthogonal. Negative: the angle is obtuse.2>02 > 0: acute angle

Worked examples

Example 1 · two dimensions

basic
(3,−2)⋅(1,4)=3⋅1+(−2)⋅4(3, -2) \cdot (1, 4) = 3 \cdot 1 + (-2) \cdot 4
multiply matching components
=3−8=−5= 3 - 8 = -5
negative: obtuse angle

Example 2 · an orthogonality check

result zero
(1,2,−1)⋅(3,−1,1)=3−2−1(1, 2, -1) \cdot (3, -1, 1) = 3 - 2 - 1
three products
=0= 0
zero dot product
the vectors are orthogonal
perpendicular directions

Example 3 · from lengths and angle

geometric form
∥u∥=4\|\mathbf{u}\| = 4, ∥v∥=5\|\mathbf{v}\| = 5, θ=60∘\theta = 60^\circ
no coordinates given
u⋅v=4⋅5⋅cos⁡60∘\mathbf{u} \cdot \mathbf{v} = 4 \cdot 5 \cdot \cos 60^\circ
geometric formula
=20⋅12=10= 20 \cdot \tfrac{1}{2} = 10
cos⁡60∘=12\cos 60^\circ = \tfrac{1}{2}
Try your own vectors in the inner product visualizer or the vector calculator.

See it happen

The dot product measures how much one vector goes along the other. Drop a perpendicular from the tip of u\mathbf{u} onto the line of v\mathbf{v}: the shadow has length ∥u∥cos⁡θ\|\mathbf{u}\|\cos\theta, and the dot product is that shadow times ∥v∥\|\mathbf{v}\|. A shadow pointing backwards gives a negative number; no shadow at all gives zero.

Common mistakes

Writing the answer as a vector

✗ (2,−1)⋅(3,4)=(6,−4)(2, -1) \cdot (3, 4) = (6, -4)
✓ (2,−1)⋅(3,4)=6−4=2(2, -1) \cdot (3, 4) = 6 - 4 = 2, a single number

Dropping a minus sign

✗ (2,−1,3)⋅(4,0,−2)=8+0+6=14(2, -1, 3) \cdot (4, 0, -2) = 8 + 0 + 6 = 14
✓ 3⋅(−2)=−63 \cdot (-2) = -6, so the sum is 22

Vectors of different dimensions

✗ (1,2)⋅(3,4,5)=3+8=11(1, 2) \cdot (3, 4, 5) = 3 + 8 = 11
✓ not defined: the vectors must have the same number of components

Confusing it with the cross product

✗ u⋅v\mathbf{u} \cdot \mathbf{v} is a vector perpendicular to both
✓ that is u×v\mathbf{u} \times \mathbf{v}; the dot product is a scalar