Transformation between frames — direction cosine matrices
WHAT is a Direction Cosine Matrix?
The name is literal: each entry is a direction cosine — the cosine of the direction angle between axis and axis .
WHY does this matrix have exactly these entries? (Derivation from scratch)
A vector is a frame-independent object. Write it in both frames:
We want , the component of along . Project by dotting with :
Why this step? Because and for (orthonormality), so dotting with extracts exactly the -th -component. The only unknowns left are the numbers — and those are precisely .
So the matrix entries are forced on us by projection — nothing arbitrary. ∎
Key properties (and WHY each holds)
Why? Row and row of are and expressed in . Their dot product is . That's exactly the statement . Because the inverse just runs the transformation backwards (from back to ), , and orthogonality makes that inverse simply the transpose — no division, no computation.
Why ? Both frames are right-handed; a right-handed→right-handed map preserves orientation, so the determinant is (a would flip handedness, i.e. a reflection). Why composition multiplies? To go you may first go then : . Read superscripts inner-cancel style: gives .
Elementary (single-axis) rotations — the building blocks
Rotate frame by angle about axis 3 (). Then makes angle with , etc. Plug into :
\mathbf C_1(\theta)=\begin{pmatrix}1&0&0\\ 0&\cos\theta & \sin\theta\\ 0&-\sin\theta&\cos\theta\end{pmatrix}$$ > [!intuition] Sign convention > These are the "**components transform**" (passive) matrices: the *axes* rotate by $+\theta$, so the *numbers* of a fixed vector rotate by $-\theta$ — that's why the minus sign sits below the diagonal here. Rotating the vector instead (active) transposes it. A full aerospace attitude (yaw $\psi$, pitch $\theta$, roll $\phi$, 3-2-1 sequence) is: $$\mathbf C^{BA}=\mathbf C_1(\phi)\,\mathbf C_2(\theta)\,\mathbf C_3(\psi)$$ --- ## Worked Example 1 — single yaw rotation Frame $B$ is the ground frame yawed by $\psi=30°$ about $z$. A wind velocity is $\mathbf v^A=(10,0,0)$ m/s (pointing along ground-$x$). Find $\mathbf v^B$. $$\mathbf v^B=\mathbf C_3(30°)\begin{pmatrix}10\\0\\0\end{pmatrix}=\begin{pmatrix}\cos30°\cdot10\\ -\sin30°\cdot10\\0\end{pmatrix}=\begin{pmatrix}8.66\\ -5.0\\0\end{pmatrix}\text{ m/s}$$ *Why the $-5$?* Because we rotated the *axes* $+30°$ toward the vector; relative to the new $B$-axes the vector now leans **negative** in $\hat b_2$. Magnitude check: $\sqrt{8.66^2+5^2}=10$ ✓ — length is preserved (that's the orthogonality property doing its job). --- ## Worked Example 2 — chaining frames A rocket thrust is $\mathbf F^{body}=(5000,0,0)$ N along the body-$x$. Attitude is yaw $\psi=90°$ then pitch $\theta=30°$ (so $\mathbf C^{BI}=\mathbf C_2(\theta)\mathbf C_3(\psi)$). Find thrust in the inertial frame. We need $\mathbf F^I=\mathbf C^{IB}\mathbf F^{body}=(\mathbf C^{BI})^\top\mathbf F^{body}$. $$\mathbf C^{BI}=\mathbf C_2(30°)\mathbf C_3(90°)$$ $$\mathbf C_3(90°)=\begin{pmatrix}0&1&0\\-1&0&0\\0&0&1\end{pmatrix},\quad \mathbf C_2(30°)=\begin{pmatrix}0.866&0&-0.5\\0&1&0\\0.5&0&0.866\end{pmatrix}$$ $$\mathbf C^{BI}=\begin{pmatrix}0&0.866&-0.5\\-1&0&0\\0&0.5&0.866\end{pmatrix}$$ *Why transpose to get inertial?* Because $\mathbf C^{BI}$ maps inertial→body; we have a body vector and want inertial, so we invert = transpose. $$\mathbf F^I=(\mathbf C^{BI})^\top\!\begin{pmatrix}5000\\0\\0\end{pmatrix} =\begin{pmatrix}0&-1&0\\0.866&0&0.5\\-0.5&0&0.866\end{pmatrix}\!\begin{pmatrix}5000\\0\\0\end{pmatrix} =\begin{pmatrix}0\\4330\\-2500\end{pmatrix}\text{ N}$$ Magnitude $=\sqrt{4330^2+2500^2}=5000$ N ✓. --- ## Common mistakes > [!mistake] Confusing $\mathbf C^{BA}$ with $\mathbf C^{AB}$ > **Why it feels right:** you wrote a rotation matrix, so surely it's "the" rotation. **The trap:** direction matters. If your data is in $A$ and you accidentally apply $\mathbf C^{AB}$, you rotate the *wrong way*. **Fix:** read superscripts as *output←input*. $\mathbf C^{BA}$ eats an $A$-vector and outputs a $B$-vector — the inner index must match your data's frame. If not, transpose. > [!mistake] Multiplying rotation matrices in the wrong order > **Why it feels right:** matrix multiply looks symmetric on paper. **The trap:** rotations do **not** commute; $\mathbf C_2\mathbf C_3\neq\mathbf C_3\mathbf C_2$. **Fix:** apply the sequence in the order the axes are actually rotated, with the *first* rotation on the *right* (it hits the vector first): $\mathbf C_1(\phi)\mathbf C_2(\theta)\mathbf C_3(\psi)$ for 3-2-1. > [!mistake] Forgetting the minus sign lives on the opposite off-diagonal for $\mathbf C_2$ > **Why it feels right:** $\mathbf C_1,\mathbf C_3$ have $-\sin$ in the "lower" slot, so you assume $\mathbf C_2$ does too. **The trap:** because axis 2 rotation involves the $3\to1$ cyclic order, $\mathbf C_2$'s $-\sin$ sits in the **upper** off-diagonal. **Fix:** derive from $C_{ij}=\hat b_i\cdot\hat a_j$ rather than memorizing the pattern. --- ## Active recall > [!recall]- Try before revealing > - What single dot product gives entry $C^{BA}_{ij}$? > - Why is $\mathbf C^{-1}=\mathbf C^\top$? > - Why $\det\mathbf C=+1$ and never $-1$? > - For a 3-2-1 sequence, which matrix multiplies the vector first? > > Answers: $\hat b_i\cdot\hat a_j$ · rows are orthonormal so $\mathbf C\mathbf C^\top=\mathbf I$ · right→right preserves orientation · $\mathbf C_3(\psi)$ (rightmost). > [!recall]- Feynman: explain to a 12-year-old > Imagine you and a friend describe where a toy car is. You use "left/right/forward" facing north; your friend faces east, so *your* "forward" is *their* "right." The car hasn't moved — only your labels differ. The DCM is a little **translation table** of how twisted your friend's directions are compared to yours (that's the cosine of the twist angle). Multiply your numbers by this table and out come *their* numbers. Twist back? Just flip the table over (transpose). Because nothing stretched, the car's distance from you stays the same in both descriptions. > [!mnemonic] > **"C-B-A: output on top, input below; inner indices kiss, outer indices survive."** > $\mathbf C^{CB}\mathbf C^{BA}=\mathbf C^{CA}$ — the two $B$'s meet in the middle and vanish, just like frames chaining. And **"Inverse = flip the matrix over" (transpose)**. --- ## Flashcards #flashcards/physics What is the entry $C^{BA}_{ij}$ of a direction cosine matrix? ::: The cosine of the angle between axes $\hat b_i$ and $\hat a_j$, i.e. $\hat b_i\cdot\hat a_j$. How do you invert a DCM cheaply? ::: Take its transpose, since $\mathbf C^{-1}=\mathbf C^\top$ (orthogonal matrix). Why is a DCM orthogonal? ::: Its rows are the target-frame basis vectors, which are mutually orthonormal, so $\mathbf C\mathbf C^\top=\mathbf I$. What is $\det(\mathbf C^{BA})$ for two right-handed frames and why? ::: $+1$; a right-handed→right-handed map preserves orientation (no reflection). How do DCMs compose from $A$ to $C$ via $B$? ::: $\mathbf C^{CA}=\mathbf C^{CB}\,\mathbf C^{BA}$ (inner $B$ indices cancel). For a 3-2-1 (yaw-pitch-roll) attitude, write $\mathbf C^{BA}$. ::: $\mathbf C_1(\phi)\,\mathbf C_2(\theta)\,\mathbf C_3(\psi)$. Why does rotating axes by $+\theta$ put the minus sign below the diagonal in $\mathbf C_3$? ::: Components transform passively (opposite to axis rotation), so the vector's numbers rotate by $-\theta$. If your vector is in frame $A$ but you want it in $B$, which matrix applies? ::: $\mathbf C^{BA}$ — the inner (right) superscript must match the vector's current frame. Does matrix order matter when combining rotations? ::: Yes; rotations don't commute. First-applied rotation goes rightmost. What quantity is always preserved under a DCM transformation? ::: The vector's magnitude (length), because the map is orthogonal. --- ## Connections - [[Reference frames in rocketry — inertial, body, wind]] - [[Euler angles — yaw pitch roll]] - [[Quaternions and attitude representation]] - [[Angular velocity and the kinematic equations]] - [[Thrust vectoring and force resolution]] - [[Orthogonal matrices and rotation groups SO(3)]] ## 🖼️ Concept Map ```mermaid flowchart TD V[Physical vector arrow] -->|same arrow different components| F[Depends on frame axes] FR[Multiple frames: inertial, body, wind] --> F F -->|re-expressed by| DCM[Direction Cosine Matrix C_BA] DCM -->|entries are| DC[Direction cosines b_i dot a_j] DCM -->|maps components| MAP[v_B equals C_BA times v_A] PROJ[Projection onto b_i] -->|forces entries via| DC ORTH[Orthonormality of axes] -->|extracts i-th component| PROJ ORTH -->|gives| ORTHO[Orthogonality C C_T equals I] ORTHO -->|inverse equals transpose| INV[C_AB equals C_BA transpose] RH[Right-handed frames] -->|orientation preserved| DET[det equals plus 1 proper rotation] DCM -->|chain rotations| COMP[C_CA equals C_CB times C_BA] ``` ## 🔊 Hinglish (regional understanding) > [!intuition]- Hinglish mein samjho > Dekho, ek rocket ke paas ek hi physical arrow hota hai — jaise thrust ya velocity. Lekin uske *numbers* (components) depend karte hain ki aap kis frame ke axes se naap rahe ho: ground frame, body frame, ya wind frame. Direction Cosine Matrix (DCM) ek chhota "translation table" hai jo same arrow ko naye axes mein re-express kar deta hai — arrow badalta nahi, sirf uske labels/numbers badalte hain. > > Har entry $C^{BA}_{ij}=\hat b_i\cdot\hat a_j$ hai, matlab do axes ke beech ke angle ka cosine. Ye kahin se aasman se nahi aata — hum bas vector ko $\hat b_i$ pe **project** karte hain (dot product lete hain), aur orthonormality ki wajah se sirf $i$-th component nikal aata hai. Isi projection se poori matrix automatically ban jaati hai. Yaad rakho: rows = naye axes purane coordinates mein. > > Do bade properties: inverse = transpose ($\mathbf C^{-1}=\mathbf C^\top$), kyunki rows orthonormal hain — bina calculation ke ulta transformation mil jaata hai. Aur $\det=+1$, kyunki dono frames right-handed hain, koi mirror-flip nahi. Composition mein superscripts inner-cancel karte hain: $\mathbf C^{CB}\mathbf C^{BA}=\mathbf C^{CA}$. > > Sabse common galti: $\mathbf C^{BA}$ aur $\mathbf C^{AB}$ mein confuse ho jaana, aur rotation matrices ko galat order mein multiply karna (rotations commute nahi karte!). Rule simple hai — jo data ka frame hai wahi inner superscript se match hona chahiye, aur 3-2-1 sequence mein $\mathbf C_3(\psi)$ sabse right (pehle apply). Exam aur actual flight software dono mein yahi cheez baar-baar aati hai, isliye derivation se samjho, rat mat lo. ![[audio/3.4.02-Transformation-between-frames-—-direction-cosine-matrices.mp3]]