|
Quaternions are widely used to represent three-dimensional orientation in spacecraft attitude determination and control, inertial navigation, robotics, multibody dynamics, computer graphics, and rigid-body simulation. Their practical advantages are substantial: a unit quaternion represents an arbitrary proper rotation with only four parameters, avoids the coordinate singularities of Euler-angle descriptions, composes rotations efficiently, and can be propagated directly from angular velocity.
The difficulty is not usually the quaternion algebra itself. The difficulty is that several independent convention choices occur in the literature and in software. Two sources can display nearly identical equations while assigning opposite meanings to them. A reliable engineering treatment must therefore state its conventions before using quaternion formulas.
This entry establishes the convention used by the PhysicsLibrary quaternion series. It also shows how to recognize the most common alternatives. The algebraic details of quaternion multiplication, conjugation, norm, inverse, axis–angle construction, vector rotation, direction-cosine matrices, Euler angles, and quaternion kinematics are developed in subsequent entries.
A quaternion implementation normally makes at least five logically separate choices:
- the quaternion multiplication law;
- the ordering used to display or store the four components;
- the handedness of the physical coordinate frame and positive rotation;
- whether a rotation is interpreted actively or passively;
- the direction of a frame-to-frame coordinate transformation.
These choices are related in applications, but they are not identical. In particular, scalar-first versus scalar-last storage does not determine the quaternion multiplication law, and active versus passive does not by itself determine whether Hamilton or flipped multiplication is being used.
For this reason, identifying a convention only by a label such as “JPL,” “Hamilton,” “engineering,” “aerospace,” “right-handed,” or “left-handed” is unsafe unless the defining equations are also given.
Unless an article explicitly states otherwise, the PhysicsLibrary quaternion series uses the following convention.
This choice keeps the original Hamilton algebra while giving frame-chain notation that behaves naturally in mechanics, navigation, and robotics.
A quaternion is an element of a four-dimensional real algebra,
The symbols
satisfy
Consequently,
and similarly for cyclic permutations. The product is therefore not commutative.
The same quaternion may be stored in several array layouts. For example,
may be stored scalar first as
or scalar last as
The algebra has not changed. Only the memory or display layout has changed.
This distinction is critical when moving equations into software. Reordering an array is a permutation of components; changing the quaternion multiplication law changes the signs and order in the algebra itself.
Let
where and denote the three-component vector parts. Hamilton multiplication is
 |
(1) |
The sign of the cross-product term encodes the familiar Hamilton rule
.
A second multiplication is common in parts of the spacecraft literature. It may be defined simply by reversing the Hamilton factors,
 |
(2) |
where the product on the right is Hamilton multiplication. Equation (2) gives
 |
(3) |
Hence a rapid diagnostic is
 Hamilton multiplication 
whereas
 flipped/Shuster multiplication 
Sommer et al. call the latter the flipped or Shuster multiplication and explain how it arose from a particular passive world-to-body quaternion-to-matrix assignment used in spacecraft work. Shuster's own historical discussion calls Hamilton's ordering the traditional formulation and the later spacecraft ordering the natural formulation because it was chosen to make quaternion composition follow the same written order as the corresponding attitude-matrix composition.
PhysicsLibrary uses Hamilton multiplication and does not redefine the product in order to handle passive frame transformations. Instead, the direction of the frame map is written explicitly in the quaternion symbol.
Some books, papers, software documentation, and engineering discussions refer to the two multiplication/sign conventions as right-handed and left-handed quaternion conventions. This terminology can be useful as an informal mnemonic, because changing the sign of the vector cross-product term reverses the orientation of the multiplication table. It is also highly overloaded.
“Right-handed” may instead refer to the handedness of the coordinate basis, the sign convention for positive rotation, the direction associated with a right-handed screw, or the orientation chosen for a vector product. Historical quaternion literature itself contains incompatible uses of the term. Joly, for example, explicitly warned in 1905 that his right-handed screw convention for positive rotation was opposite to Hamilton's convention, even though Hamilton also called his own convention right-handed.
Accordingly, PhysicsLibrary does not use “right-handed quaternion” or “left-handed quaternion” as the primary definition of an algebra. We state the unambiguous test instead:
Coordinate-frame handedness and positive rotation are stated separately.
This distinction is one of the most common sources of sign errors.
An active rotation changes a physical vector while the reference frame is held fixed. Let frame remain fixed and rotate the vector through
about
. With the PhysicsLibrary convention,
For the initial vector
the quaternion sandwich gives
Thus the active rotation sends
A passive transformation leaves the physical vector fixed and changes the basis used to describe it. Let frame be obtained by rotating the axes of frame through
about
. The quaternion describes the orientation of relative to and maps -coordinates to -coordinates:
 |
