# Angle from 2x2 Rotation Matrix

How would I go about extracting the angle from a 2x2 rotational matrix? I'm using a matrix to track transformations in 2D space, but I'm struggling to figure out how to reverse this once I've got the rotation matrix so I can just see the angle that was applied.

If it's a 2D rotation matrix, then it equals $$R(\theta)=\begin{pmatrix} \cos\theta & -\sin\theta\\ \sin\theta & \cos \theta \end{pmatrix}$$ where $$\theta$$ is the angle you are looking for. Therefore, you can simply take $$\cos^{-1}$$ of the first entry in your matrix.
Due to the periodicity of the cosine function though, you won't know the sign of $$\theta$$ (i.e., whether it is clockwise or anticlockwise). You can determine this by noting the signs of the sines (e.g. if the angle is $$-30^\circ$$, then the $$\sin$$ entry in the first column would be negative).
• I would use the atan2 function on the entries with $\cos$ and $\sin$, otherwise you can get the direction wrong: $$\cos\theta=\cos(-\theta)$$ – Andrei Sep 9 at 16:11
• The definition of tangent is $\tan\theta=\frac{\sin\theta}{\cos\theta}$. The atan2 function takes two inputs, the cosine and the sine. So, in this case, use the two values in the first column. – Andrei Sep 9 at 16:21