VectorAngle[u,v]
gives the angle between the vectors u and v.
VectorAngle
VectorAngle[u,v]
gives the angle between the vectors u and v.
Details
- VectorAngle gives an angle in radians.
- For nonzero real vectors the vector angle
satisfies
. - For complex vectors the numerator is
.
Examples
open all close allBasic Examples (2)
The angle between two vectors in 2D:
VectorAngle[{1, 0}, {1, 1}]Graphics[{Arrow[{{0, 0}, {1, 0}}], Arrow[{{0, 0}, {1, 1}}]}]The angle between two vectors in 3D:
VectorAngle[{1, 0, 0}, {1, 1, 1}]Graphics3D[{Thick, Line[{{0, 0, 0}, {1, 0, 0}}], Line[{{0, 0, 0}, {1, 1, 1}}]}]The angle between orthogonal vectors:
VectorAngle[{1, 0}, {0, 1}]VectorAngle[{1, 0, 1}, {0, 1, 0}]VectorAngle[UnitVector[10, 1], UnitVector[10, 2]]Scope (2)
Use exact arithmetic to compute the vector angle:
u = {1, 2, 3};v = {1, 1, 1};VectorAngle[u, v]VectorAngle[N[u], N[v]]Use 47-digit precision arithmetic:
VectorAngle[N[u, 47], N[v, 47]]VectorAngle[{a, b}, {x, y}]Plot3D[VectorAngle[{1, 0}, {x, y}], {x, -1, 1}, {y, -1, 1}]RegionPlot[VectorAngle[{1, 0}, {x, y}] < Pi / 3, {x, -1, 1}, {y, -1, 1}]Generalizations & Extensions (1)
Applications (3)
Find when two vectors have the same direction:
samedirection[u_ ? VectorQ, v_ ? VectorQ] := PossibleZeroQ[VectorAngle[u, v]]samedirection[{1, 2}, {.1, .2}]samedirection[{1, 2}, {-.1, -.2}]Find the area of the triangle, with u and v as two sides:
tarea[u_ ? VectorQ, v_ ? VectorQ] := (1/2)Norm[u]Norm[v]Sin[VectorAngle[u, v]]tarea[{1, 0}, {0, 1}]Plot the area in the triangle formed by the
axis and a unit vector in the first quadrant:
Plot[tarea[{1, 0}, {Cos[θ], Sin[θ]}], {θ, 0, Pi / 2}]Distribution of angles between random vectors with positive entries in 2, 3, 5, and 10 dimensions:
n = 10 ^ 5;
Table[
v = RandomReal[1, {n, 2, d}];
angles = Apply[VectorAngle, v, {1}] / Degree;
bins = BinCounts[angles, {0, 90}] / n;
ListPlot[bins, DataRange -> {0, 90}],
{d, {2, 3, 5, 10}}]Properties & Relations (6)
u = RandomReal[1, {5}];
v = RandomReal[1, {5}];θ = VectorAngle[u, v]Cos[θ] == (u.v/Norm[u] Norm[v])The generalization to complex vectors satisfies
:
u = RandomComplex[1 + I, {5}];
v = RandomComplex[1 + 2I, {5}];θ = VectorAngle[u, v]Cos[θ] == (u.Conjugate[v]/Norm[u] Norm[v])If you rotate a vector u in a plane that includes u, then the vector angle is the rotation angle:
u = {1, 0, -1};v = RotationTransform[Pi / 3, {1, 1, 1}][u]VectorAngle[u, v]If you rotate it in a plane that does not include u, then the angles differ:
v = RotationTransform[Pi / 3, {0, 0, 1}][u]VectorAngle[u, v]The vector angle
is related to the cross product through
:
{u, v} = RandomReal[1, {2, 3}]θ = VectorAngle[u, v]Norm[Cross[u, v]] == Abs[Sin[θ]]Norm[u]Norm[v]ArcTan of two arguments gives the signed vector angle between the
axis and the vector:
{x, y} = {1, 2};ArcTan[x, y]VectorAngle[{1, 0}, {x, y}]FullSimplify[%% - %]Eigenvectors are the vectors for which the angle between
and
is 0:
m = {{1, 1 / 2}, {1 / 2, 1 / 3}};f[t_] := Module[{x = {Cos[t], Sin[t]}}, VectorAngle[m.x, x]]Plot[f[t], {t, 0, Pi}]Quiet[FindMinimum[f[t], {t, .5}]]{Cos[t], Sin[t]} /. %[[2]]Eigenvectors[N[m]]See Also
PlanarAngle PolygonAngle Dot Projection ArcCos Cross Degree CosineDistance
Function Repository: SignedVectorAngle AngleBetweenPlanes
Related Guides
History
Text
Wolfram Research (2007), VectorAngle, Wolfram Language function, https://reference.wolfram.com/language/ref/VectorAngle.html.
CMS
Wolfram Language. 2007. "VectorAngle." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/VectorAngle.html.
APA
Wolfram Language. (2007). VectorAngle. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VectorAngle.html
BibTeX
@misc{reference.wolfram_2026_vectorangle, author="Wolfram Research", title="{VectorAngle}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/VectorAngle.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_vectorangle, organization={Wolfram Research}, title={VectorAngle}, year={2007}, url={https://reference.wolfram.com/language/ref/VectorAngle.html}, note=[Accessed: 12-June-2026]}