## a 2D change of basis: a rotation

let’s talk about matrices: linear operators, attitude matrices, and transition matrices. well, by “talk” i mean let’s play around, get our hands dirty.

ok, i’m in the xy-plane, i’ve got axes. i have a vector of length 2 at $45^\circ$, and i want to rotate that vector by $30^\circ$ CCW (counter-clockwise). what’s the rotation matrix that does that?
here’s the vector.

$z=2(\text{Cos}[45^\circ],\ \text{Sin}[45^\circ])$

$z = (\sqrt{2},\ \sqrt{2})$

now, i know i need ±sin 30 but i never remember where the negtive sign goes in the rotation matrix. in general, i know i need

$\left(\begin{array}{cc} \text{Cos}[\theta ]&\pm \text{ Sin}[\theta ]\\ \mp \text{ Sin}[\theta ]&\text{Cos}[\theta ]\end{array}\right)$

(where i show that the sin terms have opposite signs, but which is where?) i also know that the columns of a matrix are the images of the basis vectors, so the first column

$\left(\begin{array}{c} \text{Cos}[\theta ]\\ \mp \text{Sin}[\theta ]\end{array}\right)$

must be the image of (1,0) under the rotation; and that, i know, needs a positive y-component for a small CCW rotation. so the first column must have a positive sign. we write in general…

$\left(\begin{array}{cc} \text{Cos}[\theta ]&-\text{Sin}[\theta ]\\ \text{Sin}[\theta ]&\text{Cos}[\theta ]\end{array}\right)$

and, for $30^\circ$ in particular…

$\left(\begin{array}{cc} \frac{\sqrt{3}}{2}&-\frac{1}{2}\\ \frac{1}{2}&\frac{\sqrt{3}}{2}\end{array}\right)$

now we apply our rotation to the given vector…

$\left(\begin{array}{cc} \frac{\sqrt{3}}{2}&-\frac{1}{2}\\ \frac{1}{2}&\frac{\sqrt{3}}{2}\end{array}\right)$ x $\left(\begin{array}{c} \sqrt{2}\\ \sqrt{2}\end{array}\right)$

and get

$\left(\begin{array}{c} \frac{-1+\sqrt{3}}{\sqrt{2}}\\ \frac{1+\sqrt{3}}{\sqrt{2}}\end{array}\right)$

so, we’re done. draw it.

OTOH, rotating a vector $30{}^{\circ}$ CCW should be the same as rotating the basis vectors $30{}^{\circ}$ CW. and that, i know how to write. that is, i know how to write the new basis vectors without hesitation. the new unit x-vector has components

$(\text{Cos}[-30{}^{\circ}],\ \text{Sin}[-30{}^{\circ}])$

$(\frac{\sqrt{3}}{2},-\frac{1}{2})$

and the new unit y-vector has components

$(\text{Sin}[30{}^{\circ}],\ \text{Cos}[30{}^{\circ}])$

$(\frac{1}{2},\frac{\sqrt{3}}{2})$

(i wrote $30{}^{\circ}$ in the second one rather than $-30{}^{\circ}$ because i’m working from an image in my head; analytically, i know that all 4 arguments should be the same $-30{}^{\circ}$ angle.)
now i confirm that the new (red) basis is what i expect:

if i lay these two vectors out as rows, i get what is called the attitude matrix A for the new basis.

$A = \left(\begin{array}{cc} \frac{\sqrt{3}}{2}&-\frac{1}{2}\\ \frac{1}{2}&\frac{\sqrt{3}}{2}\end{array}\right)$

how do we use this to get the new components y of z, i.e. the components of z wrt the new basis? the relevant facts are
• (1) that the old components z are found by applying the transition matrix P to the new components y, and
• (2) the transition matrix is the transpose of the attitude matrix.

that is,

$z = P \ y$

and

$P = A^T$.

but we want y, so we write

$y = P^{-1}\ z = A^{-T}\ z$.

so we need to compute $A^{-T}$, or we recognize that since – in this special case, A is a rotation, hence orthogonal – we have

$A^T = A^{-1}$, or $A^{-T} = A$

we apply A to z:

$\left(\begin{array}{cc} \frac{\sqrt{3}}{2}&-\frac{1}{2}\\ \frac{1}{2}&\frac{\sqrt{3}}{2}\end{array}\right)$ x $\left(\begin{array}{c} \sqrt{2}\\ \sqrt{2}\end{array}\right)$

= $\left(\begin{array}{c} \frac{-1+\sqrt{3}}{\sqrt{2}}\\ \frac{1+\sqrt{3}}{\sqrt{2}}\end{array}\right)$

is that the same? yes. what we had before was:

$(\frac{-1+\sqrt{3}}{\sqrt{2}},\frac{1+\sqrt{3}}{\sqrt{2}})$

so we computed new components in two ways. rotating the vector is called an active transformation, or an “alibi” because the vector is elsewhere; rotating the basis out from under the vector is called a passive transformation, or an “alias” because it’s the same vector with different names (components).

when we change a basis, there’s only one matrix involved, although it too has an alias: if the new basis vectors are laid out in rows, it’s called an attitude matrix; if they’re laid out in columns, it’s called a transition matrix. one is the transpose of the other. to use one, you have to know which one it is.