Quaternions for Physics and Engineering: Orientation, Notation, and Conventions
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 orientation with only four parameters, avoids the coordinate singularities of
Euler Angle descriptions, composes frame transformations 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. The collection
uses Hamilton multiplication, scalar first display notation, right handed physical frames, passive
frame to frame coordinate transformations as the primary attitude interpretation, and
intrinsic moving axis sequences when an orientation is specified by successive named
rotations.
The algebraic details of quaternion multiplication, conjugation, norm, inverse, axis angle
construction, coordinate transformation, direction cosine matrices, Euler angles, and quaternion
kinematics are developed in subsequent entries.
1 The convention choices that must not be conflated
A quaternion implementation normally makes several logically separate choices:
- the quaternion multiplication law;
- the ordering used to display or store the four components;
- the handedness of the physical coordinate frames;
- the sign convention for positive physical or frame rotation;
- whether the operation is interpreted as an active vector rotation or a passive coordinate
transformation;
- the direction of a frame to frame coordinate transformation; and
- for a sequence of rotations, whether the axes are intrinsic (moving axis) or extrinsic
(fixed-axis).
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.
Likewise, the words “yaw–pitch–roll” or “3–2–1” are not complete convention declarations
unless the sequence is identified as intrinsic or extrinsic and the frame-map direction is
stated.
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.
2 PhysicsLibrary convention contract
Unless an article explicitly states otherwise, the PhysicsLibrary quaternion series uses the following
convention.
PhysicsLibrary quaternion convention
- Physical Cartesian frames are right handed orthonormal frames unless otherwise
stated.
- Positive frame rotation follows the usual right-hand screw rule.
- Quaternion multiplication is Hamilton multiplication:
with reversed products changing sign.
- A quaternion is written scalar first,
Software storage order is treated as a separate implementation detail and must
be declared when code is discussed.
- The canonical attitude quaternion is a passive coordinate map. The notation
means “map coordinates from frame A into frame B.” A vector embedded as the
pure quaternion v = 0 + v transforms according to
- If frame B is obtained from frame A by a positive right handed rotation of the
axes through angle 𝜃 about unit axis u, then
The negative vector part is the passive counterpart of the usual positive angle
active rotor.
- Quaternion frame composition follows the same written order as passive direction
cosine matrices. If Bq
A maps A → B and Cq
B maps B → C, then
- When a named three rotation sequence is used, PhysicsLibrary interprets it
intrinsically unless an article explicitly states otherwise. Each successive rotation
is about an axis of the current, already rotated frame.
The corresponding passive direction cosine matrix uses the same frame labels:
Thus the quaternion and matrix representations have the same map direction,
and the same frame chain order,
This alignment is deliberate. It preserves Hamilton’s original algebra while making quaternion,
direction cosine-matrix, and Euler angle frame notation behave consistently in mechanics,
navigation, robotics, and attitude estimation.
3 Quaternion algebra versus component storage
A quaternion is an element of a four-dimensional real algebra,
The symbols i,j,k 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.
4 Hamilton and flipped quaternion multiplication
Let
where p and q denote the three component vector parts. Hamilton multiplication is
The sign of the cross product term encodes the familiar Hamilton rule ij = k.
A second multiplication is common in parts of the spacecraft literature. It may be defined by
reversing the Hamilton factors,
where the product on the right is Hamilton multiplication. This gives
Hence a rapid diagnostic is
whereas
Sommer et al. call the latter the flipped or Shuster multiplication and explain how it arose in
spacecraft attitude work. Shuster’s historical discussion emphasizes that the alternative product
was introduced to recover a convenient written composition order for a particular passive attitude
matrix assignment.
PhysicsLibrary uses Hamilton multiplication and does not redefine the product to obtain passive
frame transformations. Instead, the quaternion itself is defined in the same coordinate-map
direction as the passive matrix. A positive rotation of the frame therefore uses the conjugate of the
familiar positive active rotor.
A note on “right handed” and “left handed” quaternions
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, positive frame rotation, and frame-map direction are stated
separately.
5 Passive coordinate transformation and active vector rotation
This distinction is one of the most common sources of quaternion sign errors. PhysicsLibrary takes
the passive frame transformation as the canonical attitude operation.
5.1 Passive viewpoint: the PhysicsLibrary default
A passive transformation leaves the physical vector fixed and changes the basis used to describe
it.
Let frame B be obtained by rotating the axes of frame A through +90∘ about +z. The positive
frame rotation is represented by
The passive coordinate map is
For a fixed physical vector whose A-coordinates are
the B-coordinates are
Nothing physical has rotated in this calculation. The minus sign appears because the new B axes
themselves have rotated positively relative to A.
5.2 Active viewpoint: the inverse geometric operation
An active rotation changes a physical vector while the reference frame remains fixed. For the same
positive geometric angle, define the active rotor
It is the conjugate of the PhysicsLibrary passive frame quaternion:
when B is obtained from A by the corresponding positive frame rotation.
The active sandwich is
For +90∘ about +z,
so
Thus the passive coordinate transformation gives
for a fixed physical vector, while the corresponding active operation gives
in a fixed basis.
5.3 Why conjugate quaternion values appear
The active and passive descriptions encode the same relative geometry but answer inverse
questions. For a positive frame rotation, the PhysicsLibrary passive quaternion has the negative
axis-angle vector part,
while the positive active rotor has the positive vector part,
For unit quaternions these are conjugates and inverses:
A statement such as “this quaternion is passive” remains incomplete unless the source also states
the coordinate-map direction. PhysicsLibrary uses explicit frame superscripts and subscripts for
that purpose.
6 Frame direction, inverse maps, and composition
Under the PhysicsLibrary convention,
maps coordinate components from frame A into frame B:
The inverse map is represented by the conjugate:
Indeed,
Now let Bq
A map A → B, and let Cq
B map B → C. Starting from a vector expressed in
A,
then
Substitution gives
Therefore
The intermediate frame B cancels visually, just as it does in tensor and coordinate-transformation
notation.
The passive direction cosine matrices obey the identical chain:
This same-order correspondence is one of the principal reasons for adopting Bq
A as the canonical
PhysicsLibrary attitude quaternion.
7 Intrinsic rotation sequences
A unit quaternion by itself represents a relative orientation; the words intrinsic and extrinsic
become important when that orientation is constructed from a sequence of named elementary
rotations.
PhysicsLibrary uses intrinsic sequences by default. In an intrinsic i–j–k sequence,
- the first rotation is about axis i of the original frame;
- the second rotation is about axis j of the first intermediate frame;
- the third rotation is about axis k of the second intermediate frame.
Let the first, second, and third positive frame rotations be α,β,γ. Define passive elementary
quaternions
and similarly for qjP (β) and q
kP (γ).
Successive passive frame chaining gives
The corresponding direction cosine matrix is
Thus the quaternion and matrix products have exactly the same factor order.
For the common intrinsic 3–2–1 yaw–pitch–roll sequence,
and therefore
matching
This is the convention shared by the cleaned-up PhysicsLibrary quaternion and Euler angle
series.
8 Why the flipped multiplication appeared in spacecraft work
The convention disagreement is not merely a matter of taste. It arose from a specific composition
problem.
Suppose a source stores a quaternion with the numerical sign convention of a positive active
rotor,
but assigns to those same components a passive world to body attitude matrix by transposing the
active matrix. For that assignment, Hamilton multiplication can produce an anti-homomorphic
matrix relationship of the form
The quaternion factor order is then reversed relative to the corresponding passive matrix
product.
Shuster advocated a flipped multiplication,
so that the written quaternion composition could be made to follow the desired matrix order for
that convention.
Sommer et al. later emphasized that changing Hamilton’s multiplication is not necessary. One may
instead retain Hamilton multiplication and make the quaternion to matrix assignment consistent
with the chosen frame-map direction.
PhysicsLibrary follows that approach. The canonical passive quaternion is the coordinate map
itself:
Its sandwich matrix is defined directly as
and Hamilton multiplication is then homomorphic with passive matrix composition:
when p and q are interpreted as successive passive coordinate maps in the matching frame
chain.
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,
inspect the axis-angle sign, and verify one known coordinate transformation.
9 A minimum convention declaration for engineering work
Any paper, simulation, flight software interface, or PhysicsLibrary entry that uses quaternions
should make enough information available to reconstruct the following checklist:
- Are the physical coordinate frames right handed or left handed?
- What is the positive sense of frame rotation?
- Is ij = +k or −k?
- Is the scalar component displayed or stored first or last?
- What does the frame notation Bq
A mean?
- Does the quaternion map A coordinates to B coordinates, or the reverse?
- Is the equation describing an active vector rotation or a passive coordinate change?
- What sign is used in the positive axis-angle quaternion?
- What is the quaternion to matrix relationship?
- In a frame chain product q2q1, which coordinate transformation occurs first?
- If Euler or other named rotations are used, are the axes intrinsic or extrinsic?
If these questions are answered, most apparent quaternion disagreements become simple conversion
problems.
10 Worked example 1: storage order is not multiplication convention
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.
Now consider a positive 45∘ rotation of frame B relative to frame A about +z. Under the
PhysicsLibrary passive convention,
PhysicsLibrary displays this scalar first as
whereas the hypothetical scalar last library stores the same Hamilton quaternion as
Only the component layout has changed.
11 Worked example 2: passive and active signs
Consider again a +90∘ rotation about +z.
For the PhysicsLibrary passive frame transformation,
and a fixed physical vector transforms in coordinates as
The corresponding positive active rotor is the conjugate,
and it sends
in a fixed frame.
The opposite signs are not contradictory. One operation rotates the basis; the other rotates the
physical vector.
12 Worked example 3: detecting the multiplication convention
An unfamiliar source gives the basis products
The vector cross product term has the opposite sign from the Hamilton product. Therefore ⋆ is the
flipped multiplication relative to the PhysicsLibrary/Hamilton convention.
Before importing any coordinate-transformation, DCM, Euler angle, or kinematic equation from
that source, one must either convert the multiplication convention or consistently convert the
associated axis-angle sign, quaternion to matrix relationship, frame-map direction, and
composition rule as a set.
13 Worked example 4: intrinsic 3–2–1 composition
Suppose frame B is obtained from frame A by the intrinsic sequence
The passive elementary frame quaternions are
and
The coordinate maps chain as
so
The factor order is identical to the passive intrinsic DCM,
14 Common pitfalls
- Assuming scalar last means JPL. It does not. Storage order and multiplication
are independent choices.
- Using the positive active axis-angle quaternion as a positive passive frame
quaternion. Under the PhysicsLibrary convention a positive frame rotation has a
negative quaternion vector part.
- Calling a formula active or passive without naming the frames. A quaternion
value alone does not determine the interpretation.
- Mixing qvq∗ and q∗vq from different sources. For a unit quaternion these
represent inverse transformations unless the quaternion itself has also been conjugated
or redefined.
- Reversing frame labels without conjugating the quaternion. Under the
PhysicsLibrary convention,
- 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 the attitude-map convention but not kinematics. Quaternion
propagation equations depend on multiplication convention, frame-map direction, the
chosen attitude state, and the frame in which angular velocity is resolved.
- Calling a 3–2–1 sequence complete without saying intrinsic or extrinsic.
PhysicsLibrary uses intrinsic moving axis sequences by default.
- Forgetting the double representation. The unit quaternions q and −q represent
the same proper frame transformation.
15 Exercises
- A library stores quaternions as [qx,qy,qz,qw] and reports ij = k. Identify the component
order and the multiplication convention.
- A second library stores [qw,qx,qy,qz] but reports i ⋆ j = −k. Is it Hamilton
multiplication? Does scalar first storage change your answer?
- Frame B is obtained from frame A by a positive 90∘ rotation about +z. Write Bq
A
under the PhysicsLibrary passive convention and use it to determine the B-coordinates
of a fixed vector whose A-coordinates are x.
- For the situation in Exercise 3, write the corresponding positive active rotor. What
does it do to x in a fixed frame?
- Show directly that replacing Bq
A by −Bq
A in the passive coordinate law does not
change Bv.
- Suppose Bq
A maps A coordinates to B coordinates and Cq
B maps B coordinates to C
coordinates. Derive the quaternion that maps A coordinates directly to C coordinates.
- Write the passive intrinsic 3–2–1 yaw–pitch–roll quaternion product using ψ for yaw,
𝜃 for pitch, and ϕ for roll.
16 Solutions
1. Scalar-last Hamilton
The array order [qx,qy,qz,qw] is scalar last. The defining product
identifies Hamilton multiplication. The two facts are independent.
2. Scalar-first flipped multiplication
The array is scalar first. Since
the multiplication is the flipped convention relative to Hamilton multiplication. Scalar-first storage
does not alter this conclusion.
3. Positive passive 90∘ frame rotation
For a positive rotation of frame B relative to A about +z,
Applying
to Av = i gives
Thus
4. Corresponding active rotor
The positive active rotor is the conjugate:
Therefore
It rotates the physical vector from +x to +y in a fixed frame.
5. The sign of a unit quaternion does not change the passive map
Using (−q)∗ = −q∗,
Thus q and −q generate the same passive coordinate transformation.
6. Frame-chain composition
Apply the A-to-B map first and the B-to-C map second:
Associativity gives
Therefore
7. Passive intrinsic 3–2–1 yaw–pitch–roll
The first rotation is yaw about axis 3, the second is pitch about the new axis 2, and the third is
roll about the newest axis 1. The passive elementary quaternions are
and
Frame chaining gives
This has the same factor order as
17 Relation to later PhysicsLibrary entries
This entry deliberately stops before developing the quaternion algebra and application formulas in
full. The subsequent sequence derives:
- quaternion definition and elementary algebra;
- scalar–vector form of the Hamilton product;
- conjugate, norm, and inverse;
- passive axis angle and unit quaternions;
- passive coordinate transformations with quaternions;
- composition of finite frame transformations;
- quaternion DCM conversion;
- passive intrinsic 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 algebra-only articles require little or no convention change. The orientation, Euler angle,
DCM, kinematics, relative attitude, and IMU propagation articles are convention sensitive and
must use the passive frame map declared here.
18 Sources and convention notes
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 interaction between quaternion multiplication and passive attitude
matrix assignment. 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. Henderson provides a classic aerospace treatment
connecting Euler angles, quaternions, and transformation matrices. Joly provides a useful historical
warning that even the term “right handed” has been used with conflicting rotation
conventions.
References
[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. NASA Technical Reports Server
[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.
License
Unless otherwise noted, this PhysicsLibrary entry is intended for release under the Creative
Commons Attribution–ShareAlike 4.0 International license.