# How are the equations for Euler angles derived from a given rotation matrix?

Given a rotation matrix, $R$, which is defined as: $$R = \begin{bmatrix}r_{11} & r_{12} & r_{13}\\r_{21} & r_{22} & r_{23} \\ r_{31} & r_{32} & r_{33}\end{bmatrix}$$ how are the expressions for the Euler angles derived? For example, if I have a Z-Y-Z rotation matrix (as defined below, where $C_{\theta}=cos(\theta)$ and $S_{\theta}=sin(\theta)$), how do I derive expressions to define $\alpha$, $\beta$ and $\gamma$? $$R_{Z-Y-Z} (\gamma, \beta, \alpha) = \begin{bmatrix}C_{\alpha}C_{\beta}C_{\gamma}-S_{\alpha}S_{\gamma} & -C_{\gamma}S_{\alpha}-C_{\beta}C_{\gamma}S_{\alpha} & C_{\gamma}S_{\beta}\\C_{\gamma}S_{\alpha}+C_{\alpha}C_{\beta}S_{\gamma} & C_{\alpha}C_{\gamma}-C_{\beta}S_{\alpha}S_{\gamma} & S_{\beta}S_{\gamma} \\ -C_{\alpha}S_{\beta} & S_{\alpha}S_{\beta} & C_{\beta}\end{bmatrix}$$

For a typical ZYX Euler angle rotation, the solutions for the angles are given as: $$cos(\beta) = \sqrt(r_{11}^2+r_{21}^2),\qquad sin(\beta) = -r_{31} \qquad \beta = atan2\left(-r_{31}, \sqrt(r_{11}^2+r_{21}^2)\right)$$ $$cos(\alpha) = \frac{r_{11}}{cos(\beta)}, \qquad sin(\alpha) = \frac{r_{21}}{cos(\beta)} \qquad \alpha = atan2\left(\frac{r_{11}}{cos(\beta)}, \frac{r_{21}}{cos(\beta)}\right)$$ $$cos(\gamma) = \frac{r_{32}}{cos(\beta)}, \qquad sin(\alpha) = \frac{r_{33}}{cos(\beta)} \qquad \alpha = atan2\left(\frac{r_{32}}{cos(\beta)}, \frac{r_{33}}{cos(\beta)}\right)$$ But how is this known from the matrix? Why does $\beta$ equal what it does?

• First calculate the matrix corresponding to a rotation about one fixed axis and then multiply three matrices. – Blazej Feb 18 '17 at 22:29