A single unitquaternion describes one orientation relation. Real systems, however, almost always
involve a sequence of rotations or frame transformations. A body may receive several attitude
commands, a navigation algorithm may transform through several coordinate frames,
or an Euler sequence may build an orientation through three successive elementary
rotations.
The important question is therefore not merely how to construct one quaternion, but how
quaternion transformations compose and which factor acts first.
PhysicsLibrary uses passive frame quaternions as the canonical attitude objects. If
maps coordinates from frame A into frame B, and
maps coordinates from frame B into frame C, then the direct map from A into C is
(1)
This is the fundamental PhysicsLibrary composition rule.
Comparing this with the canonical passive sandwich gives
(12)
No ad hoc reversal rule is needed. The composition order follows directly from the frame map
definition.
3 Longer frame chains
The same rule extends immediately to any number of frames. For
the direct quaternion is
(13)
Applied to a vector,
The factor nearest the vector describes the first coordinate map. Each successive map appears
farther to the left.
The frame labels provide a visual consistency check:
The adjacent frame names form the chain
The labels are not algebraically cancelled like scalar fractions, but their pattern is an effective
mnemonic for detecting an incorrectly ordered chain.
4 Inverse of a frame chain
Starting with
take the inverse:
Since frame quaternions are unit,
Relabeling the reverse maps gives
(14)
Thus reversing the frame chain also reverses the multiplication order.
The forward sequence
becomes
5 Relation to passive matrix composition
Let
(15)
be the passive direction cosine matrix associated with the frame quaternion.
Then
(16)
Two successive frame maps give
Therefore
(17)
Comparing with equation (13) gives the homomorphism relation
(18)
Quaternion and matrix chains therefore use the same written order under the PhysicsLibrary
passive convention.
This alignment is one of the main reasons for choosing the present frame quaternion
notation.
6 Why finite rotations do not commute
Consider the elementary passive quaternions for positive 90∘ frame rotations about the coordinate
x and y axes:
(19)
(20)
Their products are
while
Therefore
(21)
The sign of the k component changes.
7 Vector check of noncommutativity
Use the initial pure quaternion
Apply qx first and then qy. The combined passive operator is
The first map sends
and the second leaves j unchanged because it lies along the second rotation axis. Thus
(22)
Reverse the order. The combined operator is
The y map first sends
and the subsequent x map leaves i unchanged. Hence
(23)
The same initial vector therefore gives two different final coordinate vectors:
This is a direct observable consequence of noncommutativity.
Figure 1:Order matters for successive passive frame rotations. Starting with Av = k,
applying the positive 90∘ passive x frame map first and the positive 90∘ passive y frame map
second gives Cv = j and qnet = qyqx. Reversing the order gives Cv = −i and qnet = qxqy.
Figure 1 summarizes both quaternion products and their different actions on the same initial
coordinate vector.
8 Associative but not commutative
Quaternion multiplication is associative:
(24)
This means parentheses may be moved without changing a valid composition chain.
Quaternion multiplication is not commutative:
(25)
in general.
These two facts have different practical meanings:
Associativity allows a long frame chain to be grouped for computational convenience.
Noncommutativity means the chronological or frame sequence itself cannot normally
be rearranged.
9 Comparison with successive active rotations
The active counterpart obeys the same basic product pattern.
Let r1 actively rotate a physical vector first and let r2 act second:
and
Substitution gives
Therefore
(26)
The important distinction is not the abstract product law. It is the quaternion associated with a
positive geometric rotation.
For the same positive axis and angle,
(27)
Thus a positive active rotor has the opposite vector sign from the corresponding positive passive
frame quaternion.
10 Do not infer order from the words active or passive
It is tempting to memorize statements such as “active reverses order” or “passive keeps order.”
Such slogans are unreliable because authors define their quaternion symbols, map directions, and
axis descriptions differently.
The safe procedure is:
state what each quaternion maps;
write the action on a vector;
substitute successive transformations;
use associativity;
identify the resulting net quaternion.
For PhysicsLibrary’s canonical passive notation, this procedure yields
11 Intrinsic and extrinsic rotations
The words intrinsic and extrinsic describe which axes are used for successive elementary
rotations.
An intrinsic sequence uses axes attached to the moving frame. After the first rotation, the second
axis has moved with the frame; after the second rotation, the third axis has moved
again.
An extrinsic sequence uses axes fixed in the reference frame.
The same final orientation can be described either way if the axis sequence and angle order are
reversed appropriately. Therefore the words alone are not sufficient to determine quaternion
multiplication order.
PhysicsLibrary uses intrinsic moving axis language for Euler sequences unless an article explicitly
states otherwise.
12 Generic intrinsic -- sequence
Let an intrinsic sequence consist of:
a rotation α about the initial moving axis i;
a rotation β about the new moving axis j;
a rotation γ about the final moving axis k.
Define the passive elementary quaternions
(28)
(29)
and
(30)
Under the PhysicsLibrary moving axis convention, the total passive frame quaternion
is
(31)
The corresponding passive DCM is
(32)
Quaternion and DCM sequence order therefore agree exactly.
13 Intrinsic and extrinsic equivalence
The intrinsic sequence
with angles
describes the same final orientation as an extrinsic sequence about the fixed axes
with angles
Symbolically,
(33)
This equivalence is a statement about how the same geometric orientation is described. It does not
mean the original sequence can be arbitrarily reordered.
14 Aerospace intrinsic -- example
For the common intrinsic 3-2-1 sequence, PhysicsLibrary uses
The rotations occur intrinsically as
The passive quaternion is
(34)
The passive DCM uses the same order:
(35)
This is equivalent to an extrinsic fixed axis 1-2-3 description with angles ϕ,𝜃,ψ applied in the
corresponding reversed viewpoint.
Writing the product explicitly is safer than relying on the phrase “yaw pitch roll,” because software
and textbooks differ in how they use that phrase.
15 Useful scalar vector composition formula
Let
Hamilton multiplication gives
(36)
This formula is useful for computing the net axis angle representation after two rotations.
For passive elementary rotations,
and
Thus the scalar part of the net quaternion is
(37)
where
The vector part is
(38)
Once qnet is normalized and its principal sign is selected, the passive net axis can be recovered
from
(39)
when the vector part is nonzero.
16 Special case: rotations about the same axis
Let both passive rotations use the same unit axis u:
Because both quaternions lie in the same two dimensional subalgebra generated by 1 and u, they
commute.
Direct multiplication gives
(40)
Therefore rotations about the same axis add their angles.
This is a special commuting case. It should not be generalized to rotations about different
axes.
17 Special case: inverse rotations
If
then
(41)
The second transformation exactly reverses the first.
For a frame chain,
This is an important implementation check.
18 Small rotations and approximate commutativity
Finite rotations do not generally commute, but very small rotations can appear to commute to first
order.
Let
and
where the rotation vectors are pure quaternions.
Multiplying and retaining terms through second order gives
Reversing the order changes only the second order product term.
Thus noncommutativity disappears only at first order. This is why infinitesimal rotation
calculations may look commutative even though finite attitude updates are not.
19 Implementation guidance
When composing quaternion transformations in software:
Document what the quaternion maps. For PhysicsLibrary, BqA means coordinates
A → B.
Document Hamilton multiplication separately from component storage.
Write frame labels in design notes even if the software type does not encode them.
Build long chains in the same order as the corresponding passive DCM chain.
Do not reorder factors for computational convenience unless the quaternions are known
to commute.
When converting from an external library, test a positive 90∘ rotation about each
coordinate axis.
Verify the inverse relation
For an Euler sequence, write whether the axes are intrinsic moving axes or extrinsic
fixed axes.
20 Common pitfalls
Using the old PhysicsLibrary frame notation direction.
The current house convention is
Reversing a valid frame chain.
The correct chain is
Assuming finite rotations commute.
In general,
Confusing active and passive positive rotation quaternions.
For the same positive axis and angle, they are conjugates.
Changing Hamilton multiplication to repair a frame convention problem.
PhysicsLibrary retains Hamilton multiplication. Frame direction is encoded in the
quaternion symbol and in the sign of the positive passive elementary rotation.
Treating intrinsic and extrinsic as synonyms.
Intrinsic axes move with the rotating frame. Extrinsic axes remain fixed in the reference
frame.
Using an intrinsic axis list with an extrinsic product.
For PhysicsLibrary’s intrinsic i-j-k sequence,
Inferring multiplication convention from scalar first or scalar last storage.
Memory layout does not determine quaternion multiplication.
Assuming small angle commutativityholds for finite updates.
The noncommuting cross product term appears at second order and becomes important
as rotation increments grow.
21 Verification cases
Several composition checks are useful to keep in a test suite.
The present article uses that action to derive the composition rule, frame chains, noncommutativity,
and intrinsic sequence order.
A separate companion entry, Composition of Rotations and Quaternion Order: Examples,
Exercises, and Solutions, provides the Q08E self study problem bank.
The next main article, quaternions and direction cosine matrices, derives the complete
matrix associated with a unit quaternion and develops the inverse matrix to quaternion
conversion.
23 Sources and convention notes
Quaternion composition follows directly from associativity and the conjugate order reversal
identity. Historical quaternion texts treat products of versors and successive rotations, while
modern engineering sources emphasize the need to state multiplication and frame conventions
explicitly.
Sommer and coauthors provide a modern discussion of Hamilton and flipped multiplication and
the homomorphism issues that arise when active and passive attitude conventions are mixed.
PhysicsLibrary retains Hamilton multiplication and chooses passive frame quaternions whose
composition order matches the passive direction cosine matrix chain.
References
[1]W. R. Hamilton, Elements of Quaternions, 2nd ed., edited by C. J. Joly, Longmans,
Green, and Co., 1899. Public domain historical source. Internet Archive scan
[2]C. J. Joly, A Manual of Quaternions, Macmillan and Co., London, 1905. Public
domain historical source. Internet Archive scan
[3]A. S. Hathaway, A Primer of Quaternions, 1896. Public domain historical source.
Project Gutenberg edition
[4]H. Sommer, I. Gilitschenski, M. Bloesch, S. Weiss, R. Siegwart, and J. Nieto, “Why
and How to Avoid the Flipped Quaternion Multiplication,” Aerospace, vol. 5, no. 3,
article 72, 2018. Published under CC BY 4.0. Publisher article
License
Unless otherwise noted, this PhysicsLibrary entry is intended for release under the Creative
Commons Attribution ShareAlike 4.0 International license.
"composition of rotations and quaternion order" is owned by bloftin.