## here, have some rotations

Let us suppose that someone hands us these three rotation matrices about the z, y, and x axes respectively.

$Rz(\theta) = \left(\begin{array}{lll} \cos (\theta ) & \sin (\theta ) & 0 \\ -\sin (\theta ) & \cos (\theta ) & 0 \\ 0 & 0 & 1\end{array}\right)$

$Ry(\theta) = \left(\begin{array}{lll} \cos (\theta ) & 0 & -\sin (\theta ) \\ 0 & 1 & 0 \\ \sin (\theta ) & 0 & \cos (\theta )\end{array}\right)$

$Rx(\theta) = \left(\begin{array}{lll} 1 & 0 & 0 \\ 0 & \cos (\theta ) & \sin (\theta ) \\ 0 & -\sin (\theta ) & \cos (\theta )\end{array}\right)$

## around the z-axis

Now, just what are they? Better, what do they do to vectors?

Answer: viewed as active transformations (“alibi”), they do CW rotations of vectors. The keys: active transformation, CW.

Alternatively, viewed as passive transformations (“alias”), they are attitude matrices for CCW rotations of coordinate axes. There are three keys to that answer: passive transformation, CCW, and attitude matrix. (in more general cases, one of which I will look at below, they are inverse transition matrices instead of attitude matrices.)

We are looking specifically at rotations. (how do I know that? They are orthogonal matrices with determinant +1.)

In a sense, the active transformation is more fundamental when i’m simply given a matrix. How do I know which is the old coordinate system and which is the new? “Old or new coordinate system” only makes sense for the passive interpretation, but we always have the active interpretation: applied to an old vector, the matrix gives us a new one. In this case, Rz rotates a vector CW about the z axis. That’s what it does. Its input is the old vector, its output is the new vector.

If you want, remember that a matrix has an implicit coordinate system – it’s the representation of a linear operator wrt some basis, under the active interpretation – and if we’re given the matrix then we’re given its implicit coordinate system. When we investigate a matrix by applying it to a vector, the matrix and the vector are in one coordinate system, and we are about to compute something new.

I hate the feeling that i’m beating a dead horse, but…. it’s one thing to figure out what a matrix (such as Rz) does, when I have no additional information. It’s something else entirely if someone hands me a matrix (such as Rz) and says that it’s the transition matrix.

Let’s just get on with it. We apply Rz to some vector. Here’s a choice I like. Consider Rz…

$\left(\begin{array}{lll} \cos (\theta ) & \sin (\theta ) & 0 \\ -\sin (\theta ) & \cos (\theta ) & 0 \\ 0 & 0 & 1\end{array}\right)$

we get…for a +45° rotation… applied to a +45° vector…

$\left(\begin{array}{l} \sqrt{2} \\ 0 \\ 0\end{array}\right)\$= $\left(\begin{array}{lll} \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 0 \\ -\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} & 0 \\ 0 & 0 & 1\end{array}\right)\$ $\left(\begin{array}{l} 1 \\ 1 \\ 0\end{array}\right)$

The result of the rotation – the result of applying Rz to a 45° vector – is unambiguously a vector which lies on the x-axis. But we have two choices for “the x-axis”. Viewed as an active transformation, the rotation maps that 45° vector to the stationary x-axis, our given vector has been rotated 45° CW to lie on the old x-axis. Alternatively, viewed as a passive transformation, the x-axis has been rotated 45° CCW to lie under our stationary 45° vector. We either have old vector (1,1,0) and new vector $\left(\sqrt{2},\ 0,\ 0\right)\$, or we have old components (1,1,0) and new components $\left(\sqrt{2},\ 0,\ 0\right)\$.

Under the passive interpretation I wrote a transformation, a rotation, from old to new, so Rz is the inverse transition matrix, i.e. the attitude matrix. The rows of an attitude matrix are the (old components of) the new basis vectors, so the first row of Rz(45°) is the old components of the new x-axis:

$\left\{\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}},0\right\}$

Those are both positive, so the new x-axis is in the first quadrant. As we said, the (x and y) coordinate axes have been rotated CCW.

Rz is either the attitude matrix (inverse transition matrix) for a CCW rotation of the x and y axes (passive transformation), or it is a CW rotation of vectors about the z-axis (active transformation).

I emphasize that there is nothing sacred about my choice of signs in Rz. since my recent and current applications were to planetary orbits and airplane coordinates, my choice gives me positive angles for the customary CCW rotations of coordinate axes to get planetary and airplane coordinates. If someone says that a rotation about the z axis is given by

$\left(\begin{array}{lll} \cos (\theta ) & -\sin (\theta ) & 0 \\ \sin (\theta ) & \cos (\theta ) & 0 \\ 0 & 0 & 1\end{array}\right)$

… well, you know enough to show that this represents either a CCW rotation of a vector, or a CW rotation of the x and y axes.

## be careful

A positive angle in my Rz specifies a CCW rotation of the coordinate axes or a CW rotation of a vector. That can be confusing because we often denote the coordinate axes by unit vectors, but rotating a basis vector is not the same as rotating the coordinate axis it lies on.

I think I was confused by that when I was an undergraduate. It seems to me that when I was first dealing with rotations, I used to try to figure out the effect of a rotation matrix by applying it to a unit vector on the x-axis. No problem so far. But I think I thought that the image of the $\hat{i}$ vector would be the new x-axis. It’s hard to be sure what I was really doing all that long ago, but what i’m sure of is that more often than not, I was off by the sign of the angle.

But here’s the thing. What a rotation does to the unit $\hat{i}$ vector is not what it does to the x-axis. The active interpretation rotates the unit vector one way, while the passive interpretation rotates the x-axis the other way.

Even today, that seems a little strange, but there it is.

## around the y or x

Similarly, for Ry(, a rotation about the y axis…

$\left(\begin{array}{lll} \cos (\theta ) & 0 & -\sin (\theta ) \\ 0 & 1 & 0 \\ \sin (\theta ) & 0 & \cos (\theta )\end{array}\right)$

we get…for a +45° rotation… applied to a +45° vector in the xz-plane…

$\left(\begin{array}{l} 0 \\ 0 \\ \sqrt{2}\end{array}\right)\$ = $\left(\begin{array}{lll} \frac{1}{\sqrt{2}} & 0 & -\frac{1}{\sqrt{2}} \\ 0 & 1 & 0 \\ \frac{1}{\sqrt{2}} & 0 & \frac{1}{\sqrt{2}}\end{array}\right)$ $\left(\begin{array}{l} 1 \\ 0 \\ 1\end{array}\right)$

maps our test vector to the z-axis (active) or rotates our z-axis to lie under the vector (passive), i.e. we have done a CCW rotation of the x and z coordinate axes about the y-axis. Ry is the attitude matrix, and our new z-axis is given by the 3rd row of Ry:

$\left\{\frac{1}{\sqrt{2}},0,\frac{1}{\sqrt{2}}\right\}$

(If you can visualize that rotation, it’s the z-axis that is rotated into the first quadrant of the xz-plane; that’s why the signs are positive in the third row of Ry instead of in the first.)

Finally, for Rx, a rotation about the x-axis…

$\left(\begin{array}{lll} 1 & 0 & 0 \\ 0 & \cos (\theta ) & \sin (\theta ) \\ 0 & -\sin (\theta ) & \cos (\theta )\end{array}\right)$

we get… from a 45° rotation applied to a 45° vector in the yz-plane…

$\left(\begin{array}{l} 0 \\ \sqrt{2} \\ 0\end{array}\right)\$ = $\left(\begin{array}{lll} 1 & 0 & 0 \\ 0 & \frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}} \\ 0 & -\frac{1}{\sqrt{2}} & \frac{1}{\sqrt{2}}\end{array}\right)$ $\left(\begin{array}{l} 0 \\ 1 \\ 1\end{array}\right)$

which lies on the positive y-axis, so we have rotated the y-axis CCW. Once again, Rx is an attitude matrix, and the new y-axis is given by the 2nd row:

$\left\{0,\frac{1}{\sqrt{2}},\frac{1}{\sqrt{2}}\right\}$

## not a rotation

Let’s take a simple example which is not a rotation: leave x alone, double y. that is, I want a matrix whose effect on any input vector is to double the y-component. That matrix is

$L = \left(\begin{array}{ll} 1 & 0 \\ 0 & 2\end{array}\right)$

Applied to an arbitrary vector (a,b)… we get

$\left(\begin{array}{l} a \\ 2 b\end{array}\right)$

Or, applying L to the basis vectors, we get its columns (1,0) and (0,2). Those are the active interpretation. What does that say about the passive interpretation?

Looking at it directly, L must be the inverse transition matrix, because L maps old to new. Then the transition matrix $P = L^{-1}$ is

$P = \left(\begin{array}{ll} 1 & 0 \\ 0 & \frac{1}{2}\end{array}\right)$

Then the attitude matrix $A = P^T$ is the transpose transition, so (although it’s trivial for a diagonal matrix)

$A = P^T = \left(\begin{array}{ll} 1 & 0 \\ 0 & \frac{1}{2}\end{array}\right)$

which says what we know: the y component has doubled, so the new y basis vector – which is the second row of A – has half the length.

Instead, we could have taken that as our starting point: the y component has doubled, so the new y basis vector has half the length. The attitude matrix must be

$A = \left(\begin{array}{ll} 1 & 0 \\ 0 & \frac{1}{2}\end{array}\right)$

The transition matrix $P = A^T$ is the transpose attitude (again, trivial in this case):

$P = A^T = \left(\begin{array}{ll} 1 & 0 \\ 0 & \frac{1}{2}\end{array}\right)$

and then the inverse transpose matrix is…

$P^{-1} = \left(\begin{array}{ll} 1 & 0 \\ 0 & 2\end{array}\right)$

and that is, as it should be, our original matrix L.

## mars

We discussed planetary and solar system coordinate systems just a few days ago(here), and I said I’d show you this. Bates et al gives me orbital elements for mars; what I need are

• $\Omega$ = 49.322°,
• i = 1.85°,
• “longitude of perihelion” $\Pi$ = 335.497°,

and they tell me that

$\Pi = \Omega + \omega$, so $\omega = \Pi - \Omega\$.

(and the orbital elements are in bates et al. but not in prussing; the books are not substitutes for each other.)

Now, I want a rotation about z thru $\Omega\$:

$R1 = \left(\begin{array}{lll} 0.651807 & 0.758385 & 0 \\ -0.758385 & 0.651807 & 0 \\ 0 & 0 & 1\end{array}\right)$

Then a rotation about x thru i:

$R2 = \left(\begin{array}{lll} 1 & 0 & 0 \\ 0 & 0.999479 & 0.032283 \\ 0 & -0.032283 & 0.999479\end{array}\right)$

Then a rotation about z thru $\omega = \Pi - \Omega\$:

$R3 = \left(\begin{array}{lll} 0.278572 & -0.960415 & 0 \\ 0.960415 & 0.278572 & 0 \\ 0 & 0 & 1\end{array}\right)$

So the combined rotation is…

$Rm = R3 R2 R1 = \left(\begin{array}{lll} 0.90956 & -0.414415 & -0.0310051 \\ 0.414851 & 0.909845 & 0.00899314 \\ 0.0244829 & -0.0210423 & 0.999479\end{array}\right)$

(note that the order is R1, then R2, then R3.)

That’s the attitude matrix relating mars to the solar system, with the solar system as old coordinates. The third row is mars’ z-axis (wrt the solar system). it is very nearly (0,0,1), as it should be: the angle of inclination was less than 2°. Let’s draw mars’ x and y axes in red.

That makes sense. If we neglect the rotation about x thru 1.85°, then we have two rotations about z thru a combined angle of $\Omega + \omega = \Pi$ = 335°, i.e. -25°: the new x-axis was rotated CCW almost all the way around.

Next time, we’ll see how to find the axis of rotation and angle of rotation for the final rotation matrix for mars, and, conversely, how to find the rotation matrix given the axis and angle.