# Combining all three rotation matrices

Is it possible to create one single matrix which contains all of these three rotation matrices?

$$R(x) = \begin{pmatrix}1 & 0 & 0 & 0 \\ 0 & \cos\alpha & -\sin\alpha & 0 \\ 0 & \sin\alpha & \cos\alpha & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \qquad R(y) = \begin{pmatrix}\cos\beta & 0 & -\sin\beta & 0\\ 0 & 1 & 0 & 0\\ \sin\beta & 0 & \cos\beta & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \\R(z) = \begin{pmatrix}\cos\gamma & -\sin\gamma & 0& 0 \\ \sin\gamma & \cos\gamma & 0& 0 \\ 0 & 0 & 1& 0 \\ 0 & 0 & 0 & 1\end{pmatrix}$$

If yes, how would this one (4x4-)matrix look like (written out)?

• Keep reading that wikipedia page that you referenced. It tells you in the very next section how to combine these three basic rotations into one. Note that the order in which you apply these rotation matters. You should work through the multiplications yourself for practice, but you can find $R(z)R(y)R(x)$ multiplied out here.
– amd
Aug 4, 2016 at 18:31
• This is exactly what I need! Thanks a ton! Aug 5, 2016 at 8:06

$$R = R(\alpha) \cdot R(\beta) \cdot R(\gamma) = \begin{pmatrix}\cos\beta\cdot\cos\gamma & \cos\beta\cdot\sin\gamma & -\sin\beta & 0 \\ \sin\alpha\sin\beta\cos\gamma - \cos\alpha\sin\gamma & \sin\alpha\sin\beta\sin\gamma + \cos\alpha\cos\gamma & \sin\alpha\cos\beta & 0 \\ \cos\alpha\sin\beta\cos\gamma + \sin\alpha\sin\gamma & \cos\alpha\sin\beta\sin\gamma -\sin\alpha\cos\gamma & \cos\alpha\cos\beta & 0 \\ 0 &0 &0 &1\end{pmatrix}$$
If you want a matrix whose action on a vector of $\mathbb{R}^4$ is equivalent to the three rotations, then you simply have to multiply the matrices, since the rotation matrices form a group. So $A=R(x)R(y)R(z)$ would contain the three matrices, in the sense that, given a vector $x$, the vector $y=Ax$ is obtained from $x$ by applying the rotations $R(z)$, $R(y)$ and $R(x)$. Notice, however, that rotation matrices do not form an abelian group (except in dimension 2), therefore the order in which you compose the rotation matters (meaning that there is more than one way to build $A$).
If by "containing" you mean simple storage of the data, then the answer is obviously yes (the above needs at most 15 entries, out of the 16 of the $4 \times 4$ matrix, to be stored). If you by "containing" actually mean acting, i.e., creating one matrix that would first perform the $R(x)$ rotation, then $R(y)$ rotation etc., then you can simply multiply those matrices in the desired order.