Day 18 - Dot Product

...
21 Jan 2026

The Dot Product of two vectors is defined by summing the products of their corresponding components.

vw=v1w1+v2w2+v\cdot w = v_{1}w_{1} + v_{2}w_{2} + \cdots

The result of the dot product between a vector and itself is equal to the square of its magnitude.

vv=v12+v22+=v2v\cdot v = {v_{1}}^{2} + {v_{2}}^{2} + \cdots = \|v\|^2

If the vectors vv and ww are perpendicular, their magnitudes satisfy the Pythagorean Theorem when added together:

v+w2=v2+w2\|v+w\|^{2} = \|v\|^{2} + \|w\|^{2}

We also can rewrite this equation through the expansion of the squared magnitude of v+wv + w:

v+w2=(v1+w1)2+(v2+w2)2+=(v12+2v1w1+w12)+(v22+2v2w2+w22)+=(v12+v22+)+2(v1w1+v2w2+)+(w12+w22+)=vv+2(vw)+ww\begin{aligned} \|v+w\|^{2} &= (v_{1}+ w_{1})^{2} + (v_{2}+w_{2})^{2} + \cdots\\ &= ({v_{1}}^{2} + 2v_{1}w_{1} + {w_{1}}^{2}) + ({v_{2}}^{2} + 2v_{2}w_{2} + {w_{2}}^{2}) + \cdots\\ &= ({v_{1}}^{2} + {v_{2}}^{2} + \cdots)+ 2(v_{1}w_{1} + v_{2}w_{2} + \cdots) + ({w_{1}}^{2} + {w_{2}}^{2} + \cdots) \\ &= v \cdot v + 2(v \cdot w) + w\cdot w \end{aligned}

Replacing each dot product with its corresponding magnitude gives:

v+w2=v2+2(vw)+w2\|v+w\|^{2} = \|v\|^{2} +2(v\cdot w) + \|w\|^ {2}

Comparing this expression with the Pythagorean identity shows that:

vw=0v\cdot w = 0

when vv and ww are perpendicular.


Now consider the case where both vv and ww are unit vectors, and let θ\theta denote the angle between two vectors.

By rotating the coordinate system so that ww lies along the positive xx-axis, we may express ww as:

w=(10)w = \begin{pmatrix} 1 \\ 0 \end{pmatrix}

while vv can be expressed as:

v=(cosθsinθ)v = \begin{pmatrix} \cos \theta \\ \sin \theta \end{pmatrix}

Taking the dot product between the two vectors yields:

vw=cosθv\cdot w = \cos\theta

This result can be extended to non-unit vectors by normalizing both vectors first.

(vv)(ww)=cosθ\left(\frac{v}{\|v\|}\right)\cdot\left(\frac{w}{\|w\|}\right) = \cos\theta

Multiplying both sides by vw\|v\| \|w\| leads to the general dot product formula:

vw=vwcosθv \cdot w = \|v\|\|w\|\cos\theta
  • Strang, Gilbert. Introduction to Linear Algebra. 5th ed. Wellesley–Cambridge Press, 2016. Chapter 1.2.