( extrinsic) Using the -convention, the 3-1-3 extrinsic Euler angles , and (around the -axis, -axis and again the -axis) can be obtained as follows: Note that is equivalent to where it also takes into account the quadrant that the point is in; see atan2. When implementing the conversion, one has to take into account several situations: There are generally two solutions in the interval . The above formula works only when is within the interval . For the special case , and will be derived from and . There are infinitely many but countably many solutions outside of the interval . Whether all mathematical solutions apply for a given application depends on the situation. Euler angles ( intrinsic) → rotation matrix The rotation matrix is generated from the 3-2-1 intrinsic Euler angles by multiplying the three matrices generated by rotations about the axes. The axes of the rotation depend on the specific convention being used. For the -convention the rotations are about the -, - and -axes with angles , and , the individual matrices are as follows: This yields Note: This is valid for a right-hand system, which is the convention used in almost all engineering and physics disciplines. The interpretation of these right-handed rotation matrices is that they express coordinate transformations (passive) as opposed to point transformations (active). Because expresses a rotation from the local frame to the global frame (i.e., encodes the axes of frame w.r.t frame ), the elementary rotation matrices are composed as above. Because the inverse rotation is just the rotation transposed, if we wanted the global-to-local rotation from frame to frame , we would write . Rotation matrix ↔ Euler axis/angle If the Euler angle is not a multiple of , the Euler axis and angle can be computed from the elements of the rotation matrix as follows: Alternatively, the following method can be used: Eigendecomposition of the rotation matrix yields the eigenvalues 1 and . The Euler axis is the eigenvector corresponding to the eigenvalue of 1, and can be computed from the remaining eigenvalues. The Euler axis can be also found using singular value decomposition since it is the normalized vector spanning the null-space of the matrix . To convert the other way the rotation matrix corresponding to an Euler axis and angle can be computed according to Rodrigues' rotation formula (with appropriate modification) as follows: with the identity matrix,