Visitar URL original
Vector Angle -- from Wolfram MathWorld
TOPICS
Search

Vector Angle


The vector angle between two nonzero real vectors u and v is the angle theta in [0,pi] defined by

 theta=cos^(-1)((u·v)/(||u||||v||)),

where the numerator is the dot product and the denominators are Euclidean vector norms. Schwarz's inequality ensures that the argument of the inverse cosine lies in [-1,1]. In two or three dimensions, this is the smaller angle between arrows with coincident tails.

The vector angle is 0 for vectors pointing in the same direction, pi/2 for orthogonal vectors, and pi for opposite directions. It is undefined if either argument is the zero vector. For example, (1,0) and (1,1) have vector angle pi/4.

Kahan (2016, p. 15) recommends a half-angle formula that can be written using the two-argument inverse tangent as

 theta=2atan2(||u^^-v^^||,||u^^+v^^||),

where u^^=u/||u|| and v^^=v/||v|| are unit vectors, and atan2(y,x) corresponds to ArcTan[x, y] in the Wolfram Language. This form avoids the loss of accuracy of the inverse cosine formula near 0 and pi. The vector norms must be computed with suitable scaling to avoid floating-point overflow and underflow.

Unlike the smaller line-line angle between unoriented lines, the vector angle retains the directions of its arguments. Reversing one direction replaces theta by pi-theta. A dihedral angle can be related to the vector angle between normal vectors to the two planes, with the choice of normals determining which supplementary angle is obtained.

The Wolfram Language computes the vector angle using VectorAngle[u, v]. The related function AngleVector[theta] instead constructs the planar unit vector (costheta,sintheta) at a counterclockwise angle theta from the positive x-axis. Its orientation is specified modulo 2pi, whereas the real vector angle is restricted to [0,pi].


See also

Angle, Dihedral Angle, Dot Product, Line-Line Angle, Vector, Vector Norm

Explore with Wolfram|Alpha

References

Kahan, W. "Computing Cross-Products and Rotations in 2- and 3-Dimensional Euclidean Spaces." Feb. 25, 2016. https://people.eecs.berkeley.edu/~wkahan/MathH110/Cross.pdf.Strang, G. and Herman, E. "The Dot Product." §2.3 in Calculus Volume 3. Houston, TX: OpenStax, 2016. https://openstax.org/books/calculus-volume-3/pages/2-3-the-dot-product.

Cite this as:

Weisstein, Eric W. "Vector Angle." From MathWorld--A Wolfram Resource. https://mathworld.wolfram.com/VectorAngle.html

Subject classifications