<?xml version="1.0" encoding="UTF-8"?>

<record version="5" id="1089">
 <title>Quaternions for Physics and Engineering: Orientation, Notation, and Conventions</title>
 <name>NotationQuaternionsForPhysicsAndEngineeringOrientation</name>
 <created>2026-08-23 17:12:41</created>
 <modified>2026-08-28 16:51:53</modified>
 <type>Topic</type>
 <creator id="1" name="bloftin"/>
 <modifier id="1" name="bloftin"/>
 <author id="1" name="bloftin"/>
 <classification>
	<category scheme="pacs" code="02.10.Hh"/>
	<category scheme="pacs" code="02.40.Yy"/>
 </classification>
 <related>
	<object name="QuaternionSeriesOverviewAndArticleGuide"/>
	<object name="NotationQuaternionsForPhysicsAndEngineeringOrientation"/>
	<object name="QuaternionDefinitionAndBasicAlgebra"/>
	<object name="ExampleOfQuaternionDefinitionAndBasicAlgebra"/>
	<object name="QuaternionProduct"/>
	<object name="ExampleOfQuaternionProduct"/>
	<object name="QuaternionConjugate"/>
	<object name="ExampleOfQuaternionConjugate"/>
	<object name="QuaternionNorm"/>
	<object name="ExampleOfQuaternionNorm"/>
	<object name="QuaternionInverse"/>
	<object name="ExampleOfQuaternionInverse"/>
	<object name="AxisAngleRepresentationAndUnitQuaternion"/>
	<object name="ExampleOfAxisAngleRepresentationAndUnitQuaternion"/>
	<object name="RotatingVectorsWithQuaternions"/>
	<object name="ExampleOfRotatingVectorsWithQuaternions"/>
	<object name="CompositionOfRotationsAndQuaternionOrder"/>
	<object name="ExampleOfCompositionOfRotationsAndQuaternionOrder"/>
	<object name="QuaternionsAndDirectionCosineMatrices"/>
	<object name="ExampleOfQuaternionsAndDirectionCosineMatrices"/>
	<object name="QuaternionsAndEulerAngles"/>
	<object name="ExampleOfQuaternionsAndEulerAngles"/>
	<object name="QuaternionKinematicsAndAngularVelocity"/>
	<object name="ExampleOfQuaternionKinematicsAndAngularVelocity"/>
	<object name="RelativeAttitudeAndErrorQuaternions"/>
	<object name="ExampleOfRelativeAttitudeAndErrorQuaternions"/>
	<object name="NumericalQuaternionPropagationAndIMUAttitudeStateIntegration"/>
	<object name="ExampleOfNumericalQuaternionPropagationAndIMUAttitudeStateIntegration"/>
	<object name="QuaternionExercisesForPhysicsAndEngineering"/>
 </related>
 <preamble>% this is the default PhysicsLibrary preamble.  as your knowledge
% of TeX increases, you will probably want to edit this, but
% it should be fine as is for beginners.

% almost certainly you want these
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}

% used for TeXing text within eps files
%\usepackage{psfrag}
% need this for including graphics (\includegraphics)
%\usepackage{graphicx}
% for neatly defining theorems and propositions
%\usepackage{amsthm}
% making logically defined graphics
%\usepackage{xypic}

% there are many more packages, add them here as you need them

