In: Advanced Math
How do I find the angle between two three-dimensional vectors?
The cosine is given by
cosφ=(v1,v2)/∥v1∥∥v2∥
This gives you the inner angle by the arccos or the outer angle by subtracting that from 2π.
The formula for 3d is the same for 2d. If you ever take linear algebra you will understand to the span of 2 vectors is a 2d plane even if the vectors are 3d.
given vector u and vector v forming the angle x
The formula is Cos x = ((u)dot(v))/(norm(u)dot(norm(v)))
solving for x
x=arccos((u)dot(v))/(norm(u)dot(norm(v)))
Note that this formula does not depend on the dimensions of the space, since two vectors always span a two-dimensional subspace.
Angle,cosφ=(v1,v2)/∥v1∥∥v2∥