(4) |
For this example,
The inverse coordinate transformation is
 |
(5) |
Therefore a physical vector whose -coordinates are
has -coordinates
Nothing physical has rotated in this passive calculation. The minus sign appears because the new axes themselves have rotated positively relative to .
A rotation operator can be interpreted either as actively rotating a vector or as describing the relative orientation of two frames. A direction-cosine matrix and a unit quaternion therefore do not become “active objects” or “passive objects” merely because of their numerical values. Their meaning is determined by the map being represented.
For this reason, a statement such as “this quaternion is passive” is incomplete unless the author also states which coordinates it maps from and to. PhysicsLibrary uses explicit frame superscripts and subscripts for that purpose.
Let map coordinates from frame to frame , and let map coordinates from to . Starting from a vector expressed in ,
then
Substitution gives
Therefore
 |
(6) |
The intermediate frame cancels visually, just as it does in tensor and coordinate-transformation notation. Equation (6) is the convention used throughout the PhysicsLibrary series.
The Space Shuttle working-relationships memorandum provides a useful historical engineering example of why such declarations matter: it develops conversions among Euler angles, quaternions, and transformation matrices for Shuttle analysis and explicitly states the direction in which its transformation matrices map coordinate components. A formula should not be copied out of such a source without carrying its frame-direction convention with it.
The convention disagreement is not merely a matter of taste. It arose from a specific composition problem.
With one commonly used passive world-to-body quaternion-to-matrix assignment, Hamilton multiplication gives an anti-homomorphism:
 |
(7) |
The order of the quaternion factors is reversed relative to the corresponding matrix product. In a large attitude-software system containing many reference frames, this is an obvious source of mistakes.
Shuster advocated a flipped multiplication so that
and therefore
 |
