3.5.8Guidance, Navigation & Control (GNC)

Quaternion rotation formula — rotating vector v by quaternion q

1,815 words8 min readdifficulty · medium2 backlinks

80/20 core: To rotate a 3D vector vv by a unit quaternion qq, embed vv as a pure quaternion and compute v=qvq1v' = q\,v\,q^{-1}. That's the whole game. Everything else is understanding why the sandwich works and why it uses the half-angle.


The Setup — WHAT are we even doing?


The Quaternion Product — the one rule we need


The Rotation Formula — DERIVED, not dumped

Step 1: Why the conjugate on the right (the "sandwich")?

We want the output v=(0,v)v'=(0,\mathbf v') to still be a pure quaternion — otherwise it wouldn't be a 3D vector. Take the conjugate of the product: (qvq1)=(q1)vq.(qvq^{-1})^* = (q^{-1})^* v^* q^* . For unit qq: (q1)=q(q^{-1})^*=q and q=q1q^*=q^{-1}. Also v=vv^*=-v because vv is pure. So (qvq1)=q(v)q1=(qvq1)(qvq^{-1})^* = q(-v)q^{-1} = -(qvq^{-1}). An object equal to -(its own conjugate) has zero scalar part ⇒ output is pure. ✓

Why this step? This proves the sandwich is closed on vectors. A one-sided product qvqv would generally give a nonzero scalar — not a vector.

Step 2: Why the half-angle? Let q=(cosθ2, sinθ2n^)q=(\cos\tfrac\theta2,\ \sin\tfrac\theta2\,\hat n)

Take q=cosθ2+sinθ2n^q = \cos\tfrac\theta2 + \sin\tfrac\theta2\,\hat n with unit axis n^\hat n. Split v=v+v\mathbf v = \mathbf v_\parallel + \mathbf v_\perp (parallel/perpendicular to n^\hat n).

Parallel part (n^×v=0\hat n \times \mathbf v_\parallel = 0, n^v=v\hat n\cdot\mathbf v_\parallel=|\mathbf v_\parallel|): Working the algebra, qvq1=vq\,\mathbf v_\parallel\,q^{-1} = \mathbf v_\parallel — the component along the axis is unchanged (as a rotation about n^\hat n should leave it). ✓

Perpendicular part: using n^v=0\hat n\cdot\mathbf v_\perp=0 and letting c=cosθ2, s=sinθ2c=\cos\tfrac\theta2,\ s=\sin\tfrac\theta2, qvq1=(c2s2)v+2cs(n^×v).q\,\mathbf v_\perp\,q^{-1}=(c^2-s^2)\mathbf v_\perp + 2cs\,(\hat n\times\mathbf v_\perp). Now the double-angle identities: c2s2=cosθc^2-s^2=\cos\theta and 2cs=sinθ2cs=\sin\theta. So qvq1=cosθv+sinθ(n^×v).q\,\mathbf v_\perp\,q^{-1}= \cos\theta\,\mathbf v_\perp + \sin\theta\,(\hat n\times \mathbf v_\perp). That is exactly Rodrigues' rotation of v\mathbf v_\perp by angle θ\theta about n^\hat n. ✓

Why the half-angle? Because qq appears twice (once as qq, once as q1q^{-1}), each contributing θ/2\theta/2. The two half-angles combine via double-angle formulas into a full θ\theta. This is the #1 thing to remember.

Figure — Quaternion rotation formula — rotating vector v by quaternion q

Step 3: Collapse to Rodrigues (sanity check)

Combining parallel + perpendicular gives the full Rodrigues formula: v=vcosθ+(n^×v)sinθ+n^(n^ ⁣ ⁣v)(1cosθ).\mathbf v' = \mathbf v\cos\theta + (\hat n\times\mathbf v)\sin\theta + \hat n(\hat n\!\cdot\!\mathbf v)(1-\cos\theta). So qvq1qvq^{-1} is Rodrigues in disguise — the same rotation, cheaper storage.


Worked Examples


Common Mistakes (Steel-manned)


Flashcards

