The Dot Product of two vectors is defined by summing the products of their corresponding components.
v⋅w=v1w1+v2w2+⋯
The result of the dot product between a vector and itself is equal to the square of its magnitude.
v⋅v=v12+v22+⋯=∥v∥2
If the vectors v and w are perpendicular, their magnitudes satisfy the Pythagorean Theorem when added together:
∥v+w∥2=∥v∥2+∥w∥2

We also can rewrite this equation through the expansion of the squared magnitude of v+w:
∥v+w∥2=(v1+w1)2+(v2+w2)2+⋯=(v12+2v1w1+w12)+(v22+2v2w2+w22)+⋯=(v12+v22+⋯)+2(v1w1+v2w2+⋯)+(w12+w22+⋯)=v⋅v+2(v⋅w)+w⋅w
Replacing each dot product with its corresponding magnitude gives:
∥v+w∥2=∥v∥2+2(v⋅w)+∥w∥2
Comparing this expression with the Pythagorean identity shows that:
v⋅w=0
when v and w are perpendicular.
Now consider the case where both v and w are unit vectors, and let θ denote the angle between two vectors.

By rotating the coordinate system so that w lies along the positive x-axis, we may express w as:
w=(10)
while v can be expressed as:
v=(cosθsinθ)
Taking the dot product between the two vectors yields:
v⋅w=cosθ
This result can be extended to non-unit vectors by normalizing both vectors first.
(∥v∥v)⋅(∥w∥w)=cosθ
Multiplying both sides by ∥v∥∥w∥ leads to the general dot product formula:
v⋅w=∥v∥∥w∥cosθ
- Strang, Gilbert. Introduction to Linear Algebra. 5th ed. Wellesley–Cambridge Press, 2016. Chapter 1.2.