Dot and Cross Product Calculator

Calculate vector products with geometric interpretations and visualizations

Vector Input

Vector A

Magnitude: 5.00

Vector B

Magnitude: 2.24

Help

Dot Product

The dot product (a · b) produces a scalar:

Formula: a · b = a₁b₁ + a₂b₂ + a₃b₃

Geometric: a · b = |a| |b| cos(θ)

  • Positive: vectors point in similar directions
  • Zero: vectors are perpendicular
  • Negative: vectors point in opposite directions
Cross Product

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)

  • Maximum when vectors are perpendicular
  • Zero when vectors are parallel
  • Magnitude equals area of parallelogram
Angle Between Vectors

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)

Projection

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.

Applications
  • Physics: Work (F · d), Torque (r × F)
  • Graphics: Lighting (normal · light), Normals (v₁ × v₂)
  • Engineering: Moments, Forces
  • ML: Cosine similarity, Distance metrics