Vector algebra

Angle Between Vectors

Find the angle between two vectors using the dot product ratio, with zero-vector checks included.

Back to topic

Formula

cos(theta) = (A . B) / (|A||B|)

Result

Worked substitution


          

The cosine form works in 2D and 3D as long as both vectors are non-zero.

Read the result

The dot product is divided by the two magnitudes to isolate cos(theta). The answer is the smaller angle from one vector to the other.

Where it helps

Use it when directions matter more than length: force angles, line directions, and vector geometry proofs.

Common slip

Do not calculate an angle if either vector has zero length. A zero vector has no direction.

Try it

Try A = (1, 1, 0) and B = (1, -1, 0). The angle should be 90 degrees.