## 3D Rotation Matrices and Examples

The following rotation matrices rotate vectors by an angle $\theta$ in an anticlockwise direction about the $x$-, $y$-, or $z$-axis respectively (the rotated axis points towards the observer). \begin{aligned} R_x(\theta)&=\begin{pmatrix}1 &0 &0\\ 0 &\cos\theta &-\sin\theta\\ 0 &\sin\theta &\cos\theta \end{pmatrix}\\ R_y(\theta)&=\begin{pmatrix}\cos\theta &0 &\sin\theta\\ 0 &1 &0\\ -\sin\theta &0 &\cos\theta \end{pmatrix}\\ R_z(\theta)&=\begin{pmatrix} \cos\theta &-\sin\theta &0\\ \sin\theta &\cos\theta &0\\ 0 &0 &1 \end{pmatrix} \end{aligned}

## Example 1

Rotating $\begin{pmatrix}1\\ 0\\ 0\end{pmatrix}$ $45^\circ$ anticlockwise about $z$-axis: \begin{aligned} R_z(45^\circ)\begin{pmatrix}1\\ 0\\ 0\end{pmatrix}&=\begin{pmatrix} \cos 45^\circ &-\sin 45^\circ &0\\ \sin 45^\circ &\cos 45^\circ &0\\ 0 &0 &1 \end{pmatrix} \begin{pmatrix}1\\ 0\\ 0\end{pmatrix}\\ &=\begin{pmatrix}\sqrt{2}/2\\\sqrt{2}/2\\0\end{pmatrix}. \end{aligned}

## Example 2

Rotating $\begin{pmatrix}0\\ 1\\ 0\end{pmatrix}$ $45^\circ$ anticlockwise about $z$-axis: \begin{aligned} R_z(45^\circ)\begin{pmatrix}0\\ 1\\ 0\end{pmatrix}&=\begin{pmatrix} \cos 45^\circ &-\sin 45^\circ &0\\ \sin 45^\circ &\cos 45^\circ &0\\ 0 &0 &1 \end{pmatrix} \begin{pmatrix}0\\ 1\\ 0\end{pmatrix}\\ &=\begin{pmatrix}-\sqrt{2}/2\\\sqrt{2}/2\\0\end{pmatrix}. \end{aligned} 1. iamvistinginstructoreric says: