Consider a point in the \(x\)-\(y\) plane, we can specify its location with a length \(r\) and an angle \(\phi\). Now imagine that the point is rotated anti-clockwise by and angle \(\theta\), then it’s pretty obvious the new position of the point is at an angle \(\phi+\theta\) and still at a distance \(r\).
Addition of rotations.
We could write this transformation as a vector with \(x\) and \(y\) components:
\[\begin{equation*}\begin{pmatrix} r \cos\phi\\ r\sin\phi \end{pmatrix} \rightarrow
\begin{pmatrix} r \cos(\phi+\theta)\\ r\sin(\phi+\theta) \end{pmatrix}\end{equation*}\]
We can expand \(\cos(\phi+\theta) = \cos\theta\cos\phi - \sin\theta\sin\phi\) and \(\sin(\phi+\theta) = \cos\theta\sin\phi + \sin\theta\cos\phi\), then view the result as a matrix multiplying the original vector:
\[\begin{equation*}\begin{pmatrix} r \cos\phi\\ r\sin\phi \end{pmatrix} \rightarrow
\begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix}
\begin{pmatrix} r \cos\phi\\ r\sin\phi \end{pmatrix}.\end{equation*}\]
In other words, we can represent a rotation by an anti-clockwise angle \(\theta\) as the matrix
Extending to 3D, it should be clear that the previous result is a rotation around the \(z\)-axis and it has the property that it will leave the \(z\) value unchanged. It is easy to extend the previous result about any particular Cartesian axis
The rotation around the \(y\) axis has a subtlety. Above we’ve defined positive rotations as rotations that are anti-clockwise when viewed into the axis of rotation. This is a right hand rotation and is the direction your right hand fingers curl when you point the thumb of that hand in the direction of the axis of rotation. The way we have written the vectors, a right hand rotation turns the topmost axis to the bottom most: i.e. \(R_z\) rotates \(x\) to \(y\), and \(R_x\) rotates \(y\) to \(z\). To be a right hand rotation \(R_y\) need to rotate \(z\) to \(x\) though, so we have to interchange the off-diagonal terms:
What about rotations about any arbitrary axis? Here things get a little more complex and there are several possibilities. A general feature is that a rotation in 3D will be specified by three numbers.
2.1 Axis-angle
The most intuitive representation of a rotation in 3D is to specify the axis together with an angle of rotation \((\hat{n}, \theta)\). To pin down the axis \(\hat{n}\) (direction) requires two numbers, and the size of rotation gives the third, so we have the three numbers we need.
Though it’s a deceptively easy way of visualising rotations in 3D, it doesn’t give a very useful picture for composing several rotations together. For starters rotations don’t commute in general, so the order of rotations matters. This rules out representing rotations nicely by vectors.
2.2 Rotation sequences
Since we need three numbers we could imagine doing three rotations in sequence each about one of \(x\), \(y\), or \(z\), which gives \(3^3=27\) possibilities. But if we choose the same axis sequentially we are doing nothing more than creating a different angle, so we need to remove those from the count. There are 3 ways of choosing the same axis three times consecutively, and there are 12 ways of choosing two axes the same consecutively, so in the end there are only \(3^3-3-12=12\) possibilities. Any of these 12 remaining choices would form a valid sequence for describing rotations in 3D. Of these, \(z\)-\(x\)-\(z\) and \(z\)-\(y\)-\(x\) are particularly well known though unfortunately they both tend to be called “Euler angles”.
By representing rotations by these matrices the non-commutativity of rotations is naturally expressed in the mathematics.
2.3 Euler Angles (\(z\)-\(x\)-\(z\))
We break the rotation down into three separate rotations around the axes \(z\), \(x\), and \(z\) again:
So the first rotation rotates by \(\phi\) around the \(z\) axis, the second by \(\theta\) around the new \(x'\) axis and the last by \(\psi\) around the new \(z'\) axis.
With this particular convention while studying spinning tops, the \(\phi\), \(\theta\), and \(\psi\) angles are known as the angles of precession, nutation, and spin respectively.
Euler angles commonly used for spinning tops. The combination of rotations can be thought of as first rotate by \(\phi\) around the \(z\) axis, then by \(\theta\) around the new \(x'\) axis, finally by \(\psi\) around the new \(z'\) axis.
2.4 Euler Angles (\(z\)-\(y\)-\(x\))
Another common choice is to rotate around \(z\), then around the new \(y\), and finally around the new \(x\).
Imagine there is a plane upside down (top of the plane points in the \(-z\) direction) and heading in the \(x\) direction. The the first rotation about \(z\) determines the yaw or heading, the rotation about \(y\) determines the pitch or attitude, and the final rotation about \(x\) determines the roll or bank.
Why upsidedown? This convention is so that a positive pitch points up.
Euler angles commonly used for avionics: first rotate around \(z\) (yaw), then around the new \(y\) (pitch), and finally around the new \(x\) (roll).
2.5 Gimbal Lock
One of the weaknesses of representing rotations by Euler angles is that for certain angle choices, the remaining two axes can line up and so their angles describe a rotation about the same axis. This is called “Gimbal lock” and means we lose a degree of freedom.
Example
If we choose \(\theta=0\) in the \(z\)-\(x\)-\(z\) scheme then we just end up with two consecutive \(z\) rotations—all we can do is rotate around the \(z\) axis and we’ve lost two degrees of freedom instead of just one.
Example
In \(z\)-\(y\)-\(x\) try setting the pitch to point straight up or down then look at the response to changes in yaw or roll.