The vector angle between two nonzero real vectors and
is the angle
defined by
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 . 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,
for orthogonal vectors, and
for opposite directions. It is undefined if either argument
is the zero vector. For example,
and
have vector angle
.
Kahan (2016, p. 15) recommends a half-angle formula that can be written using the two-argument inverse tangent as
where
and
are unit
vectors, and
corresponds to ArcTan[x,
y] in the Wolfram Language.
This form avoids the loss of accuracy of the inverse
cosine formula near 0 and
. 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 by
. 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 at a counterclockwise angle
from the positive
-axis. Its orientation is specified modulo
, whereas the real vector angle is restricted to
.