[Math] Condensing successive matrix rotations into one matrix

linear algebralinear-transformations

I want to know how to condense multiple rotation transformation matrices into one.

I am performing three successive rotations on vector V.
First, I transform V about the Z-axis by angle $\theta_Y$, yielding vector A.
Second, I transform vector A about the X-axis by angle $\theta_X$, yielding vector B.
Third, I transform the vector B about the Y-axis by angle $\theta_Y$, yielding the final vector that I want, C. $R_Z$ is first, $R_X$ is second, and $R_Y$ is last

$$A = R_Z(\theta_Z) V = \begin{bmatrix} \cos(\theta_Z) & \sin(\theta_Z) & 0 \\ -\sin(\theta_Z) & \cos(\theta_Z) & 0 \\ 0 & 0 & 1 \\ \end{bmatrix}$$
$$B = R_X(\theta_X) A = \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos(\theta_X) & \sin(\theta_X)\\ 0 & -\sin(\theta_X) & \cos(\theta_X) \\ \end{bmatrix}$$

$$C = R_Y(\theta_Y)B = \begin{bmatrix} \cos(\theta_Y) & 0 & -\sin(\theta_Y) \\ 0 & 1 & 0 \\ \sin(\theta_Y) & 0 & \cos(\theta_Y) \\ \end{bmatrix}$$

I am doing these transformation separately, but I want to condense the computation. I cant find an explanation of how to condense more than one rotation matrices into one.

I want
(1) AN expression for a rotation matrix that is a combination of $R(\theta_Z)$ and $R(\theta_X)$, call it $R_{ZX}$, which takes vector V and transforms it directly to vector B without the intermediate calculation of vector A and (2) an expression for a rotation matrix that does all transformations in one step (call it $R_{XYZ}$) that transforms V directly to C.

Best Answer

Your rotation matrix $R$ is given by $$ R = R_Y R_X R_Z $$ or $$ R = \begin{bmatrix} \cos(\theta_Y) & 0 & -\sin(\theta_Y) \\ 0 & 1 & 0 \\ \sin(\theta_Y) & 0 & \cos(\theta_Y) \\ \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos(\theta_X) & \sin(\theta_X)\\ 0 & -\sin(\theta_X) & \cos(\theta_X) \\ \end{bmatrix} \begin{bmatrix} \cos(\theta_Z) & \sin(\theta_Z) & 0 \\ -\sin(\theta_Z) & \cos(\theta_Z) & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} $$ You'll notice that the order of the multiplication is reversed from the order of rotation.

An observation: the rotations you have given about the axes seem to be using "left-hand" rotation has opposed to "right-hand." There's nothing wrong with that but I'm used to seeing rotations that follow the right-hand rule, which would just swap the signs on the sines to give you $$ R = \begin{bmatrix} \cos(\theta_Y) & 0 & \sin(\theta_Y) \\ 0 & 1 & 0 \\ -\sin(\theta_Y) & 0 & \cos(\theta_Y) \\ \end{bmatrix} \begin{bmatrix} 1 & 0 & 0 \\ 0 & \cos(\theta_X) & -\sin(\theta_X)\\ 0 & \sin(\theta_X) & \cos(\theta_X) \\ \end{bmatrix} \begin{bmatrix} \cos(\theta_Z) & -\sin(\theta_Z) & 0 \\ \sin(\theta_Z) & \cos(\theta_Z) & 0 \\ 0 & 0 & 1 \\ \end{bmatrix} $$