I have a question which is bothering me for days! Suppose that we have a fixed frame $XYZ$ and a moving frame $xyz$ in 3D. The moving frame is orthonormal and is defined based on the fixed one using 9 direction cosines. For instance, the unit vector $x$ is $(l_1,m_1,n_1)$ where $l_1$, $m_1$ and $n_1$ are the cosines of the angles between $x$ and $X$, $Y$ and $Z$ respectively. Similarly, we have $y=(l_2,m_2,n_2)$ and $z=(l_3,m_3,n_3)$ which are also unit vectors.
My question is: At first the moving frame $xyz$ coincides $XYZ$. Then it rotates arbitrary to form a frame with known direction cosines. How can I calculate the angle of rotation of the moving frame around its $z$ axis based on the 9 direction cosines. In other words, how much the $x$-axis rotates around the $z$-axis?
Thanks a lot for saving me!