Calculating the Dot Product and the Angle

Working out a dot product from components, why the answer is a scalar rather than a vector, and rearranging the formula to recover the angle between two vectors - including the perpendicular case where the result is zero.

--
Calculating the Dot Product and the Angle — Moosa Academy

The dot product turns two vectors into a single number. That number, combined with the two lengths, is enough to recover the exact angle between them.

Theorem How to compute it

Multiply the x-components together, multiply the y-components together, then add.

 \langle a_1, a_2 \rangle \cdot \langle b_1, b_2 \rangle = a_1 b_1 + a_2 b_2

The answer is a scalar, not a vector. This is the key difference from the cross product, which returns a vector.

Example Two dot products
 \langle 3, 4 \rangle \cdot \langle 5, 12 \rangle
x-parts:  3 \times 5 = 15
y-parts:  4 \times 12 = 48
 15 + 48 = 63
⟹ 63
 \langle 2, 3 \rangle \cdot \langle 4, -1 \rangle = 8 + (-3)
⟹ 5

Negative components are handled exactly as they look —  3 \times (-1) = -3 , which then gets added.

Theorem The angle formula
θ A B
Divide the dot product by the product of the two lengths, then take the inverse cosine.
 \cos\theta = \frac{\vec{A} \cdot \vec{B}}{|\vec{A}|\,|\vec{B}|}
where  |\vec{A}| = \sqrt{a_1^2 + a_2^2} .
Example Finding the angle

Find the angle between  \vec{A} = \langle 3, 4 \rangle and  \vec{B} = \langle 5, 12 \rangle .

Step 1 — the dot product:  15 + 48 = 63
Step 2 — the length of A:  \sqrt{9 + 16} = \sqrt{25} = 5
Step 3 — the length of B:  \sqrt{25 + 144} = \sqrt{169} = 13
Step 4 — apply the formula:
 \cos\theta = \frac{63}{5 \times 13} = \frac{63}{65} \approx 0.969
Step 5 — take the inverse cosine.
⟹ θ ≈ 14.3°

A small angle makes sense: the cosine came out close to 1, meaning the vectors nearly point the same way.

Note Two shortcuts worth knowing
 \langle 1, 0 \rangle \cdot \langle 0, 5 \rangle = 0 + 0 = 0 , so  \cos\theta = 0 and θ = 90°.
⟹ a dot product of zero means the vectors are perpendicular
 \langle 3, 4 \rangle \cdot \langle 6, 8 \rangle = 18 + 32 = 50 , with lengths 5 and 10, giving  \cos\theta = 1 .
⟹ θ = 0°, the vectors are parallel

Checking for a zero dot product is the quickest test for perpendicularity there is.

Summary
  1. A · B = a₁b₁ + a₂b₂, and the answer is always a number.
  2. ⟨3, 4⟩ · ⟨5, 12⟩ = 63.
  3. cos θ = (A · B) / (|A| |B|), then take the inverse cosine.
  4. For those vectors cos θ = 63/65, giving θ ≈ 14.3°.
  5. A dot product of 0 means perpendicular; cos θ = 1 means parallel.