Dot Product & Projection

Drag the vectors x₁ or x₂. Observe how the dot product is calculated algebraically and geometrically, and see the projection (dashed line).

x₁ =
3.00 4.00
x₁‖ = 5.00
x₂ =
4.96 -0.60
x₂‖ = 5.00
Angle Between Vectors (θ) = 60.0°

Dot Product (Using Angle)

x₁ · x₂ = x₁‖‖x₂‖ cos θ
= 5.00 × 5.00 × 0.50 = 12.50

Dot Product (Element-by-Element)

x₁ · x₂ = x1ix2i
= 3.00 × 4.96 + 4.00 × -0.60
= 12.50

Projection

Length of x₂ projected onto x₁:
x₂‖ cos θ = 5.00 × 0.50
= 2.50

Enjoying this visualization?

Get the full textbook:
Linear Algebra for Computer Science

Grid: 1 unit / line