(8) |
This restores matching written order between the quaternion and matrix chains for that quaternion-to-matrix convention.
Sommer et al. later pointed out that the flipped product is not necessary. One can retain Hamilton multiplication and change the quaternion-to-matrix assignment (equivalently, use the inverse/conjugate quaternion in the passive world-to-body mapping) so that the desired homomorphic composition property is preserved. PhysicsLibrary follows this Hamilton-compatible approach.
The practical lesson is more important than the historical dispute:
Never infer a quaternion convention from component order or from the word “aerospace.” Test the multiplication law, determine the frame-map direction, and verify one known rotation.
Any paper, simulation, flight-software interface, or PhysicsLibrary entry that uses quaternions should make enough information available to reconstruct the following checklist:
- Is the physical frame right-handed or left-handed?
- What is the positive sense of rotation?
- Is
or
?
- Is the scalar component displayed/stored first or last?
- Does the quaternion map frame
to frame , or to ?
- Is the equation describing an active vector rotation or a passive coordinate change?
- What is the quaternion-to-matrix relationship?
- In a product
, which physical rotation occurs first?
If those questions are answered, most apparent quaternion disagreements become simple conversion problems.
Suppose a software library documents a quaternion as
and also states
The first statement says only that the array is scalar last. The second statement identifies the multiplication law as Hamilton multiplication. Therefore this library is scalar-last Hamilton, not automatically a flipped or JPL multiplication implementation.
For a
active rotation about ,
PhysicsLibrary displays this as
whereas the hypothetical software library stores
They represent the same Hamilton quaternion.
Consider again a
rotation about .
For an active rotation of a vector,
For a passive coordinate change into a frame whose axes have themselves been rotated
about , the same fixed physical vector has coordinates
The opposite sign is not a contradiction. The two operations answer different questions.
An unfamiliar source gives the basis products
The vector cross-product term has the opposite sign from equation (1). Therefore is the flipped multiplication relative to the PhysicsLibrary/Hamilton convention.
Before importing any rotation, DCM, or kinematic equation from that source, one must either convert the multiplication convention or consistently convert the associated quaternion-to-matrix and frame-map conventions as a set.
- Assuming scalar-last means JPL. It does not. Storage order and multiplication are independent choices.
- Calling a formula active or passive without naming the frames. A quaternion value alone does not determine the interpretation.
- Mixing
and from different sources. These are inverse rotations for a unit quaternion.
- Copying a quaternion-to-DCM equation without its convention. A transpose may represent the same physical orientation under the opposite mapping direction.
- Assuming “right-handed quaternion” is unambiguous. The phrase has been used for different algebraic, coordinate, and screw-sense conventions.
- Changing multiplication but not kinematics. Quaternion propagation equations depend on multiplication convention, frame map, and whether angular velocity is resolved in the body or reference frame.
- Forgetting the double representation. The unit quaternions
and represent the same proper rotation. This is developed in a later entry.
- A library stores quaternions as
and reports
. Identify the component order and the multiplication convention.
- A second library stores
but reports
. Is it Hamilton multiplication? Does scalar-first storage change your answer?
- Using
state the result of actively rotating
by . Then state the coordinates of the same fixed physical vector in a frame that has been rotated
about relative to the original frame.
- Show directly that replacing
by in the active rotation law does not change .
- Suppose
maps coordinates to coordinates and maps coordinates to coordinates. Derive the quaternion that maps coordinates directly to coordinates.
The array order
is scalar last. The defining product
identifies Hamilton multiplication. The two facts are independent.
The array is scalar first. Since
, the multiplication is the flipped convention relative to Hamilton multiplication. Scalar-first storage does not alter this conclusion.
The quaternion represents a positive
rotation about under the PhysicsLibrary convention. Therefore
for the active rotation. If instead the physical vector is fixed and the coordinate frame is rotated positively by
, then
Using
,
Thus and generate the same vector rotation.
Apply the -to- map first and the -to- map second:
Associativity gives
so
This entry deliberately stops before developing quaternion algebra and rotation formulas in full. The subsequent sequence derives:
- quaternion definition and elementary algebra;
- scalar–vector form of the Hamilton product;
- conjugate, norm, and inverse;
- axis–angle and unit quaternions;
- quaternion rotation of vectors;
- composition of finite rotations;
- quaternion–DCM conversion;
- quaternion–Euler-angle conversion;
- quaternion kinematics and angular velocity;
- relative attitude and error quaternions;
- numerical propagation and normalization;
- a consolidated engineering exercise set with complete solutions.
The present article is an original synthesis written for PhysicsLibrary. Its convention discussion is cross-checked against modern engineering literature, historical quaternion sources, and openly licensed instructional material. Sommer et al. is especially useful for separating Hamilton multiplication from its flipped spacecraft variant and for identifying the passive world-to-body mapping issue. Shuster provides the historical spacecraft rationale for the alternative multiplication ordering. Moore provides a modern engineering presentation of reference-frame orientation and direction-cosine matrices. Joly provides a useful historical warning that even the term “right-handed” has been used with conflicting rotation conventions.
- 1
- 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. DOI: 10.3390/aerospace5030072. Published under CC BY 4.0. Publisher article
- 2
- M. D. Shuster, “The Nature of the Quaternion,” The Journal of the Astronautical Sciences, vol. 56, no. 3, pp. 359–373, 2008. DOI: 10.1007/BF03256558. Author-hosted manuscript
- 3
- J. K. Moore, Learn Multibody Dynamics, 2026 edition, especially the chapter “Orientation of Reference Frames.” The text is distributed under the Creative Commons Attribution 4.0 International license. Learn Multibody Dynamics
- 4
- D. M. Henderson, Euler Angles, Quaternions, and Transformation Matrices—Working Relationships, JSC-12960, NASA Johnson Space Center, Mission Planning and Analysis Division, July 1977.
- 5
- C. J. Joly, A Manual of Quaternions, Macmillan and Co., London, 1905. Public-domain historical source.
- 6
- W. R. Hamilton, Elements of Quaternions, 2nd ed., edited by C. J. Joly, Longmans, Green, and Co., 1899. Public-domain historical source.
Unless otherwise noted, this PhysicsLibrary entry is intended for release under the Creative Commons Attribution–ShareAlike 4.0 International license.
|