Last verified · v1.0
Calculator · math
Angle Between Two Vectors Calculator
Find the angle between two vectors in 2D or 3D using the dot product formula. Enter components and get results in degrees or radians instantly.
Inputs
Angle Between Vectors
—
Explain my result
Get a plain-English breakdown of your result with practical next steps.
The formula
How the
result is
computed.
What Is the Angle Between Two Vectors?
The angle between two vectors quantifies the rotational separation between two directional quantities in 2D or 3D space. Denoted theta (θ), this angle always falls between 0° (parallel, same direction) and 180° (antiparallel, opposite directions) — regardless of the vectors' lengths. The angle between two vectors calculator applies the dot product method, the standard approach in linear algebra and analytic geometry, to deliver precise results in degrees or radians.
The Dot Product Formula
The geometric definition of the dot product links the angle between two vectors to their magnitudes:
A · B = |A| × |B| × cos(θ)
Rearranging to solve for θ yields the working formula:
θ = arccos( A · B / (|A| × |B|) )
Expanding into Cartesian components for A = (a₁, a₂, a₃) and B = (b₁, b₂, b₃), this becomes:
θ = arccos( (a₁b₁ + a₂b₂ + a₃b₃) / ( √(a₁² + a₂² + a₃²) × √(b₁² + b₂² + b₃²) ) )
This derivation is covered in depth by Khan Academy's linear algebra series on defining the angle between vectors and is formalized in Whitman College's Calculus textbook, Section 12.3: The Dot Product.
Variable Definitions
- a₁ (Vector A — x component): The component of vector A along the x-axis (horizontal direction).
- a₂ (Vector A — y component): The component of vector A along the y-axis (vertical direction).
- a₃ (Vector A — z component): The component of vector A along the z-axis (depth direction). Set to 0 for 2D problems.
- b₁ (Vector B — x component): The component of vector B along the x-axis.
- b₂ (Vector B — y component): The component of vector B along the y-axis.
- b₃ (Vector B — z component): The component of vector B along the z-axis. Set to 0 for 2D problems.
- θ (theta): The output angle between the two vectors, selectable in degrees or radians.
Step-by-Step Calculation
- Step 1 — Compute the dot product: Multiply matching components and sum the results: a₁b₁ + a₂b₂ + a₃b₃.
- Step 2 — Find magnitude |A|: Take the square root of (a₁² + a₂² + a₃²).
- Step 3 — Find magnitude |B|: Take the square root of (b₁² + b₂² + b₃²).
- Step 4 — Apply arccos: Divide the dot product by |A| × |B|, then take the inverse cosine to get θ.
Worked Examples
2D Example
Find the angle between A = (3, 4) and B = (1, 2), with z = 0 for both vectors.
- Dot product: (3 × 1) + (4 × 2) = 3 + 8 = 11
- |A| = √(9 + 16) = √25 = 5
- |B| = √(1 + 4) = √5 ≈ 2.236
- cos(θ) = 11 / (5 × 2.236) ≈ 0.9839
- θ = arccos(0.9839) ≈ 10.3°
3D Example
Find the angle between A = (1, 2, 3) and B = (4, 5, 6).
- Dot product: (1 × 4) + (2 × 5) + (3 × 6) = 4 + 10 + 18 = 32
- |A| = √(1 + 4 + 9) = √14 ≈ 3.742
- |B| = √(16 + 25 + 36) = √77 ≈ 8.775
- cos(θ) = 32 / (3.742 × 8.775) ≈ 32 / 32.839 ≈ 0.9744
- θ = arccos(0.9744) ≈ 12.93°
Real-World Applications
The angle between vectors appears across numerous disciplines:
- Physics: Work equals force times displacement times cos(θ), where θ is the angle between the force and displacement vectors. A force applied at 60° to displacement contributes only 50% of its magnitude as useful work.
- Computer Graphics: Phong and Lambertian shading models compute the angle between the incoming light direction and a surface normal vector to determine pixel brightness per the formula I = I₀ cos(θ).
- Machine Learning: Cosine similarity — the cos(θ) term in this formula — measures the directional similarity of word or document embedding vectors, powering search engines, recommendation systems, and large language model retrieval.
- Robotics: Joint angle computations and steering angle calculations in autonomous vehicles rely directly on vector angle geometry.
- Chemistry: Molecular bond angles are calculated as the angle between position vectors drawn from a central atom to its bonded neighbors.
Reference