3.5.6Guidance, Navigation & Control (GNC)

Quaternions — definition q = (q₀, q₁, q₂, q₃), unit quaternion constraint

1,942 words9 min readdifficulty · medium1 backlinks

WHAT is a quaternion?

We often write it compactly as q=(q0, qv)q = (q_0,\ \vec{q}_v).


Deriving Hamilton's multiplication rule from scratch

We only assume the units satisfy ijk=1ijk=-1 and each squares to 1-1. Everything else follows.

Why this step? From ijk=1ijk=-1, right-multiply by kk: ijkk=k    ij(k2)=k    ij(1)=k    ij=k.ijk\cdot k = -k \;\Rightarrow\; ij(k^2) = -k \;\Rightarrow\; ij(-1) = -k \;\Rightarrow\; ij = k.

Why this step? Left-multiply ij=kij=k by ii: i(ij)=ik    (i2)j=ik    j=ik    ki=j (after cycling).i(ij) = ik \;\Rightarrow\; (i^2)j = ik \;\Rightarrow\; -j = ik \;\Rightarrow\; ki = j \text{ (after cycling)}.

The full multiplication of two quaternions then follows by expanding term-by-term:

The p×q\vec{p}\times\vec{q} term is why quaternion multiplication (like rotation composition) is non-commutative.


The unit-quaternion constraint

WHY the half-angle θ/2\theta/2? Because rotating a vector uses the sandwich v=qvq1v' = q\otimes v\otimes q^{-1}, which applies qq effectively twice, so each factor must carry only half the angle. (This also means qq and q-q give the same rotation — the "double cover".)


Conjugate, inverse, and why they matter


Worked Examples


Common Mistakes (Steel-manned)


Active Recall

Recall Cover me: how many free parameters does a unit quaternion have?

4 numbers − 1 constraint = 3, matching the 3 rotational DOF.

Recall Cover me: write the unit constraint and the identity quaternion.

q02+q12+q22+q32=1q_0^2+q_1^2+q_2^2+q_3^2=1; identity =(1,0,0,0)=(1,0,0,0).

Recall Feynman: explain quaternions to a 12-year-old.