% define commands here</preamble>
 <content>\section*{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, \emph{passive frame to frame coordinate
transformations} as the primary attitude interpretation, and
\emph{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.

\section{The convention choices that must not be conflated}

A quaternion implementation normally makes several logically separate choices:

\begin{enumerate}
\item the quaternion multiplication law;
\item the ordering used to display or store the four components;
\item the handedness of the physical coordinate frames;
\item the sign convention for positive physical or frame rotation;
\item whether the operation is interpreted as an active vector rotation or a
      passive coordinate transformation;
\item the direction of a frame to frame coordinate transformation; and
\item for a sequence of rotations, whether the axes are intrinsic
      (moving axis) or extrinsic (fixed-axis).
\end{enumerate}

These choices are related in applications, but they are not identical.  In
particular, \emph{scalar first versus scalar last storage does not determine the
quaternion multiplication law}, and \emph{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.

\section{PhysicsLibrary convention contract}

Unless an article explicitly states otherwise, the PhysicsLibrary quaternion
series uses the following convention.

\begin{center}
\fbox{\begin{minipage}{0.94\linewidth}
\textbf{PhysicsLibrary quaternion convention}

\begin{enumerate}

\item Physical Cartesian frames are right handed orthonormal frames unless
      otherwise stated.

\item Positive frame rotation follows the usual right-hand screw rule.

\item Quaternion multiplication is Hamilton multiplication:
      \[
      \mathbf i\mathbf j=\mathbf k,\qquad
      \mathbf j\mathbf k=\mathbf i,\qquad
      \mathbf k\mathbf i=\mathbf j,
      \]
      with reversed products changing sign.

\item A quaternion is written scalar first,
      \[
      q=q_w+q_x\mathbf i+q_y\mathbf j+q_z\mathbf k
      \quad\longleftrightarrow\quad
      \begin{bmatrix}q_w&amp;q_x&amp;q_y&amp;q_z\end{bmatrix}^{T}.
      \]
      Software storage order is treated as a separate implementation detail and
      must be declared when code is discussed.

\item The canonical attitude quaternion is a \textbf{passive coordinate map}.
      The notation
      \[
      \boxed{{}^{B}q_A}
      \]
      means ``map coordinates from frame $A$ into frame $B$.''  A vector
      embedded as the pure quaternion $v=0+\mathbf v$ transforms according to
      \[
      \boxed{
      {}^{B}v
      =
      {}^{B}q_A\,{}^{A}v\,({}^{B}q_A)^*.
      }
      \]

\item If frame $B$ is obtained from frame $A$ by a positive right handed
      rotation of the axes through angle $\theta$ about unit axis
      $\hat{\mathbf u}$, then
      \[
      \boxed{
      {}^{B}q_A
      =
      \cos\frac{\theta}{2}
      -
      \hat{\mathbf u}\sin\frac{\theta}{2}.
      }
      \]
      The negative vector part is the passive counterpart of the usual
      positive angle active rotor.

\item Quaternion frame composition follows the same written order as passive
      direction cosine matrices.  If ${}^{B}q_A$ maps $A\to B$ and
      ${}^{C}q_B$ maps $B\to C$, then
      \[
      \boxed{
      {}^{C}q_A
      =
      {}^{C}q_B\,{}^{B}q_A.
      }
      \]

\item 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.

\end{enumerate}
\end{minipage}}
\end{center}

The corresponding passive direction cosine matrix uses the same frame labels:

\begin{equation}
\boxed{
{}^{B}\mathbf v
=
{}^{B}C_A\,{}^{A}\mathbf v.
}
\end{equation}

Thus the quaternion and matrix representations have the same map direction,

\begin{equation}
\boxed{
{}^{B}C_A=C({}^{B}q_A),
}
\end{equation}

and the same frame chain order,

\begin{equation}
\boxed{
{}^{C}C_A
=
{}^{C}C_B\,{}^{B}C_A.
}
\end{equation}

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.

\section{Quaternion algebra versus component storage}

A quaternion is an element of a four-dimensional real algebra,

\begin{equation}
q=q_w+q_x\mathbf i+q_y\mathbf j+q_z\mathbf k.
\end{equation}

The symbols $\mathbf i,\mathbf j,\mathbf k$ satisfy

\begin{equation}
\mathbf i^2=\mathbf j^2=\mathbf k^2
=\mathbf i\mathbf j\mathbf k=-1.
\end{equation}

Consequently,

\begin{equation}
\mathbf i\mathbf j=\mathbf k,
\qquad
\mathbf j\mathbf i=-\mathbf k,
\end{equation}

and similarly for cyclic permutations.  The product is therefore not
commutative.

The same quaternion may be stored in several array layouts.  For example,

\begin{equation}
q=0.9238795+0.3826834\,\mathbf k
\end{equation}

may be stored scalar first as

\begin{equation}
[\,0.9238795,\ 0,\ 0,\ 0.3826834\,]
\end{equation}

or scalar last as

\begin{equation}
[\,0,\ 0,\ 0.3826834,\ 0.9238795\,].
\end{equation}

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.

\section{Hamilton and flipped quaternion multiplication}

Let

\begin{equation}
p=(p_w,\mathbf p),\qquad q=(q_w,\mathbf q),
\end{equation}

where $\mathbf p$ and $\mathbf q$ denote the three component vector parts.
Hamilton multiplication is

\begin{equation}
\boxed{
(p_w,\mathbf p)(q_w,\mathbf q)
=
\left(
 p_wq_w-\mathbf p\cdot\mathbf q,\;
 p_w\mathbf q+q_w\mathbf p+\mathbf p\times\mathbf q
\right).
}
\end{equation}

The sign of the cross product term encodes the familiar Hamilton rule
$\mathbf i\mathbf j=\mathbf k$.

A second multiplication is common in parts of the spacecraft literature.  It
may be defined by reversing the Hamilton factors,

\begin{equation}
\boxed{
p\otimes q\equiv qp,
}
\end{equation}

where the product on the right is Hamilton multiplication.  This gives

\begin{equation}
(p_w,\mathbf p)\otimes(q_w,\mathbf q)
=
\left(
 p_wq_w-\mathbf p\cdot\mathbf q,\;
 p_w\mathbf q+q_w\mathbf p-\mathbf p\times\mathbf q
\right).
\end{equation}

Hence a rapid diagnostic is

\begin{equation}
\mathbf i\mathbf j=+\mathbf k
\quad\Longrightarrow\quad \text{Hamilton multiplication},
\end{equation}

whereas

\begin{equation}
\mathbf i\otimes\mathbf j=-\mathbf k
\quad\Longrightarrow\quad \text{flipped/Shuster multiplication}.
\end{equation}

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 \emph{frame} therefore uses the conjugate of the familiar
positive active rotor.

\subsection*{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 \emph{right handed} and
\emph{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:

\begin{equation}
\boxed{
\mathbf i\mathbf j=\mathbf k
\quad\text{for the PhysicsLibrary/Hamilton product}.
}
\end{equation}

Coordinate-frame handedness, positive frame rotation, and frame-map direction
are stated separately.

\section{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.

\subsection{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^{\circ}$ about $+\hat{\mathbf z}$.  The positive frame rotation is
represented by

\begin{equation}
{}^{B}q_A
=
\cos45^{\circ}
-\mathbf k\sin45^{\circ}
=
\frac{\sqrt2}{2}
-\frac{\sqrt2}{2}\mathbf k.
\end{equation}

The passive coordinate map is

\begin{equation}
\boxed{
{}^{B}v
=
{}^{B}q_A\,{}^{A}v\,({}^{B}q_A)^*.
}
\end{equation}

For a fixed physical vector whose $A$-coordinates are

\begin{equation}
{}^{A}\mathbf v=
\begin{bmatrix}
1\\0\\0
\end{bmatrix},
\end{equation}

the $B$-coordinates are

\begin{equation}
\boxed{
{}^{B}\mathbf v=
\begin{bmatrix}
0\\-1\\0
\end{bmatrix}.
}
\end{equation}

Nothing physical has rotated in this calculation.  The minus sign appears
because the new $B$ axes themselves have rotated positively relative to $A$.

\subsection{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

\begin{equation}
q_{\mathrm{act}}
=
\cos\frac{\theta}{2}
+\hat{\mathbf u}\sin\frac{\theta}{2}.
\end{equation}

It is the conjugate of the PhysicsLibrary passive frame quaternion:

\begin{equation}
\boxed{
q_{\mathrm{act}}
=
({}^{B}q_A)^*
}
\end{equation}

when $B$ is obtained from $A$ by the corresponding positive frame rotation.

The active sandwich is

\begin{equation}
v'
=
q_{\mathrm{act}}\,v\,q_{\mathrm{act}}^*.
\end{equation}

For $+90^{\circ}$ about $+\hat{\mathbf z}$,

\begin{equation}
q_{\mathrm{act}}
=
\frac{\sqrt2}{2}
+\frac{\sqrt2}{2}\mathbf k,
\end{equation}

so

\begin{equation}
\mathbf i\longrightarrow\mathbf j.
\end{equation}

Thus the passive coordinate transformation gives

\begin{equation}
\hat{\mathbf x}_A\longrightarrow-\hat{\mathbf y}_B
\end{equation}

for a fixed physical vector, while the corresponding active operation gives

\begin{equation}
\hat{\mathbf x}\longrightarrow+\hat{\mathbf y}
\end{equation}

in a fixed basis.

\subsection{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,

\begin{equation}
{}^{B}q_A
=
\cos\frac{\theta}{2}
-\hat{\mathbf u}\sin\frac{\theta}{2},
\end{equation}

while the positive active rotor has the positive vector part,

\begin{equation}
q_{\mathrm{act}}
=
\cos\frac{\theta}{2}
+\hat{\mathbf u}\sin\frac{\theta}{2}.
\end{equation}

For unit quaternions these are conjugates and inverses:

\begin{equation}
q_{\mathrm{act}}
=
({}^{B}q_A)^*
=
({}^{B}q_A)^{-1}.
\end{equation}

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.

\section{Frame direction, inverse maps, and composition}

Under the PhysicsLibrary convention,

\begin{equation}
{}^{B}q_A
\end{equation}

maps coordinate components from frame $A$ into frame $B$:

\begin{equation}
{}^{B}v
=
{}^{B}q_A\,{}^{A}v\,({}^{B}q_A)^*.
\end{equation}

The inverse map is represented by the conjugate:

\begin{equation}
\boxed{
{}^{A}q_B
=
({}^{B}q_A)^*.
}
\end{equation}

Indeed,

\begin{equation}
{}^{A}v
=
{}^{A}q_B\,{}^{B}v\,({}^{A}q_B)^*.
\end{equation}

Now let ${}^{B}q_A$ map $A\to B$, and let ${}^{C}q_B$ map $B\to C$.
Starting from a vector expressed in $A$,

\begin{equation}
{}^{B}v
=
{}^{B}q_A\,{}^{A}v\,({}^{B}q_A)^*,
\end{equation}

then

\begin{equation}
{}^{C}v
=
{}^{C}q_B\,{}^{B}v\,({}^{C}q_B)^*.
\end{equation}

Substitution gives

\begin{equation}
{}^{C}v
=
\left({}^{C}q_B{}^{B}q_A\right)
{}^{A}v
\left({}^{C}q_B{}^{B}q_A\right)^*.
\end{equation}

Therefore

\begin{equation}
\boxed{
{}^{C}q_A
=
{}^{C}q_B{}^{B}q_A.
}
\end{equation}

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:

\begin{equation}
\boxed{
{}^{C}C_A
=
{}^{C}C_B{}^{B}C_A.
}
\end{equation}

This same-order correspondence is one of the principal reasons for adopting
${}^{B}q_A$ as the canonical PhysicsLibrary attitude quaternion.

\section{Intrinsic rotation sequences}

A unit quaternion by itself represents a relative orientation; the words
\emph{intrinsic} and \emph{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,

\begin{enumerate}
\item the first rotation is about axis $i$ of the original frame;
\item the second rotation is about axis $j$ of the first intermediate frame;
\item the third rotation is about axis $k$ of the second intermediate frame.
\end{enumerate}

Let the first, second, and third positive frame rotations be
$\alpha,\beta,\gamma$.  Define passive elementary quaternions

\begin{equation}
q_i^P(\alpha)
=
\cos\frac{\alpha}{2}
-\mathbf e_i\sin\frac{\alpha}{2},
\end{equation}

and similarly for $q_j^P(\beta)$ and $q_k^P(\gamma)$.

Successive passive frame chaining gives

\begin{equation}
\boxed{
{}^{B}q_A
=
q_k^P(\gamma)\,
q_j^P(\beta)\,
q_i^P(\alpha).
}
\end{equation}

The corresponding direction cosine matrix is

\begin{equation}
\boxed{
{}^{B}C_A
=
C_k(\gamma)\,
C_j(\beta)\,
C_i(\alpha).
}
\end{equation}

Thus the quaternion and matrix products have exactly the same factor order.

For the common intrinsic $3$--$2$--$1$ yaw--pitch--roll sequence,

\begin{equation}
\psi=\text{yaw},
\qquad
\theta=\text{pitch},
\qquad
\phi=\text{roll},
\end{equation}

and therefore

\begin{equation}
\boxed{
{}^{B}q_A
=
q_1^P(\phi)\,
q_2^P(\theta)\,
q_3^P(\psi),
}
\end{equation}

matching

\begin{equation}
\boxed{
{}^{B}C_A
=
C_1(\phi)\,
C_2(\theta)\,
C_3(\psi).
}
\end{equation}

This is the convention shared by the cleaned-up PhysicsLibrary quaternion and
Euler angle series.

\section{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,

\begin{equation}
q_{\mathrm{act}}
=
\cos\frac{\theta}{2}
+\hat{\mathbf u}\sin\frac{\theta}{2},
\end{equation}

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

\begin{equation}
C(pq)=C(q)C(p).
\end{equation}

The quaternion factor order is then reversed relative to the corresponding
passive matrix product.

Shuster advocated a flipped multiplication,

\begin{equation}
p\otimes q\equiv qp,
\end{equation}

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:

\begin{equation}
{}^{B}q_A
=
\cos\frac{\theta}{2}
-\hat{\mathbf u}\sin\frac{\theta}{2}.
\end{equation}

Its sandwich matrix is defined directly as

\begin{equation}
{}^{B}C_A=C({}^{B}q_A),
\end{equation}

and Hamilton multiplication is then homomorphic with passive matrix
composition:

\begin{equation}
\boxed{
C(pq)=C(p)C(q)
}
\end{equation}

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:

\begin{quote}
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.
\end{quote}

\section{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:

\begin{enumerate}
\item Are the physical coordinate frames right handed or left handed?
\item What is the positive sense of frame rotation?
\item Is $\mathbf i\mathbf j=+\mathbf k$ or $-\mathbf k$?
\item Is the scalar component displayed or stored first or last?
\item What does the frame notation ${}^{B}q_A$ mean?
\item Does the quaternion map $A$ coordinates to $B$ coordinates, or the
      reverse?
\item Is the equation describing an active vector rotation or a passive
      coordinate change?
\item What sign is used in the positive axis-angle quaternion?
\item What is the quaternion to matrix relationship?
\item In a frame chain product $q_2q_1$, which coordinate transformation occurs
      first?
\item If Euler or other named rotations are used, are the axes intrinsic or
      extrinsic?
\end{enumerate}

If these questions are answered, most apparent quaternion disagreements become
simple conversion problems.

\section{Worked example 1: storage order is not multiplication convention}

Suppose a software library documents a quaternion as

\begin{equation}
[q_x,q_y,q_z,q_w]
\end{equation}

and also states

\begin{equation}
\mathbf i\mathbf j=\mathbf k.
\end{equation}

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 \emph{scalar last Hamilton}, not automatically a
flipped or JPL multiplication implementation.

Now consider a positive $45^{\circ}$ rotation of frame $B$ relative to frame
$A$ about $+z$.  Under the PhysicsLibrary passive convention,

\begin{equation}
{}^{B}q_A
=
\cos22.5^{\circ}
-\mathbf k\sin22.5^{\circ}.
\end{equation}

PhysicsLibrary displays this scalar first as

\begin{equation}
[\,0.9238795,\ 0,\ 0,\ -0.3826834\,],
\end{equation}

whereas the hypothetical scalar last library stores the same Hamilton
quaternion as

\begin{equation}
[\,0,\ 0,\ -0.3826834,\ 0.9238795\,].
\end{equation}

Only the component layout has changed.

\section{Worked example 2: passive and active signs}

Consider again a $+90^{\circ}$ rotation about $+z$.

For the PhysicsLibrary passive frame transformation,

\begin{equation}
{}^{B}q_A
=
\frac{\sqrt2}{2}
-\frac{\sqrt2}{2}\mathbf k,
\end{equation}

and a fixed physical vector transforms in coordinates as

\begin{equation}
\begin{bmatrix}
1\\0\\0
\end{bmatrix}_{A}
\longrightarrow
\begin{bmatrix}
0\\-1\\0
\end{bmatrix}_{B}.
\end{equation}

The corresponding positive active rotor is the conjugate,

\begin{equation}
q_{\mathrm{act}}
=
({}^{B}q_A)^*
=
\frac{\sqrt2}{2}
+\frac{\sqrt2}{2}\mathbf k,
\end{equation}

and it sends

\begin{equation}
\hat{\mathbf x}\longrightarrow\hat{\mathbf y}
\end{equation}

in a fixed frame.

The opposite signs are not contradictory.  One operation rotates the basis;
the other rotates the physical vector.

\section{Worked example 3: detecting the multiplication convention}

An unfamiliar source gives the basis products

\begin{equation}
\mathbf i\star\mathbf j=-\mathbf k,
\qquad
\mathbf j\star\mathbf k=-\mathbf i,
\qquad
\mathbf k\star\mathbf i=-\mathbf j.
\end{equation}

The vector cross product term has the opposite sign from the Hamilton product.
Therefore $\star$ 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.

\section{Worked example 4: intrinsic $3$--$2$--$1$ composition}

Suppose frame $B$ is obtained from frame $A$ by the intrinsic sequence

\begin{equation}
\text{yaw }\psi
\quad\longrightarrow\quad
\text{pitch }\theta
\quad\longrightarrow\quad
\text{roll }\phi.
\end{equation}

The passive elementary frame quaternions are

\begin{equation}
q_3^P(\psi)
=
\cos\frac{\psi}{2}
-\mathbf k\sin\frac{\psi}{2},
\end{equation}

\begin{equation}
q_2^P(\theta)
=
\cos\frac{\theta}{2}
-\mathbf j\sin\frac{\theta}{2},
\end{equation}

and

\begin{equation}
q_1^P(\phi)
=
\cos\frac{\phi}{2}
-\mathbf i\sin\frac{\phi}{2}.
\end{equation}

The coordinate maps chain as

\begin{equation}
A\to A_1\to A_2\to B,
\end{equation}

so

\begin{equation}
\boxed{
{}^{B}q_A
=
q_1^P(\phi)
q_2^P(\theta)
q_3^P(\psi).
}
\end{equation}

The factor order is identical to the passive intrinsic DCM,

\begin{equation}
{}^{B}C_A
=
C_1(\phi)C_2(\theta)C_3(\psi).
\end{equation}

\section{Common pitfalls}

\begin{enumerate}

\item \textbf{Assuming scalar last means JPL.}
It does not.  Storage order and multiplication are independent choices.

\item \textbf{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.

\item \textbf{Calling a formula active or passive without naming the frames.}
A quaternion value alone does not determine the interpretation.

\item \textbf{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.

\item \textbf{Reversing frame labels without conjugating the quaternion.}
Under the PhysicsLibrary convention,
\[
{}^{A}q_B=({}^{B}q_A)^*.
\]

\item \textbf{Copying a quaternion-to-DCM equation without its convention.}
A transpose may represent the same physical orientation under the opposite
mapping direction.

\item \textbf{Assuming ``right handed quaternion'' is unambiguous.}
The phrase has been used for different algebraic, coordinate, and screw sense
conventions.

\item \textbf{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.

\item \textbf{Calling a $3$--$2$--$1$ sequence complete without saying
intrinsic or extrinsic.}
PhysicsLibrary uses intrinsic moving axis sequences by default.

\item \textbf{Forgetting the double representation.}
The unit quaternions $q$ and $-q$ represent the same proper frame
transformation.

\end{enumerate}

\section{Exercises}

\begin{enumerate}

\item A library stores quaternions as $[q_x,q_y,q_z,q_w]$ and reports
      $\mathbf i\mathbf j=\mathbf k$.  Identify the component order and the
      multiplication convention.

\item A second library stores $[q_w,q_x,q_y,q_z]$ but reports
      $\mathbf i\star\mathbf j=-\mathbf k$.  Is it Hamilton multiplication?
      Does scalar first storage change your answer?

\item Frame $B$ is obtained from frame $A$ by a positive $90^{\circ}$ rotation
      about $+z$.  Write ${}^{B}q_A$ under the PhysicsLibrary passive
      convention and use it to determine the $B$-coordinates of a fixed vector
      whose $A$-coordinates are $\hat{\mathbf x}$.

\item For the situation in Exercise 3, write the corresponding positive active
      rotor.  What does it do to $\hat{\mathbf x}$ in a fixed frame?

\item Show directly that replacing ${}^{B}q_A$ by $-{}^{B}q_A$ in the passive
      coordinate law does not change ${}^{B}v$.

\item Suppose ${}^{B}q_A$ maps $A$ coordinates to $B$ coordinates and
      ${}^{C}q_B$ maps $B$ coordinates to $C$ coordinates.  Derive the
      quaternion that maps $A$ coordinates directly to $C$ coordinates.

\item Write the passive intrinsic $3$--$2$--$1$ yaw--pitch--roll quaternion
      product using $\psi$ for yaw, $\theta$ for pitch, and $\phi$ for roll.

\end{enumerate}

\section{Solutions}

\subsection*{1. Scalar-last Hamilton}

The array order $[q_x,q_y,q_z,q_w]$ is scalar last.  The defining product

\begin{equation}
\mathbf i\mathbf j=\mathbf k
\end{equation}

identifies Hamilton multiplication.  The two facts are independent.

\subsection*{2. Scalar-first flipped multiplication}

The array is scalar first.  Since

\begin{equation}
\mathbf i\star\mathbf j=-\mathbf k,
\end{equation}

the multiplication is the flipped convention relative to Hamilton
multiplication.  Scalar-first storage does not alter this conclusion.

\subsection*{3. Positive passive $90^{\circ}$ frame rotation}

For a positive rotation of frame $B$ relative to $A$ about $+z$,

\begin{equation}
{}^{B}q_A
=
\cos45^{\circ}
-\mathbf k\sin45^{\circ}
=
\frac{\sqrt2}{2}
-\frac{\sqrt2}{2}\mathbf k.
\end{equation}

Applying

\begin{equation}
{}^{B}v
=
{}^{B}q_A\,{}^{A}v\,({}^{B}q_A)^*
\end{equation}

to ${}^{A}v=\mathbf i$ gives

\begin{equation}
{}^{B}v=-\mathbf j.
\end{equation}

Thus

\begin{equation}
\boxed{
\begin{bmatrix}1\\0\\0\end{bmatrix}_{A}
\longrightarrow
\begin{bmatrix}0\\-1\\0\end{bmatrix}_{B}.
}
\end{equation}

\subsection*{4. Corresponding active rotor}

The positive active rotor is the conjugate:

\begin{equation}
q_{\mathrm{act}}
=
({}^{B}q_A)^*
=
\frac{\sqrt2}{2}
+\frac{\sqrt2}{2}\mathbf k.
\end{equation}

Therefore

\begin{equation}
q_{\mathrm{act}}\mathbf i q_{\mathrm{act}}^*
=
\mathbf j.
\end{equation}

It rotates the physical vector from $+\hat{\mathbf x}$ to
$+\hat{\mathbf y}$ in a fixed frame.

\subsection*{5. The sign of a unit quaternion does not change the passive map}

Using $(-q)^*=-q^*$,

\begin{equation}
(-q)v(-q)^*
=
(-q)v(-q^*)
=
qvq^*.
\end{equation}

Thus $q$ and $-q$ generate the same passive coordinate transformation.

\subsection*{6. Frame-chain composition}

Apply the $A$-to-$B$ map first and the $B$-to-$C$ map second:

\begin{equation}
{}^{C}v
=
{}^{C}q_B
\left(
{}^{B}q_A{}^{A}v({}^{B}q_A)^*
\right)
({}^{C}q_B)^*.
\end{equation}

Associativity gives

\begin{equation}
{}^{C}v
=
\left({}^{C}q_B{}^{B}q_A\right)
{}^{A}v
\left({}^{C}q_B{}^{B}q_A\right)^*.
\end{equation}

Therefore

\begin{equation}
\boxed{
{}^{C}q_A
=
{}^{C}q_B{}^{B}q_A.
}
\end{equation}

\subsection*{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

\begin{equation}
q_3^P(\psi)
=
\cos\frac{\psi}{2}
-\mathbf k\sin\frac{\psi}{2},
\end{equation}

\begin{equation}
q_2^P(\theta)
=
\cos\frac{\theta}{2}
-\mathbf j\sin\frac{\theta}{2},
\end{equation}

and

\begin{equation}
q_1^P(\phi)
=
\cos\frac{\phi}{2}
-\mathbf i\sin\frac{\phi}{2}.
\end{equation}

Frame chaining gives

\begin{equation}
\boxed{
{}^{B}q_A
=
q_1^P(\phi)
q_2^P(\theta)
q_3^P(\psi).
}
\end{equation}

This has the same factor order as

\begin{equation}
{}^{B}C_A
=
C_1(\phi)C_2(\theta)C_3(\psi).
\end{equation}

\section{Relation to later PhysicsLibrary entries}

This entry deliberately stops before developing the quaternion algebra and
application formulas in full.  The subsequent sequence derives:

\begin{enumerate}
\item quaternion definition and elementary algebra;
\item scalar--vector form of the Hamilton product;
\item conjugate, norm, and inverse;
\item passive axis angle and unit quaternions;
\item passive coordinate transformations with quaternions;
\item composition of finite frame transformations;
\item quaternion DCM conversion;
\item passive intrinsic quaternion Euler angle conversion;
\item quaternion kinematics and angular velocity;
\item relative attitude and error quaternions;
\item numerical propagation and normalization;
\item a consolidated engineering exercise set with complete solutions.
\end{enumerate}

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.

\section{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.

\begin{thebibliography}{9}

\bibitem{Sommer2018}
H. Sommer, I. Gilitschenski, M. Bloesch, S. Weiss, R. Siegwart, and J. Nieto,
``Why and How to Avoid the Flipped Quaternion Multiplication,''
\emph{Aerospace}, vol. 5, no. 3, article 72, 2018.
DOI: 10.3390/aerospace5030072.  Published under CC BY 4.0.
\PMlinkexternal{Publisher article}{https://www.mdpi.com/2226-4310/5/3/72}

\bibitem{Shuster2008}
M. D. Shuster,
``The Nature of the Quaternion,''
\emph{The Journal of the Astronautical Sciences}, vol. 56, no. 3,
pp. 359--373, 2008.
DOI: 10.1007/BF03256558.
\PMlinkexternal{Author-hosted manuscript}
{https://malcolmdshuster.com/Pubp_021_072x_J_JAS0000_quat_MDS.pdf}

\bibitem{Moore2026}
J. K. Moore,
\emph{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.
\PMlinkexternal{Learn Multibody Dynamics}
{https://moorepants.github.io/learn-multibody-dynamics/}

\bibitem{Henderson1977}
D. M. Henderson,
\emph{Euler Angles, Quaternions, and Transformation Matrices---Working Relationships},
JSC-12960, NASA Johnson Space Center, Mission Planning and Analysis Division,
July 1977.
\PMlinkexternal{NASA Technical Reports Server}
{https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19770024290.pdf}

\bibitem{Joly1905}
C. J. Joly,
\emph{A Manual of Quaternions}, Macmillan and Co., London, 1905.
Public-domain historical source.

\bibitem{Hamilton1899}
W. R. Hamilton,
\emph{Elements of Quaternions}, 2nd ed., edited by C. J. Joly,
Longmans, Green, and Co., 1899.
Public-domain historical source.

\end{thebibliography}

\section*{License}

Unless otherwise noted, this PhysicsLibrary entry is intended for release under
the Creative Commons Attribution--ShareAlike 4.0 International license.</content>
</record>
