A rotation matrix is a tensor which rotates one Cartesian coordinate system into another.

For example, the rotation matrix for rotating by the angle $\theta _{z}$ (right-hand rule) about the $z$ axis is:

${\textbf {R}}_{z}(\theta _{z})\ ={\begin{pmatrix}cos(\theta _{z})&sin(\theta _{z})&0\\-sin(\theta _{z})&cos(\theta _{z})&0\\0&0&1\\\end{pmatrix}}$

With this matrix, a vector ${\textbf {V}}={\begin{pmatrix}V_{1}&V_{2}&V_{3}\\\end{pmatrix}}$, referred to one coordinate system, may be referred to another coordinate system, rotated from the first by the angle $\theta _{z}$. In the new coordinate system, the same quantity has vector components ${\begin{pmatrix}V'_{1}&V'_{2}&V'_{3}\\\end{pmatrix}}$ given by

$V'_{j}=\sum _{i}^{3}R_{z}(\theta _{z})_{ji}V_{i}$

The rotation matrix for rotating by the angle $\theta _{y}$ about the $y$ axis is:

${\textbf {R}}_{y}(\theta _{y})\ ={\begin{pmatrix}cos(\theta _{y})&0&-sin(\theta _{y})\\0&1&0\\sin(\theta _{y})&0&cos(\theta _{y})\\\end{pmatrix}}$

${\begin{pmatrix}cos(\theta _{y})&0&-sin(\theta _{y})\\\end{pmatrix}}$

If the coordinate system is rotated further, by an angle $\theta _{y}$ about the *new $y$-axis*, the same quantity $V'$ has vector components $[V{''}_{1}V{''}_{2}V{''}_{3}]$ given by

$V{''}_{k}=\sum _{k}^{3}R_{y}(\theta _{y})_{kj}V'_{j}=\sum _{k}^{3}\sum _{j}^{3}R_{y}(\theta _{y})_{kj}R_{z}(\theta _{z})_{ji}V_{i}$

Finally, rotation matrix for rotating by the angle $\theta _{x}$ about the $x$ axis is:

${\textbf {R}}_{x}(\theta _{x})\ ={\begin{pmatrix}1&0&0\\0&cos(\theta _{z})&sin(\theta _{z})\\0&-sin(\theta _{z})&cos(\theta _{z})\\\end{pmatrix}}$

*Any* rotation can thus be constructed out of these primitive rotations, about coordinate axes.

See also Tensor algebra.