How do you rotate a vector v by unit quaternion q?
Embed v as a pure quaternion (0,v), compute v=qvq1v' = qvq^{-1}.
For a unit quaternion, what is q1q^{-1}?
The conjugate q=(w,v)q^*=(w,-\mathbf v) (flip sign of the vector part).
Why does qvq1qvq^{-1} use the half-angle in q?
q multiplies twice (as q and q1q^{-1}); each supplies θ/2\theta/2, combining via double-angle identities into θ\theta.
Why must the conjugate be on the right (sandwich)?
To keep the output a pure quaternion (zero scalar part) so it's a valid 3D vector.
What is the quaternion for rotation angle θ\theta about unit axis n^\hat n?
q=(cosθ2, sinθ2n^)q=(\cos\tfrac\theta2,\ \sin\tfrac\theta2\,\hat n).
Composition: rotate by q1q_1 then q2q_2 — what single quaternion?
q2q1q_2 q_1 (rightmost applied first), and it's non-commutative.
Do qq and q-q represent the same rotation?
Yes — double cover; signs cancel in qvq1qvq^{-1}.
What does qvq1qvq^{-1} reduce to for a real 3-vector?
Rodrigues' formula: vcosθ+(n^×v)sinθ+n^(n^v)(1cosθ)\mathbf v\cos\theta+(\hat n\times\mathbf v)\sin\theta+\hat n(\hat n\cdot\mathbf v)(1-\cos\theta).
In the Hamilton product, where do dot and cross products come from?
Dot from same-axis terms (i2=1i^2=-1); cross from cross-axis terms (ij=kij=k).

Recall Feynman: explain to a 12-year-old

Imagine a spinning globe. To spin a dot on the globe, you need a "spin instruction." A quaternion is a compact spin instruction: it stores an axis to spin around and how much to spin. The trick is you "wrap" your dot in the instruction, spin, then "unwrap" — that's the qq1q \dots q^{-1} sandwich. And because you use the instruction twice (wrap and unwrap), you only store half the turn amount inside it. Do that, and the dot lands exactly where a full turn about that axis puts it.


Connections

Concept Map

constraint norm 1

represents

embedded as

multiplied via

dot from same axis, cross from different

inverse equals conjugate

defines

used in

proven closed

parametrized by

gives rotation by theta

Quaternion w plus xyz

Unit quaternion norm 1

Pure quaternion zero scalar

3D vector v

Hamilton product

Conjugate flip vector part

Inverse q star

Sandwich v prime equals q v q inv

Output stays pure vector

Half-angle cos and sin theta/2

GNC attitude control

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, quaternion se vector rotate karna basically ek "sandwich" trick hai. Tumhare paas ek vector vv hai jise ek axis ke around θ\theta angle se ghumana hai. Pehle vector ko ek pure quaternion bana do — matlab scalar part zero, vector part vv: (0,v)(0,\mathbf v). Phir formula seedha hai: v=qvq1v' = q\,v\,q^{-1}. Yahan qq left mein, aur uska inverse (unit quaternion ke liye inverse = conjugate, sirf vector part ka sign flip) right mein. Yeh sandwich zaroori hai warna output pure quaternion nahi rahega, aur tumhe ek proper 3D vector nahi milega.

Sabse important baat: quaternion ke andar half angle hota hai, q=(cosθ2, sinθ2n^)q=(\cos\tfrac\theta2,\ \sin\tfrac\theta2\,\hat n). Kyun? Kyunki qq formula mein do baar aata hai — ek baar qq, ek baar q1q^{-1}. Har ek θ/2\theta/2 deta hai, aur double-angle identity se cos2sin2=cosθ\cos^2-\sin^2=\cos\theta, 2sincos=sinθ2\sin\cos=\sin\theta ban ke full θ\theta ho jata hai. Isliye agar tum 9090^\circ ghumana chahte ho to andar 4545^\circ dalna hoga. Yeh galti students bahut karte hain, so yaad rakho.

GNC (satellite, drone attitude control) mein quaternion isliye favourite hai kyunki rotation matrix ke 9 numbers ke bajaye sirf 4 numbers chahiye, gimbal lock ka problem nahi, aur interpolation (SLERP) smooth hota hai. Aur ek cool baat: qq aur q-q dono same rotation dete hain (double cover), kyunki signs sandwich mein cancel ho jate hain. Bas yaad rakho — "sandwich the vector, halve the angle" — aur tumhara concept clear hai.

Go deeper — visual, from zero

Test yourself — Guidance, Navigation & Control (GNC)

Connections