Problem when reconstructing rotation from Euler angles I have a rotation matrix R:
R=[[-0.22247682, -0.32863132, -0.91788099],
   [-0.01426572, -0.94027818,  0.34010798],
   [-0.9748336 ,  0.08876037,  0.20450194]]

and I want to decompose this into three rotations, $R_Z(\alpha)R_X(\beta)R_Z(\gamma)$, where I consider clockwise rotations. The rotation matrix in terms of these Euler angles is then given by
$R=$
\begin{bmatrix}
\cos\alpha\;\cos\gamma\;-\;\sin\alpha\;\cos\beta\;\sin\gamma & -\sin\gamma\;\cos\alpha\;-\;\sin\alpha\;\cos\beta\;\cos\gamma\; & \sin\alpha\;\sin\beta \\
\sin\alpha\;\cos\gamma\;+\;\sin\gamma\;\cos\alpha\;\cos\beta\; & -\sin\alpha\;\sin\gamma\;+\;\cos\alpha\;\cos\beta\;\cos\gamma & -\cos\alpha\;\sin\beta\\
\sin\beta\;\sin\gamma & \sin\beta\;\cos\gamma & \cos\beta\\
\end{bmatrix}
Then, I calculate $\beta=\arccos(R_{33})=1.36$, $\alpha=\arctan(-R_{13}/R_{23})=1.22$, and $\gamma=\arctan(R_{31}/R_{32})=-1.48$. As a double check, I reconstruct the matrix R from these Euler angles, and find the following:
R'=[[ 0.22247682,  0.32863132, -0.91788099],
    [ 0.01426572,  0.94027818,  0.34010798],
    [ 0.9748336 , -0.08876037,  0.20450194]])

I double checked everything, but I cannot find what the problem is. What could I be missing?
Edit: It turns out the transpose problem was because my python code had some indexation problem. The sign issues still persist, however. I updated the matrix R' above.
 A: 1) Your calculation for the angles is correct, apart from the indetermination in
the signs.
From $\cos\beta$ you can deduct $\pm \beta$. From $\tan\alpha$ you can deduct
$(\alpha, \alpha -\pi,\alpha +\pi)$, and same for $\gamma$.
Then you shall check the assumptions with the other elements of the starting matrix.
Taking $\beta=1.36$ then $\cos\beta$ and $\sin\beta$ are positive. From 
$R[1,3]$ and $R[2,3]$ then follows that $\cos\alpha$ and$\sin\alpha$ shall be both negative: 
so $\alpha=1.22-\pi$.
For $\gamma=-1.48$ the signs of $R[3,1]$ and $R[3,2]$ are correct.
2)  The elemental rotation matrices, defined according to this Wikipedia article 
    therefore pre-multiplying, counter-clockwise and right hand in particular, are
    $$
 {\bf R}_{\,{\bf x}} (\alpha ) = \left( {\matrix{
    1 & 0 & 0  \cr 
    0 & {\cos \alpha } & { - \sin \alpha }  \cr 
    0 & {\sin \alpha } & {\cos \alpha }  \cr 
  } } \right)\quad {\bf R}_{\,{\bf y}} (\beta ) = \left( {\matrix{
    {\cos \beta } & 0 & {\sin \beta }  \cr 
    0 & 1 & 0  \cr 
    { - \sin \beta } & 0 & {\cos \beta }  \cr 
  } } \right)\quad {\bf R}_{\,{\bf z}} (\gamma ) = \left( {\matrix{
    {\cos \gamma } & { - \sin \gamma } & 0  \cr 
    {\sin \gamma } & {\cos \gamma } & 0  \cr 
    0 & 0 & 1  \cr 
  } } \right)
 $$
3)  Applying these matrices and the corrected angles, I get that
    $$
 {\bf R}_{\,{\bf z}} (\alpha )\;{\bf R}_{\,{\bf x}} (\beta )\;{\bf R}_{\,{\bf z}} (\gamma )
 $$
    correctly returns the starting matrix.
The result you are obtaining, apart from signs, is the transposed of the 
original matrix, meaning that probably you are not using the correct
elemental matrices
A: I have confirmed the rotation matrix expression, but I would extract the angles a little differently than you.


*

*$\gamma = {\rm atan2}(R_{31},\,R_{32}) = -1.4799948857740634$

*$\beta = {\rm atan2}( \sqrt{R_{31}^2 +R_{32}^2 }, \,R_{33} ) = 1.3648414591977873$

*$\alpha = {\rm atan2}( R_{13},\, -R_{23} ) = -1.9256476493782756 $


where atan2(dy,dx) is the arc tangent covering the entire unit circle.
The recustruction is thus
R = RZ(1.2159450042115176)*RX(1.3648414591977873)*RZ(-1.4799948857740634) $\checkmark$
