Direction cosine
Template:Short description Template:No footnotes
In analytic geometry, the direction cosines (or directional cosines) of a vector are the cosines of the angles between the vector and the three positive coordinate axes. Equivalently, they are the contributions of each component of the basis to a unit vector in that direction.
Three-dimensional Cartesian coordinates


If Template:Math is a Euclidean vector in three-dimensional Euclidean space, Template:Tmath
where Template:Math are the standard basis in Cartesian notation, then the direction cosines are
It follows that by squaring each equation and adding the results
Here Template:Math are the direction cosines and the Cartesian coordinates of the unit vector and Template:Math are the direction angles of the vector Template:Math.
The direction angles Template:Math are acute or obtuse angles, i.e., Template:Math, Template:Math and Template:Math, and they denote the angles formed between Template:Math and the unit basis vectors Template:Math.
General meaning
More generally, direction cosine refers to the cosine of the angle between any two vectors. They are useful for forming direction cosine matrices that express one set of orthonormal basis vectors in terms of another set, or for expressing a known vector in a different basis. Simply put, direction cosines provide an easy method of representing the direction of a vector in a Cartesian coordinate system.
Applications
Determining angles between two vectors
If vectors Template:Math and Template:Math have direction cosines Template:Math and Template:Math respectively, with an angle Template:Mvar between them, their units vectors are
Taking the dot product of these two unit vectors yield, where Template:Mvar is the angle between the two unit vectors, and is also the angle between Template:Math and Template:Math.
Since Template:Mvar is a geometric angle, and is never negative. Therefore only the positive value of the dot product is taken, yielding us the final result,