Angle Between Two Vectors Calculator

Calculate the angle between two vectors in 2D or 3D space using the dot product formula.

Enter Vector Components

Vector u
Vector v

Result

Angle Between Vectors
--
--
Dot Product (u · v)--
Magnitude |u|--
Magnitude |v|--
cos(θ)--
Relationship--

Step-by-Step Solution

cos(θ) = (u · v) / (|u| · |v|)

Understanding the Angle Between Two Vectors

The angle between two vectors is a fundamental concept in linear algebra and vector geometry. It measures how much two vectors diverge from each other in space, and is calculated using the dot product formula.

The Dot Product Formula

The dot product (also called the scalar product) of two vectors u and v is defined as:

u · v = u₁v₁ + u₂v₂ + u₃v₃ (for 3D vectors)

Geometrically: u · v = |u| · |v| · cos(θ)

By rearranging, we obtain the formula for the angle:

θ = arccos[(u · v) / (|u| · |v|)]

Vector Magnitudes

The magnitude (or length) of a vector is calculated using the Pythagorean theorem extended to n dimensions:

|u| = sqrt(u₁² + u₂² + u₃²)

Perpendicular and Parallel Vectors

  • Perpendicular (Orthogonal): When θ = 90°, the dot product equals zero.
  • Parallel (Same Direction): When θ = 0°, cos(θ) = 1.
  • Anti-parallel (Opposite): When θ = 180°, cos(θ) = -1.
  • Acute: When 0 < θ < 90°, the dot product is positive.
  • Obtuse: When 90 < θ < 180°, the dot product is negative.

Common Angle Values

Angle (Degrees)Angle (Radians)cos(θ)Relationship
01Parallel (same direction)
30°π/6√3/2 ≈ 0.866Acute
45°π/4√2/2 ≈ 0.707Acute
60°π/30.5Acute
90°π/20Perpendicular
120°2π/3-0.5Obtuse
180°π-1Anti-parallel

Applications

  • Physics: Work done by a force (W = F · d · cosθ), resolving vector components.
  • Computer Graphics: Lighting calculations use the angle between surface normals and light direction vectors.
  • Machine Learning: Cosine similarity measures how similar two feature vectors are.
  • Navigation: Determining course correction angles between heading and destination vectors.
  • Engineering: Structural analysis requires computing angles between force vectors.

Cross Product (3D Only)

For 3D vectors, the cross product provides an alternative relationship:

|u × v| = |u| · |v| · sin(θ)

The cross product produces a vector perpendicular to both input vectors, with magnitude related to the sine of the angle between them.