# Avoiding gimbal lock

I am not really sure if I understand the phenomenon of gimbal lock correctly.

Say I have a vector $\begin{pmatrix} x\\ y\\ z \end{pmatrix}$.

And I want to keep the vector's length fixed but move it in a given direction with respect to the $x, y$ or $z$ axis - i.e. rotate it in that direction.

So, for instance, if I want to rotate it $30$ degrees about the $z$-axis, I would multiply by the matrix $$\begin{pmatrix} \cos(30°) & -\sin(30°) & 0\\ \sin(30°) & \cos(30°) & 0\\ 0 & 0 & 1\end{pmatrix}_.$$

And likewise for the other two axes. Will some sequence of these rotations eventually cause "gimbal lock?" Or will no problem arise using this method?

Let $R_x(\alpha)$ denote a rotation matrix around $x$ by $\alpha$.
Then, a general rotation can be written as $R = R_x(\alpha) R_y (\beta) R_z(\gamma)$. Suppose that $R_x(\alpha)$ becomes the identity map. Then $R = R_y(\beta) R_z(\gamma)$ in the new coordinate frame, and hence there is no longer any notion about "rotation around $x$."
• Right, but I'm doing rotations in sequence, and only about x, y, or z. I.e. I do not have "general rotations" - my rotations are only $R_x(\alpha), R_y(\beta), R_z(\gamma)$, but no combination of these. My coordinate frame is not changing. – user2258552 May 30 '14 at 23:52
• You're missing the key. $R_1$ rotates around your first set of axes. $R_2$ rotates around the set of axes determined by $R_1$, whether you like it or not. Play with some examples and see. – Emily May 31 '14 at 14:47