Quick answer
θ = arccos( (a · b) / (|a| |b|) ) with a · b = aₓbₓ + aᵧbᵧ + a_z b_z and |a| = √(aₓ² + aᵧ² + a_z²).
Formula
- cos θ = (a · b) / (|a| |b|)
- θ = arccos(cos θ)
Introduction
The cosine rule for vectors is the bridge between algebra and geometry. The Angle Between Two Vectors Calculator evaluates the same expression after you supply components or point pairs.
Start with what is the angle between two vectors if you want the geometric definition first.
What each part of the formula does
The dot product a · b measures alignment along shared axes. Magnitudes |a| and |b| measure lengths. Dividing removes scale so only direction remains inside the cosine.
arccos recovers the angle in radians. Multiply by 180/π when readers expect degrees.
The cosine rule is the vector version of a fact you already know from triangles: the dot encodes how much two directions overlap when lengths are accounted for.
Each symbol has a job: components feed the dot, magnitudes normalize, arccos inverts cosine. Skip any step and the angle loses meaning.
Full formula block
- a · b = aₓbₓ + aᵧbᵧ + a_z b_z
- |a| = √(aₓ² + aᵧ² + a_z²)
- cos θ = (a · b) / (|a| |b|)
- θ = arccos(cos θ)
Clamp cos θ to [-1, 1] before arccos when floating-point noise appears. Zero magnitudes make the expression undefined.
For intuition behind the dot product term, read dot product and vector angle explained.
Using the formula
- Compute a · b from components. Multiply matching components and add. In 3D include z with z; in 2D confirm both z terms are truly zero.
- Compute |a| and |b|. Square, sum, square root for each vector separately. A calculator memory line for each magnitude reduces typos.
- Form the cosine ratio. Divide dot by the product of magnitudes. Write the fraction before you decimalize; reviewers like seeing the exact ratio.
- Apply arccos and label units. Radians by default in many libraries; degrees for many textbooks.
- Check special cosine values. 0, 1, -1, 0.5, and √2/2 correspond to familiar angles and catch many mistakes instantly.
Formula in numbers
For a = (3, 0) and b = (3, 4): a·b = 9, |a| = 3, |b| = 5, cos θ = 0.6, θ ≈ 53.13°.
More patterns appear in angle between two vectors examples.
Perpendicular check: a = (2, -1) and b = (1, 2) give dot 0 with nonzero lengths, so cos θ = 0 and θ = 90° without needing a calculator.
