Intuition What this page is
The parent note built the rule . Here we drill it. Every quaternion product you will ever meet in GNC (Guidance, Navigation & Control — the on-board maths that keeps a spacecraft or drone pointed the right way) falls into one of a handful of case classes — parallel axes, perpendicular axes, identity, pure vectors, non-commuting pairs, the sandwich rotation, and the limiting "tiny angle" case that gyro integrators live in. We work one fully-solved example per class so that when your filter throws you a case at 3 a.m., you have already seen its shape.
Notation reminder (nothing new assumed): a quaternion is q = ( w , v ) where w is one plain number (the scalar part ) and v = ( x , y , z ) is an arrow in 3D (the vector part ). Two ways of writing the same quaternion appear below — always in the same component order:
paired form q = ( w , ( x , y , z )) — scalar first, then the arrow's three components in brackets;
flat form q = ( w , x , y , z ) — the identical four numbers with the inner brackets dropped.
These are the same object ; ( w , x , y , z ) just means ( w , ( x , y , z )) . Scalar is always the first slot, and the vector components are always in x , y , z order. The hat on a letter, as in n ^ , means "this arrow has length exactly 1 " — a pure direction with no size; the coordinate directions x ^ = ( 1 , 0 , 0 ) , y ^ = ( 0 , 1 , 0 ) , z ^ = ( 0 , 0 , 1 ) are the standard unit arrows along the axes. The product rule, which we USE constantly below, is
pq = ( scalar w 1 w 2 − v 1 ⋅ v 2 , vector w 1 v 2 + w 2 v 1 + v 1 × v 2 )
Every Hamilton-product situation is one row of this table. The examples below hit each cell. (q ˉ = the conjugate ( w , − v ) defined in the box just below.)
#
Case class
What makes it special
Example
A
Identity element
one factor is 1 = ( 1 , 0 )
Ex 1
B
Pure imaginary × pure imaginary, perpendicular
both scalars 0 , axes ⊥ → dot = 0
Ex 2
C
Pure imaginary, parallel/equal axes
both scalars 0 , axes parallel → cross = 0
Ex 3
D
Order swap (non-commutativity)
compute pq and q p , compare
Ex 4
E
Two real rotations, general axes
full formula, all three terms nonzero
Ex 5
F
Sandwich (rotate a vector) q u q ˉ
conjugate q ˉ from the box below; two products, length preserved
Ex 6
G
Sign / negative-scalar (half-angle > 18 0 ∘ )
cos 2 θ < 0 ; double-cover q ≡ − q
Ex 7
H
Limiting case: infinitesimal rotation
θ → 0 , links to gyro integration
Ex 8
I
Exam twist: solve for the unknown factor
given q p = r , find p via inverse
Ex 9
Two building blocks we reuse:
Worked example Ex 1 — multiply by
1 (on both sides)
Compute q ⋅ 1 and 1 ⋅ q where q = ( w , v ) is arbitrary and 1 = ( 1 , ( 0 , 0 , 0 )) .
Forecast: guess — should multiplying by "the number one" change anything, and does the side matter?
q ⋅ 1 scalar part = w ⋅ 1 − v ⋅ 0 = w .
Why this step? Dotting any arrow with the zero arrow gives 0 , so no scalar leaks in.
q ⋅ 1 vector part = w 0 + 1 v + v × 0 = v .
Why this step? Cross with the zero arrow is zero; the only survivor is 1 ⋅ v . So q ⋅ 1 = ( w , v ) = q .
1 ⋅ q scalar part = 1 ⋅ w − 0 ⋅ v = w .
Why this step? Now 1 is the first factor; its vector part is 0 , so the dot term is still 0 . Order of the dot doesn't matter (dot is symmetric).
1 ⋅ q vector part = 1 v + w 0 + 0 × v = v .
Why this step? The cross term is 0 × v = 0 — this is the only term that could break symmetry, and it vanishes. So 1 ⋅ q = ( w , v ) = q as well.
Verify: q ⋅ 1 = 1 ⋅ q = q . The identity 1 is the one factor that commutes with everything — not because non-commutativity switched off, but because its cross term is always zero. Every other pair keeps the order-dependence we exploit in Ex 4.
i j from the formula
p = i = ( 0 , ( 1 , 0 , 0 )) , q = j = ( 0 , ( 0 , 1 , 0 )) .
Forecast: the parent claims ij = k . Which term of the formula produces it — dot or cross?
Scalar = 0 ⋅ 0 − ( 1 , 0 , 0 ) ⋅ ( 0 , 1 , 0 ) = 0 − 0 = 0 .
Why this step? The two axes are at 9 0 ∘ ; perpendicular arrows have zero dot product, so no scalar appears.
Vector = 0 ⋅ ( 0 , 1 , 0 ) + 0 ⋅ ( 1 , 0 , 0 ) + ( 1 , 0 , 0 ) × ( 0 , 1 , 0 ) .
Why this step? Both scalars are 0 , so the two weighting terms vanish; only the cross survives.
( 1 , 0 , 0 ) × ( 0 , 1 , 0 ) = ( 0 , 0 , 1 ) by the right-hand rule (x ^ × y ^ = z ^ ).
Result = ( 0 , ( 0 , 0 , 1 )) = k . ✅
Figure — what you are looking at: the black arrow along x is i , the black arrow along y is j . Where they meet is a small right-angle mark labelled "9 0 ∘ (dot = 0 )". The red arrow is the result k = i × j , pointing out of the x –y plane by the right-hand rule. Red = the answer we built.
Verify: matches the multiplication table ij = k . Length: ∣ k ∣ = 1 , and ∣ i ∣∣ j ∣ = 1 , so length is preserved — a healthy sign.
i ⋅ i (same axis)
p = q = i = ( 0 , ( 1 , 0 , 0 )) .
Forecast: two identical pure vectors — what does a vector crossed with itself give?
Scalar = 0 − ( 1 , 0 , 0 ) ⋅ ( 1 , 0 , 0 ) = − 1 .
Why this step? Dot of an arrow with itself is its length-squared = 1 ; the formula subtracts it, giving − 1 . This is where i 2 = − 1 is born from geometry.
Vector = 0 + 0 + ( 1 , 0 , 0 ) × ( 1 , 0 , 0 ) = ( 0 , 0 , 0 ) .
Why this step? Any vector crossed with itself is zero (the parallelogram they span has zero area). So no vector part.
Result = ( − 1 , 0 ) = − 1 . ✅ (i 2 = − 1 .)
Verify: this reproduces Hamilton's rule i 2 = − 1 purely from "dot of self = 1 , cross of self = 0 ." The same works for j 2 and k 2 . Parallel axes → cross term dies, dot term dominates .
Worked example Ex 4 — compare
ij and j i
Compute both products and subtract.
Forecast: will ij equal j i ? If not, where does the difference come from?
ij = ( 0 , ( 0 , 0 , 1 )) = k (from Ex 2).
j i : scalar = 0 − ( 0 , 1 , 0 ) ⋅ ( 1 , 0 , 0 ) = 0 (still perpendicular).
Why this step? Dot is symmetric , so it is unchanged by swapping order — the scalar part can never cause disagreement.
Vector of j i = ( 0 , 1 , 0 ) × ( 1 , 0 , 0 ) = ( 0 , 0 , − 1 ) .
Why this step? Cross product is anti-symmetric : b × a = − ( a × b ) . Swapping flips the sign.
j i = ( 0 , ( 0 , 0 , − 1 )) = − k .
ij − j i = k − ( − k ) = 2 k = 0 . Non-commutative. ✅
Figure — what you are looking at: black arrows a (along x ) and b (along y ) are the two factors. The red arrow pointing up is ij = + k ; the red arrow pointing down is j i = − k . Same two black inputs, opposite red outputs — the red arrow literally reverses when you swap the order. Red = the (order-dependent) answer.
Verify: ij = − j i , exactly matching the parent. The cross term is the sole culprit — the dot term was identical both ways. This is not algebraic pedantry: it says "yaw-then-roll ≠ roll-then-yaw," a physical fact about 3D orientation.
9 0 ∘ about z , then 9 0 ∘ about x
Unit quaternion for angle θ about unit axis n ^ (the hat means ∣ n ^ ∣ = 1 ): q = ( cos 2 θ , sin 2 θ n ^ ) .
q z = ( 2 1 , 0 , 0 , 2 1 ) , q x = ( 2 1 , 2 1 , 0 , 0 ) (flat form: scalar, then x , y , z ). Compute q x q z ("z first, then x ").
Forecast: all three formula terms are nonzero here — expect a genuinely "mixed" quaternion.
Scalar = 2 1 ⋅ 2 1 − ( 2 1 , 0 , 0 ) ⋅ ( 0 , 0 , 2 1 ) = 2 1 − 0 = 2 1 .
Why this step? The two axes x ^ and z ^ are perpendicular → their dot is 0 , so only the w 1 w 2 half-angle product remains.
Vector = w 1 v 2 2 1 ( 0 , 0 , 2 1 ) + w 2 v 1 2 1 ( 2 1 , 0 , 0 ) + v 1 × v 2 ( 2 1 , 0 , 0 ) × ( 0 , 0 , 2 1 ) .
Why this step? Both scalars are nonzero now, so the two weighting terms survive alongside the cross.
= ( 0 , 0 , 2 1 ) + ( 2 1 , 0 , 0 ) + ( 0 , − 2 1 , 0 ) — note x ^ × z ^ = − y ^ .
Sum = ( 2 1 , − 2 1 , 2 1 ) . So q x q z = ( 2 1 , 2 1 , − 2 1 , 2 1 ) in flat form.
Verify: norm = 4 ⋅ 4 1 = 1 ✅ — the product of unit quaternions is a unit quaternion, so it is a valid rotation. This is the workhorse case a filter runs every millisecond.
Worked example Ex 6 — rotate
u = ( 1 , 0 , 0 ) by 9 0 ∘ about z
Embed u = ( 0 , ( 1 , 0 , 0 )) . Use q z = ( 2 1 , 0 , 0 , 2 1 ) and its conjugate q ˉ z = ( 2 1 , 0 , 0 , − 2 1 ) (from the Conjugate box: same scalar, negated vector). Compute u ′ = q z u q ˉ z .
Forecast: rotating the x -axis by 9 0 ∘ about z should land on the y -axis. Watch the length stay 1 .
First product a = q z u . Scalar = 2 1 ⋅ 0 − ( 0 , 0 , 2 1 ) ⋅ ( 1 , 0 , 0 ) = 0 .
Why this step? We rotate in two half-steps; q u is the first squeeze. Axis z ^ ⊥ x ^ so dot = 0 .
Vector of a = 2 1 ( 1 , 0 , 0 ) + 0 + ( 0 , 0 , 2 1 ) × ( 1 , 0 , 0 ) = ( 2 1 , 0 , 0 ) + ( 0 , 2 1 , 0 ) = ( 2 1 , 2 1 , 0 ) .
So a = ( 0 , ( 2 1 , 2 1 , 0 )) .
Second product u ′ = a q ˉ z . Scalar = 0 ⋅ 2 1 − ( 2 1 , 2 1 , 0 ) ⋅ ( 0 , 0 , − 2 1 ) = 0 .
Why this step? The scalar of the result must be 0 for a pure vector — a built-in sanity check.
Vector of u ′ = 0 + 2 1 ( 2 1 , 2 1 , 0 ) + ( 2 1 , 2 1 , 0 ) × ( 0 , 0 , − 2 1 ) .
Why this step? This is the second half-turn: w 2 v 1 scales a 's arrow by q ˉ z 's scalar, and the cross term adds the sideways twist q ˉ z contributes. Together the two half-turns compose into the full 9 0 ∘ .
Cross = ( 2 1 ⋅ ( − 2 1 ) − 0 , 0 − 2 1 ⋅ ( − 2 1 ) , 0 ) = ( − 2 1 , 2 1 , 0 ) .
Sum = ( 2 1 , 2 1 , 0 ) + ( − 2 1 , 2 1 , 0 ) = ( 0 , 1 , 0 ) .
u ′ = ( 0 , ( 0 , 1 , 0 )) ⇒ u ′ = ( 0 , 1 , 0 ) = y ^ . ✅
Figure — what you are looking at: the black arrow along x is the input u = ( 1 , 0 , 0 ) ; the dashed black arc is the + 9 0 ∘ sweep about z ; the red arrow along y is the output u ′ = ( 0 , 1 , 0 ) . Same length, quarter turn — red = where the vector lands.
Verify: ∣ u ′ ∣ = 1 = ∣ u ∣ (length preserved), and x ^ went to y ^ exactly as a + 9 0 ∘ turn about z should. The half-angle inside q is what makes two half-turns compose into one full rotation.
27 0 ∘ rotation about z
θ = 27 0 ∘ ⇒ 2 θ = 13 5 ∘ , cos 13 5 ∘ = − 2 1 , sin 13 5 ∘ = + 2 1 .
So q = ( − 2 1 , 0 , 0 , 2 1 ) (flat form).
Forecast: a 27 0 ∘ turn about z is the same physical orientation as − 9 0 ∘ about z . Will the two quaternions look equal — or opposite?
Quaternion for − 9 0 ∘ about z : 2 θ = − 4 5 ∘ , giving q ′ = ( 2 1 , 0 , 0 , − 2 1 ) .
Why this step? We compare two ways of naming the same physical turn.
Compare: q = ( − 2 1 , 0 , 0 , 2 1 ) and − q ′ = ( − 2 1 , 0 , 0 , 2 1 ) . They are equal, i.e. q = − q ′ .
Why this step? Every rotation has two quaternions, q and − q — this is the double cover . A negative scalar just means the half-angle passed 9 0 ∘ .
Prove they act identically by sandwiching x ^ = ( 1 , 0 , 0 ) with q . First a = q x where x = ( 0 , ( 1 , 0 , 0 )) : scalar = 0 − ( 0 , 0 , 2 1 ) ⋅ ( 1 , 0 , 0 ) = 0 ; vector = − 2 1 ( 1 , 0 , 0 ) + 0 + ( 0 , 0 , 2 1 ) × ( 1 , 0 , 0 ) = ( − 2 1 , 2 1 , 0 ) , so a = ( 0 , ( − 2 1 , 2 1 , 0 )) .
Why this step? The only honest test of "same rotation" is: do they move a basis vector the same way?
Then x ′ = a q ˉ with q ˉ = ( − 2 1 , 0 , 0 , − 2 1 ) : scalar = 0 − ( − 2 1 , 2 1 , 0 ) ⋅ ( 0 , 0 , − 2 1 ) = 0 ; vector = − 2 1 ( − 2 1 , 2 1 , 0 ) + ( − 2 1 , 2 1 , 0 ) × ( 0 , 0 , − 2 1 ) = ( 2 1 , − 2 1 , 0 ) + ( − 2 1 , − 2 1 , 0 ) = ( 0 , − 1 , 0 ) .
So x ^ ↦ ( 0 , − 1 , 0 ) = − y ^ . A 27 0 ∘ (equivalently − 9 0 ∘ ) turn about z sends x ^ to − y ^ . ✅
Verify: ∣ q ∣ = 2 1 + 2 1 = 1 ✅, and both q and q ′ = − q send x ^ → − y ^ (you get the identical vector because ( − q ) u ( − q ) = q u q − 1 — the two minus signs cancel). A negative w is never "wrong"; it is one of two valid labels. Filters flip q → − q when w < 0 to keep the shortest-path representation.
Worked example Ex 8 — infinitesimal update,
θ → 0
A gyro reports angular velocity ω over a tiny time Δ t , giving a small rotation of angle θ = ∣ ω ∣Δ t about axis n ^ . Take θ = 0.01 rad about n ^ = ( 0 , 0 , 1 ) and multiply it onto q 0 = 1 = ( 1 , 0 ) .
Forecast: for a tiny angle, what happens to cos 2 θ and sin 2 θ ? Guess the approximate quaternion.
Taylor-expand: cos 2 θ = 1 − 2 1 ( 2 θ ) 2 + O ( θ 4 ) and sin 2 θ = 2 θ − 6 1 ( 2 θ ) 3 + O ( θ 5 ) . We keep only the leading terms: cos 2 θ ≈ 1 (error ∼ θ 2 /8 ) and sin 2 θ ≈ 2 θ (error ∼ θ 3 /48 ).
Why this step? The neglected terms are O ( θ 2 ) and smaller; for θ ≲ 0.1 rad (≈ 6 ∘ , a typical gyro step) that relative error is under 8 0. 1 2 ≈ 0.13% , safely below sensor noise — so the linearization is trustworthy in exactly the regime it is used.
Build the small quaternion. With n ^ = ( 0 , 0 , 1 ) and 2 θ = 0.005 :
δ q = ( cos 2 θ , sin 2 θ n ^ ) ≈ ( 1 , ( 0 , 0 , 0.005 ) ) , δ q = ( 1 , 0 , 0 , 0.005 ) (flat form).
Numerically cos 0.005 ≈ 0.99998750 and sin 0.005 ≈ 0.00499998 , both rounding to the kept values.
Why this step? This is the linear approximation gyro integrators actually store: scalar ≈ 1 , vector ≈ 2 1 ω Δ t .
Apply the update onto the current attitude q 0 = 1 : q 1 = δ q q 0 = δ q ⋅ 1 = δ q = ( 1 , 0 , 0 , 0.005 ) .
Why this step? By Case A (Ex 1), multiplying by the identity 1 leaves δ q unchanged — so the new attitude is just δ q itself. Starting from "no rotation," one tiny step is the tiny rotation.
Renormalize: ∣ δ q ∣ = 1 2 + 0.00 5 2 = 1.000025 ≈ 1.0000125 , so q 1 ← q 1 /∣ q 1 ∣ ≈ ( 0.99998750 , 0 , 0 , 0.00499994 ) .
Why this step? Dropping the O ( θ 2 ) term left δ q slightly off-unit (norm > 1 by ∼ 1.25 × 1 0 − 5 ); dividing by the norm restores a valid rotation (the parent's "renormalize" warning in action).
Verify: the stored vector part 2 1 θ = 0.005 matches 2 1 ∣ ω ∣Δ t exactly — this recovers the kinematics $\dot q=\tfrac12 q\,\omega$ . As θ → 0 : cos 2 θ → 1 , sin 2 θ → 0 , so δ q → ( 1 , 0 ) = 1 — no rotation, no change. Smooth limiting behaviour ✅.
Worked example Ex 9 — given
q p = r , find p
You know the total rotation r = k = ( 0 , ( 0 , 0 , 1 )) and the last-applied factor q = i = ( 0 , ( 1 , 0 , 0 )) , while the first-applied factor p is unknown. Find p .
Forecast: to "undo" a left multiplication by q , what do we multiply by, and on which side?
From q p = r , left-multiply both sides by q − 1 : q − 1 q p = q − 1 r ⇒ p = q − 1 r .
Why this step? Multiplication is non-commutative, so we must cancel q on the same side it sits — the left. Order discipline is the whole point.
q = i is unit, so q − 1 = q ˉ = ( 0 , ( − 1 , 0 , 0 )) = − i (conjugate: same scalar 0 , negated vector).
Why this step? For unit quaternions inverse = conjugate; flip the vector part.
p = ( − i ) ( k ) . Scalar = 0 − ( − 1 , 0 , 0 ) ⋅ ( 0 , 0 , 1 ) = 0 . Vector = 0 + 0 + ( − 1 , 0 , 0 ) × ( 0 , 0 , 1 ) = ( 0 , 1 , 0 ) = y ^ .
So p = ( 0 , ( 0 , 1 , 0 )) = j .
Why this step? Used the Hamilton formula once more; ( − x ^ ) × z ^ = + y ^ .
Answer: p = j .
Verify: check q p = i j = k = r ✅ (from Ex 2). The unknown factor is recovered exactly — this is precisely how a MEKF backs out an error quaternion from measured vs. predicted attitude. See Multiplicative EKF (MEKF) .
Recall Which term dies in each degenerate case?
Perpendicular axes ::: dot term = 0 (Ex 2).
Parallel/equal axes ::: cross term = 0 (Ex 3).
One factor is 1 ::: everything but v dies; identity, commutes both sides (Ex 1).
Tiny angle θ → 0 ::: quaternion → ( 1 , 0 ) , no change (Ex 8).
Recall Test yourself
ij − j i = ? ::: 2 k — the doubled cross term (Ex 4).
How to undo a left factor in q p = r ? ::: p = q − 1 r , multiply on the left (Ex 9).
Two quaternions for one rotation? ::: q and − q (double cover, Ex 7).
Small-angle vector part of δ q ? ::: 2 1 ω Δ t (Ex 8).
"Perp kills Dot, Parallel kills Cross, One keeps All, Tiny keeps None." — the four degenerate cells at a glance.
Quaternion product — Hamilton product — the rule these examples drill.
Cross Product & Right-Hand Rule — the source of every sign flip in Ex 2, 4, 5.
Axis-Angle & Euler Rodrigues — where the half-angle 2 θ in Ex 5–8 comes from.
Quaternion Kinematics — $\dot q = \tfrac12 q\,\omega$ — the limit Ex 8 recovers.
Multiplicative EKF (MEKF) — the error-quaternion trick of Ex 9.
Rotation Matrices — SO(3) — cross-check Ex 6 against a rotation matrix.
#flashcards/physics