In our first linear algebra course, we learned about the vector space $\bbR^3$ and how the linear operations on this space play with the geometry quite well. Addition $v + w$ corresponds to displacing $v$ and then $w$, while scalar multiplication $\alpha v$ corresponds to scaling $v$ by $\alpha$. From this, we are able to represent physical transformations (e.g. rotations, translations, and scales) in terms of simple affine maps $T: \bbR^3 \rightarrow \bbR^3$. To this end, linear algebra becomes a very powerful tool for modeling the physical world.
However, one limitation of representing locations and displacements as elements of $\bbR^3$ is that the coordinate system is absolute. In the real world, it is often advantageous to speak relatively: for instance, I may tell you a location as follows.
Look at that cute rat, about $2$-meters in front of you!
You would then be excited by the spectacle and reply:
He's a baby boy! How did you notice him, even though he is $3$-meters behind you?!to which I would respond:
I always know when a dang rat is around.Just as our language allows us to speak of the same location in different ways, we would like our locations $\calL$ and displacements $\calD$ to manifest as different coordinates in $\bbR^3$, relative to a frame of reference. This post explains how this is done.
Say there are two rats—Sam and Eric—standing at different locations, oriented in different ways.
Sam tells Eric the location of some tasty chicken.
Eric, the chicken is $4.2$ steps right of me, $6.9$ steps forward, and $6.66$ steps up.
In order for Eric to understand this location from his own frame of reference, he needs to answer $4$ questions.
Question 1. What is Sam's location, relative to my frame of reference?
Eric recognizes Sam is $x$-steps right, $y$-steps forward, and $z$-steps up. To him, Sam's location is a coordinate vector $(x, y, z) \in \bbR^3$. If Eric needed to, he could displace $(x, y, z)$ relative to his perspective to find himself at Sam's location.
Once at Sam's location, he must trace Sam's own steps.
Question 2. What steps must I take to simulate Sam's step right?Though Eric is at the same location as Sam, a step right for Sam is not the same as that for Eric. Let's say it is the case that if Eric takes $a_{11}$ steps right, $a_{21}$ steps forward, and $a_{31}$ steps up, he will simulate the same as a step right for Sam.
From here, we can probably guess the last two questions Eric must ask.
Question 3. What steps must I take to simulate Sam's step forward?Let's say this is $(a_{12}, a_{22}, a_{32})$. Eric would use this information to displace $6.9(a_{12}, a_{22}, a_{32})$.
Question 4. What steps must I take to simulate Sam's step upward?Let's say this is $(a_{13}, a_{23}, a_{33})$. Eric would use this information to displace $6.66(a_{13}, a_{23}, a_{33})$.
In total, Eric can get to the chicken like so. $$\begin{pmatrix} x \\ y \\ z \end{pmatrix} + 4.2 \begin{pmatrix} a_{11} \\ a_{21} \\ a_{31} \end{pmatrix} + 6.9 \begin{pmatrix} a_{12} \\ a_{22} \\ a_{32} \end{pmatrix} + 6.66 \begin{pmatrix} a_{13} \\ a_{23} \\ a_{33} \end{pmatrix} $$ This linear combination can be simplified to the following matrix product. $$\begin{pmatrix} a_{11} & a_{12} & a_{13} & x \\ a_{21} & a_{22} & a_{23} & y \\ a_{31} & a_{32} & a_{33} & z \\ 0 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 4.2 \\ 6.9 \\ 6.66 \\ 1 \end{pmatrix}$$ Organizing our calculations this way is nice, because the coordinates $(4.2, 6.9, 6.66) \in \mathbb R^3$ of the chicken in Sam's frame are nicely packed into a single vector. $$\begin{pmatrix} a_{11} & a_{12} & a_{13} & x \\ a_{21} & a_{22} & a_{23} & y \\ a_{31} & a_{32} & a_{33} & z \\ 0 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} { \color{red} 4.2 } \\ { \color{red} 6.9 } \\ { \color{red} 6.66 } \\ 1 \end{pmatrix}$$
If Sam were to describe a new location with respect to his frame as a coordinate vector $(u, v, w) \in \mathbb R^3$, Eric may reuse the relative frame matrix obtained from the $4$ questions to understand the location as a coordinate vector $(a, b, c) \in \mathbb R^3$ in his own coordinate system.
$$ \begin{pmatrix} a \\ b \\ c \\ 1 \end{pmatrix} = \begin{pmatrix} a_{11} & a_{12} & a_{13} & x \\ a_{21} & a_{22} & a_{23} & y \\ a_{31} & a_{32} & a_{33} & z \\ 0 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} u \\ v \\ w \\ 1 \end{pmatrix}$$The above matrix does not only help Sam and Eric immediately translate locations between coordinate systems. It also helps them translate displacements between coordinate systems. For instance, if Sam told Eric:
From where you are standing, take a step right.
Eric is an empathetic rat; he knows Sam is talking about right from his own perspective.
That said, Eric remembers to displace $(a_{11}, a_{21}, a_{31})$ in his own frame, even though such a displacement is $(1,0,0)$ to Sam. To no surprise, this displacement is immediately calculated with the following matrix product. $$ \begin{pmatrix} a_{11} \\ a_{21} \\ a_{31} \\ 0 \end{pmatrix} = \begin{pmatrix} a_{11} & a_{12} & a_{13} & x \\ a_{21} & a_{22} & a_{23} & y \\ a_{31} & a_{32} & a_{33} & z \\ 0 & 0 & 0 & 1 \end{pmatrix} \begin{pmatrix} 1 \\ 0 \\ 0 \\ 0 \end{pmatrix}$$ Note that the key difference between this calculation and that for the location of the chicken is the $0$ in the $4$-th component of the vector.Now that we have seen an example, we may create an abstraction. Denote the set of locations and displacements in space with the sets $\calL$ and $\calD$, respectively. These sets should have the following algebraic structure. $$\begin{aligned} p \in \calL, ~ d \in \calD &\quad \leadsto \quad p + d \in \calL \\ p, q \in \calL &\quad \leadsto \quad p - q \in \calD \\ c, d \in \calD, ~ \alpha \in \bbR &\quad \leadsto \quad c + \alpha d \in \calD \\ \end{aligned}$$ The first rule tells us that we may always displace from a location to another location, the second rule is that the difference of locations is always a displacement, while the last is simply that displacements form a real vector space. Define a family $\calF$ of frames which serve as our coordinate systems. For a frame $F \in \calF$ and a location $p \in \calL$, we may define $[p]_F \in \bbR^3$ as the coordinates of $p$ with respect to $F$. Similarly denote the coordinates $[d]_F \in \bbR^3$ of the displacement $d \in \calD$ with respect to the frame $F \in \calF$. Because we want this map $[\cdot]_F$ to provide coordinates, it must be bijective on its restrictions to $\calL$ and $\calD$ and preserve the algebraic structure. $$\begin{aligned} [p]_F - [q]_F = [p - q]_F, & \quad p, q \in \calL \\ [p]_F + [d]_F = [p + d]_F, & \quad p \in \calL, ~ d \in \calD \\ [c]_F + \alpha [d]_F = [c + \alpha d]_F & \quad c, d \in \calD, ~ \alpha \in \bbR \end{aligned}$$ Bijectivity of $[\cdot]_F$ means that each frame $F$ has an origin $o_F \in \calL$ characterized by $[o_F]_F = 0 \in \bbR^3$ and standard displacements $d_{F1}, d_{F2}, d_{F3} \in \calD$ characterized by $$\begin{array}{l} [d_{F1}]_F = (1,0,0) \\[1em] [d_{F2}]_F = (0,1,0) \\[1em] [d_{F3}]_F = (0,0,1) \end{array}$$
To each frame $F$, we may embed the information of $\calL \cup \calD$ and $[\cdot]_F$ into $\bbR^4$ with a map $\langle \cdot \rangle_F: \calL \cup \calD \rightarrow \bbR^4$ as follows. $$\begin{array}{l} \displaystyle \langle p \rangle_F = \begin{pmatrix} [p]_F \\ 1 \end{pmatrix}, \quad p \in \calL\\[1em] \displaystyle \langle d \rangle_F = \begin{pmatrix} [d]_F \\ 0 \end{pmatrix}, \quad d \in \calD \end{array}$$ With this map, we now have the coordinate space $\langle \calL \cup \calD \rangle_F$ associated to a frame $F$.
Similar to our example with Sam and Eric, we may think of the frames $F, G \in \calF$ as physical objects under which transformations $F \rightarrow G$ correspond to changes in coordinate systems $T_{FG}: \langle \calL \cup \calD\rangle_G \rightarrow \langle \calL \cup \calD\rangle_F$. Transformations $F \rightarrow G$ are defined so that the following contravariant diagram commutes.
We will encode our coordinate transform $T_{FG} \in \bbR^{4\times 4}$ to satisfy the following. $$ \langle a \rangle_F = T_{FG}\langle a \rangle_G, \quad a \in \calL \cup \calD$$ Of course, this specifically translates to the following. $$\begin{pmatrix} [p]_F \\ 1 \end{pmatrix} = T_{FG} \begin{pmatrix} [p]_G \\ 1 \end{pmatrix}, \quad p \in \calL $$ $$\begin{pmatrix} [d]_F \\ 0 \end{pmatrix} = T_{FG} \begin{pmatrix} [d]_G \\ 0 \end{pmatrix}, \quad d \in \calL $$ This setup is useful, as we may define a frame $G$ in terms of the affine coordinate transform $T_{FG}$ that is induced from transporting $F \rightarrow G$. Consider the fundamental rigid body transforms $F \rightarrow G$ that we may define.
Translations of $F$ that preserve orientation but change origin $[o_G]_F = (x, y, z)$ have the following matrix structure. $$ T_{FG} = \begin{pmatrix} 1 & 0 & 0 & x \\ 0 & 1 & 0 & y \\ 0 & 0 & 0 & z \\ 0 & 0 & 0 & 1 \end{pmatrix} $$
If we would like to rotate a frame $F$ around an axis $d \in \calD$, we can construct a rotation matrix $R^F_d(\theta) \in \bbR^{3\times 3}$ as below, then use this to create the following relative frame block matrix. $$ T_{FG} = \begin{pmatrix} R^F_d(\theta) & 0 \\ 0 & 1 \end{pmatrix} $$
If we would like to scale a frame $F$ so that the cardinal directions (right, forward, up) scale by $(a, b, c)$, we would have the following relative frame matrix. $$ T_{FG} = \begin{pmatrix} a & 0 & 0 & 0 \\ 0 & b & 0 & 0 \\ 0 & 0 & c & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}$$
Let us finish this post with an example demonstrating the effectiveness of frames. We would like to understand the coordinates of a solar radiation vector of a person standing on earth at (latitude, longitude) coordinates $(\phi, \theta)$ at a given time $t$. This person's frame $F_p(t, \phi, \theta)$ should be such that standard basis vectors $d_{F_p(t, \phi, \theta)1}$, $d_{F_p(t, \phi, \theta)2}$, and $d_{F_p(t, \phi, \theta)3}$ point east, north, and toward the sky, respectively. The solar radiation vector $s(t, \phi, \theta)$ has complicated coordinates $[s(t, \phi, \theta)]_{F_p(t,\phi,\theta)}$ that would be difficult to calculate directly without the help of frames. However, if we create the frame $F_p(t, \phi, \theta)$ though simple successive frame transformations at a celestial perspective, all of this is quite easy.
We start by imposing a base frame $F_s$ which simply puts the sun at the origin and gives a fixed orientation for our solar system. From here, we transport $F_s \rightarrow F_y(t)$, where $F_y(t)$ is a frame responsible for creating the dynamics of the earth around the sun. Denote the relative frame matrix associated to the transport $F_s \rightarrow F_y(t)$ by $T_y(t)$. $$\begin{aligned} T_y(t) &= \begin{pmatrix} 1 & 0 & 0 & D\cos\omega_y(t) \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & -D\sin\omega_y(t) \\ 0 & 0 & 0 & 1 \end{pmatrix} \\ D &= 1.496 \times 10^8 \\ \omega_d(t) &= 2\pi t \\ \omega_y(t) &= \omega_d(t) / 364.24 \end{aligned}$$ Note that the configuration of $F_y(t)$ relative to $F_s$ is periodic on $364.24$; this imposes that a timestep of $t=1$ corresponds to one day in the year.
Now we introduce the tilt of the earth's axis by peforming a frame transform $F_y(t) \rightarrow F_a(t)$ with relative frame matrix $T_a$. $$\begin{aligned} T_a &= \begin{pmatrix} \cos\alpha & -\sin\alpha & 0 & 0 \\ \sin\alpha & \cos\alpha & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix} \\ \alpha &= 23.45 * \pi/180 \end{aligned}$$
Now that earth's north pole is encoded in $F_a(t)$, we may introduce the spin with a transform $F_a(t) \rightarrow F_d(t)$ with relative frame matrix $T_d(t)$. $$ T_d(t) = \begin{pmatrix} \cos\omega_d(t) & 0 & \sin\omega_d(t) & 0 \\ 0 & 1 & 0 & 0 \\ -\sin\omega_d(t) & 0 & \cos\omega_d(t) & 0 \\ 0 & 0 & 0 & 1 \end{pmatrix}$$
Now that the configuration of the earth in the solar system is declared, we need a frame transform $F_d(t) \rightarrow F_p(t, \phi, \theta)$ to our person's configuration, dependent on (latitude, longitude) coordinates $(\phi,\theta)$. Denote the relative frame matrix associated to $F_d(t) \rightarrow F_p(t, \phi, \theta)$ by $T_p(\phi, \theta)$. $$ \begin{aligned} T_p(\phi, \theta) &= \begin{pmatrix} -\sin\eta(\theta) & \cos\sigma(\phi) \cos\eta(\theta) & \sin\sigma(\phi) \cos\eta(\theta) & R\sin\sigma(\phi) \cos\eta(\theta) \\ 0 & -\sin\sigma(\phi) & \cos\sigma(\phi) & R\cos\sigma(\phi) \\ \cos\eta(\theta) & \cos\sigma(\phi) \sin\eta(\theta) & \sin\sigma(\phi) \sin\eta(\theta) & R \sin\sigma(\phi) \sin\eta(\theta) \\ 0 & 0 & 0 & 1 \end{pmatrix} \\ \sigma(\phi) &= \pi (\phi - 90) / 180 \\ \eta(\theta) &= \pi (180 - \theta) / 180 \\ R &= 6371 \end{aligned} $$
Now that the frames are established, we note that the solar radiation $s(t, \phi, \theta)$ is the displacement from the origin $o_{F_s}$ to the position of the person $o_{F_p(t, \phi, \theta)}$. $$ s(t, \phi, \theta) = o_{F_p(t,\phi,\theta)} - o_{F_s} $$ We now use our frame transform algebra to get our desired coordinates. $$\begin{aligned} &\big\langle s(t, \phi, \theta) \big\rangle_{F_p(t,\phi,\theta)} \\ &\quad=\big\langle o_{F_p(t, \phi, \theta)} \big\rangle_{F_p(t,\phi,\theta)} - \big\langle o_{F_s} \big\rangle_{F_p(t, \phi,\theta)} \\ &\quad= \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} - T_p(\phi, \theta)^{-1} \big\langle o_{F_s} \big\rangle_{F_d(t)} \\ &\quad= \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} - T_p(\phi, \theta)^{-1} \cdot T_d(t)^{-1} \big\langle o_{F_s} \big\rangle_{F_a(t)} \\ &\quad= \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} - T_p(\phi, \theta)^{-1} \cdot T_d(t)^{-1} \cdot T_a^{-1} \big\langle o_{F_s} \big\rangle_{F_y(t)} \\ &\quad= \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} - T_p(\phi, \theta)^{-1} \cdot T_d(t)^{-1} \cdot T_a^{-1} \cdot T_y(t)^{-1} \big\langle o_{F_s} \big\rangle_{F_s(t)} \\ &\quad= \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} - T_p(\phi, \theta)^{-1} \cdot T_d(t)^{-1} \cdot T_a^{-1} \cdot T_y(t)^{-1} \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} \\ &\quad= \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} - \Big( T_y(t) \cdot T_a \cdot T_d(t) \cdot T_p(\phi, \theta) \Big)^{-1} \cdot \begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} \end{aligned}$$ The matrix product above is tedious to calculate by hand, but we now have a closed form expression for the desired coordinates. $$ \big[s(t, \phi, \theta)\big]_{F_p(t, \phi, \theta)} = - \begin{pmatrix} 1 & 0 & 0 & 0\\ 0 & 1 & 0 &0 \\ 0 & 0 & 1 & 0 \end{pmatrix} \Big( T_y(t) \cdot T_a \cdot T_d(t) \cdot T_p(\phi, \theta) \Big)^{-1}\begin{pmatrix} 0 \\ 0 \\ 0 \\ 1 \end{pmatrix} $$