Imagine spinning a toy. To describe the spin you need to say: which way is the spinning stick pointing (that's an arrow, 3 numbers) and how far you twisted it (1 number). A quaternion is a neat little box of 4 numbers that holds both. There's a rule: if you square all four numbers and add them, you must get exactly 1 — like saying "this arrow is exactly one meter long." If the box gets a little wrong from adding-up mistakes, you just shrink or stretch it back so the total is 1 again. Then it always describes a real spin, and it never "jams" the way older methods do.


Flashcards

What are the four components of a quaternion?
Scalar part q0q_0 and vector part (q1,q2,q3)(q_1,q_2,q_3): q=q0+q1i+q2j+q3kq=q_0+q_1i+q_2j+q_3k.
State the unit-quaternion constraint.
q02+q12+q22+q32=1q_0^2+q_1^2+q_2^2+q_3^2 = 1.
Why 4 numbers for a 3-DOF rotation?
4 params − 1 unit constraint = 3 DOF; extra number removes gimbal-lock singularity.
How is a rotation of angle θ about unit axis n̂ encoded?
q=(cosθ2, n^sinθ2)q=(\cos\tfrac\theta2,\ \hat n\sin\tfrac\theta2).
Why the half-angle θ/2?
Rotating a vector uses the double product qvq1qvq^{-1}, applying qq twice, so each factor carries half the angle.
Do q and −q represent the same rotation?
Yes — signs cancel in qvq1qvq^{-1}; it's a double cover of SO(3).
Give the quaternion conjugate.
q=(q0,q1,q2,q3)q^*=(q_0,-q_1,-q_2,-q_3).
Inverse of a unit quaternion?
q1=qq^{-1}=q^* (since q=1\lVert q\rVert=1).
Hamilton's fundamental relation?
i2=j2=k2=ijk=1i^2=j^2=k^2=ijk=-1.
Scalar part of pqp\otimes q?
p0q0pqp_0q_0-\vec p\cdot\vec q.
Vector part of pqp\otimes q?
p0q+q0p+p×qp_0\vec q + q_0\vec p + \vec p\times\vec q.
Is quaternion multiplication commutative?
No — the p×q\vec p\times\vec q term makes it non-commutative.
Geometrically, where do unit quaternions live?
On the unit 3-sphere S3S^3 in 4D space.
How do you fix drift after integration?
Renormalize: qq/qq\leftarrow q/\lVert q\rVert.
Identity quaternion?
(1,0,0,0)(1,0,0,0) — the "do nothing" rotation.

Connections

  • Euler Angles and Gimbal Lock — the problem quaternions solve.
  • Rotation Matrices SO(3) — 9 numbers, 6 constraints alternative.
  • Quaternion Kinematics — dq/dt — how qq evolves with angular velocity ω\vec\omega.
  • Axis-Angle Representation — direct source of the half-angle form.
  • Spacecraft Attitude Determination — where GNC uses all of this.
  • Complex Numbers as 2D Rotations — quaternions are the 3D analogue of eiθe^{i\theta}.

Concept Map

encoded wastefully by

encoded by

suffers

solves 4 nums 1 constraint

derives

contains cross product

defines

set to 1 gives

leads to

required to represent

3D rotation
3 DOF

Rotation matrix
9 nums 6 constraints

Euler angles
3 nums

Quaternion q0 q1 q2 q3

Hamilton rules
ijk = -1

Quaternion product

Non-commutative

Norm

Unit constraint
sum of squares = 1

Axis-angle form
cos and n sin

Gimbal lock

Hinglish (regional understanding)

Intuition Hinglish mein samjho

Dekho, ek object ko 3D mein rotate karne ke liye sirf 3 cheezein chahiye — kis axis pe ghumana hai aur kitna. Purane tareeke jaise Euler angles theek hain par unmein "gimbal lock" ho jata hai — do axis ek line mein aa jaate hain aur ek degree of freedom gum ho jaati hai. Rotation matrix 9 numbers use karta hai, bahut heavy. Quaternion in dono ke beech ka smart solution hai: sirf 4 numbers q=(q0,q1,q2,q3)q=(q_0,q_1,q_2,q_3), jisme ek scalar part q0q_0 aur ek vector part (q1,q2,q3)(q_1,q_2,q_3) hota hai.

Sabse important cheez hai unit constraint: q02+q12+q22+q32=1q_0^2+q_1^2+q_2^2+q_3^2 = 1. Jab bhi ye condition satisfy hoti hai, quaternion ek valid rotation hai. Formula yaad rakho: agar axis n^\hat n hai aur angle θ\theta hai, to q=(cosθ2, n^sinθ2)q=(\cos\tfrac\theta2,\ \hat n\sin\tfrac\theta2). Yahan half-angle (θ/2\theta/2) aata hai — ye galti sabse zyada log karte hain! Reason: vector ko rotate karne ke liye hum qvq1q v q^{-1} ka sandwich use karte hain, yani qq do baar lag jaata hai, isliye har baar aadha angle.

GNC (satellite ka attitude control) mein ye cheez gold hai. Compute onboard kam hota hai, aur unit quaternion ka inverse nikalna matlab sirf 3 signs badalna (q1=qq^{-1}=q^*) — bahut sasta. Ek aur practical baat: jab computer time-step pe integration karta hai, chhoti chhoti rounding errors se qq ki norm 1 se hat jaati hai. Solution simple hai — har step pe qq ko uski norm se divide kar do (renormalize), phir wo wapas unit sphere pe aa jaata hai.

Short mein: 4 numbers, 1 constraint, no gimbal lock, half-angle formula, aur regular renormalization. Yehi quaternions ki poori kahani hai jo har spacecraft aur drone ke andar chal rahi hai.

Go deeper — visual, from zero

Test yourself — Guidance, Navigation & Control (GNC)

Connections