Calculate vector products with geometric interpretations and visualizations
The dot product (a · b) produces a scalar:
Formula: a · b = a₁b₁ + a₂b₂ + a₃b₃
Geometric: a · b = |a| |b| cos(θ)
The cross product (a × b) produces a vector perpendicular to both (3D only):
Formula: a × b = (a₂b₃-a₃b₂, a₃b₁-a₁b₃, a₁b₂-a₂b₁)
Magnitude: |a × b| = |a| |b| sin(θ)
Direction: Right-hand rule (fingers curl from a to b, thumb points along result)
Calculate the angle using:
From dot product: cos(θ) = (a · b) / (|a| |b|)
From cross product: sin(θ) = |a × b| / (|a| |b|)
Best formula: θ = atan2(|a × b|, a · b)
Project vector a onto vector b:
Scalar projection: comp_b(a) = (a · b) / |b|
Vector projection: proj_b(a) = ((a · b) / (b · b)) × b
This gives the component of a in the direction of b.