Angle Between Two Vectors (Unsigned) Formula
The unsigned angle between two vectors is given by the arc cosine of the result from dividing their dot product by the product of their magnitudes.
Expression | Description |
---|---|
The angle between the two vectors. | |
The arc cosine function. | |
The first vector. | |
The second vector. |
This formula calculates the unsigned angle between two vectors using the arc cosine function. For example, the angle between the vectors and is calculated as:
We can visualize the angle between these two vectors like this.
The angle returned from this formula is always positive. We can visualize the angles calculated by keeping in place and visualizing different positions for like this.
The angle returned is unsigned, because it doesn’t describe how to get from the first vector to the second vector. In fact, the order of the vectors doesn’t matter. If you swap with , the formula produces the same positive angle. To calculate the signed angle between vectors in two dimensions, see this formula.
The advantage of the formula on this page versus the signed version is that it works for higher dimensions.
To calculate the signed angle between two vectors you can use the extended arc tangent function. This formula calculates angles between negative 180 degrees and positive 180 degrees.
The dot product of two vectors is calculated by summing together the product of corresponding elements.
The magnitude of a vector is given by the square root of the sum of its components squared.