# Rotation matrix

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

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

${\displaystyle {\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 ${\displaystyle {\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 ${\displaystyle \theta _{z}}$. In the new coordinate system, the same quantity has vector components ${\displaystyle {\begin{pmatrix}V'_{1}&V'_{2}&V'_{3}\\\end{pmatrix}}}$ given by

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

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

${\displaystyle {\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}}}$

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

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

${\displaystyle 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 ${\displaystyle \theta _{x}}$ about the ${\displaystyle x}$ axis is:

${\displaystyle {\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.