Physics Library
 An open source physics library
Encyclopedia | Forums | Docs | Random | Template Test |  
Login
create new user
Username:
Password:
forget your password?
Main Menu
Sections

Meta

Talkback

Downloads

Information
composition of rotations and quaternion order (Definition)

Composition of Rotations and Quaternion Order

A single unit quaternion represents one spatial rotation. In applications, however, one usually performs successive rotations: a body is rotated by one command, then by another; one frame is related to a second, then that frame to a third; or one attitude update is followed by another. The central question is therefore not only how one quaternion rotates a vector, but also how several quaternion rotations compose.

This entry derives the composition law for active rotations, explains why the product order matters, connects quaternion chains to direction-cosine-matrix chains, and clarifies the intrinsic and extrinsic language commonly used in mechanics, robotics, and aerospace work.

Convention declaration

This article uses the PhysicsLibrary house convention:

  1. right-handed orthonormal frames;
  2. Hamilton multiplication, so $\mathbf i\mathbf j=\mathbf k$;
  3. scalar-first display notation,
    $\displaystyle q=q_w+q_x\mathbf i+q_y\mathbf j+q_z\mathbf k;$ (1)
  4. active vector rotation by a unit quaternion,
    $\displaystyle \boxed{\mathbf v'=q\mathbf v q^*.}$ (2)
When a software library stores components in scalar-last order $[q_x,q_y,q_z,q_w]^T$, the storage layout changes but the multiplication law and composition rules do not.

Successive active rotations

Let $q_1$ and $q_2$ be unit quaternions. Suppose that acts first on the vector $\mathbf v$, and then acts on the result. The intermediate vector is

$\displaystyle \mathbf v_1=q_1\mathbf v q_1^*,$ (3)
and the final vector is
$\displaystyle \mathbf v_2=q_2\mathbf v_1 q_2^*.$ (4)
Substituting equation (3) into equation (4) gives
$\displaystyle \mathbf v_2=q_2(q_1\mathbf v q_1^*)q_2^*.$ (5)
Associativity of quaternion multiplication allows the factors to be regrouped:
$\displaystyle \mathbf v_2=(q_2q_1)\mathbf v (q_1^*q_2^*).$ (6)
Because conjugation reverses order,
$\displaystyle (q_2q_1)^*=q_1^*q_2^*,$ (7)
so the final result can be written as
$\displaystyle \boxed{\mathbf v_2=(q_2q_1)\mathbf v (q_2q_1)^*.}$ (8)
Therefore the single unit quaternion equivalent to “first , then ” is
$\displaystyle \boxed{q_{\mathrm{net}}=q_2q_1.}$ (9)
This is the fundamental composition rule for active rotations in the PhysicsLibrary convention.

Why the order matters

Quaternion multiplication is associative but not commutative. Therefore,

$\displaystyle q_2q_1\neq q_1q_2$ (10)
in general. The corresponding finite rotations need not commute either. Changing the order changes the physical result.

A simple example uses two quarter-turns. Let

$\displaystyle q_x=\cos\frac{\pi}{4}+\mathbf i\sin\frac{\pi}{4} =\frac{1+\mathbf i}{\sqrt2}$ (11)
represent a $+90^\circ$ rotation about the $x$ axis, and let
$\displaystyle q_y=\cos\frac{\pi}{4}+\mathbf j\sin\frac{\pi}{4} =\frac{1+\mathbf j}{\sqrt2}$ (12)
represent a rotation about the $y$ axis.

For the initial vector $\mathbf v=\hat{\mathbf z}=\mathbf k$,

$\displaystyle q_y(q_x\mathbf k q_x^*)q_y^*=-\mathbf j,$ (13)
whereas
$\displaystyle q_x(q_y\mathbf k q_y^*)q_x^*=\mathbf i.$ (14)
Thus
$\displaystyle \boxed{q_yq_x\neq q_xq_y,}$ (15)
and the two orders send the same initial vector to different final vectors. Figure [*] illustrates this noncommutativity.
Figure: Composition of two active quarter-turn rotations. The initial vector is $\mathbf v=\hat{\mathbf z}$. Rotating first about and then about gives $-\hat{\mathbf y}$, while rotating first about and then about gives $\hat{\mathbf x}$. For active rotations the net quaternion is ordered in time as $q_{\mathrm{net}}=q_2q_1$, where acts first.
Image Composition of Rotations Order Matters

Relation to matrix composition

If $R(q)$ denotes the direction-cosine matrix corresponding to the active unit quaternion $q$, then

$\displaystyle \mathbf v'=R(q)\mathbf v.$ (16)
Applying and then gives
$\displaystyle \mathbf v_2=R(q_2)R(q_1)\mathbf v.$ (17)
Comparing equations (7) and (15), one obtains the homomorphism property
$\displaystyle \boxed{R(q_2q_1)=R(q_2)R(q_1).}$ (18)
Thus quaternion composition follows the same written order as active matrix composition: the factor nearest the vector acts first.

Intrinsic and extrinsic viewpoints

The same physical sequence can often be described in two ways.

Extrinsic rotations

An extrinsic description rotates an object about axes fixed in the reference frame. In this language, “rotate by about a fixed axis, then rotate by about another fixed axis” leads directly to .

Intrinsic rotations

An intrinsic description rotates an object about axes attached to the body after the previous rotations have occurred. The sequence of axis labels is then read in the moving frame. Intrinsic and extrinsic descriptions can denote the same overall orientation, but one must be precise about which frame each axis belongs to.

For quaternion algebra, the safest practice is to avoid relying only on the words intrinsic and extrinsic. Instead, write either the explicit active rotation chain or the explicit frame chain.

Frame-chain notation

For frame transformations it is helpful to write the source and target frames in the quaternion symbol. Let ${}^{A}q_B$ denote the unit quaternion that maps coordinates from frame $B$ to frame $A$. If a vector has coordinates ${}^{B}\mathbf v$ in frame , then

$\displaystyle {}^{A}\mathbf v={}^{A}q_B\,{}^{B}\mathbf v\,({}^{A}q_B)^*.$ (19)
If one then maps from frame to frame $N$, the second rotation is ${}^{N}q_A$, and the full chain is
$\displaystyle {}^{N}\mathbf v={}^{N}q_A\left({}^{A}q_B\,{}^{B}\mathbf v\,({}^{A}q_B)^*\right)({}^{N}q_A)^*.$ (20)
By the same regrouping argument used earlier,
$\displaystyle {}^{N}\mathbf v=\left({}^{N}q_A{}^{A}q_B\right){}^{B}\mathbf v\left({}^{N}q_A{}^{A}q_B\right)^*,$ (21)
so the frame-chain rule is
$\displaystyle \boxed{{}^{N}q_B={}^{N}q_A{}^{A}q_B.}$ (22)
This mirrors the familiar matrix relation $C^N_B=C^N_A C^A_B$.

Passive interpretation

In a passive interpretation one changes the coordinates used to describe the same geometric vector rather than physically rotating the vector itself. With PhysicsLibrary's active convention as primary, the passive change associated with is expressed by the inverse action,

$\displaystyle \boxed{\mathbf v_{\mathrm{passive}}=q^*\mathbf v q.}$ (23)
The active and passive viewpoints are equivalent descriptions of the same orientation change, but the order of factors and the meaning of the axis labels must be handled consistently.

A useful axis-angle composition formula

If

$\displaystyle q_1=a_1+\mathbf b_1, \qquad q_2=a_2+\mathbf b_2,$ (24)
with both quaternions unit, then their product is
$\displaystyle q_2q_1=\bigl(a_2a_1-\mathbf b_2\cdot\mathbf b_1\bigr) +\bigl(a_2\mathbf b_1+a_1\mathbf b_2+\mathbf b_2\times\mathbf b_1\bigr).$ (25)
Thus the composed axis-angle pair may be extracted from the scalar and vector parts of $q_2q_1$. There is no simple rule saying “add the axes” or “add the angles” except in special commuting cases such as repeated rotations about the same axis.

Special cases and checks

Several checks are worth memorizing.

  1. If $q_1=1$, then $q_{\mathrm{net}}=q_2$.
  2. If $q_2=1$, then $q_{\mathrm{net}}=q_1$.
  3. If and are rotations about the same axis,
    $\displaystyle q_2q_1=\cos\frac{\theta_1+\theta_2}{2}+\widehat{\mathbf u}\sin\frac{\theta_1+\theta_2}{2},$ (26)
    so the physical angles add.
  4. If $q_2=q_1^*$, then
    $\displaystyle q_2q_1=1,$ (27)
    so the second rotation exactly undoes the first.

Common pitfalls

The most common mistakes are:

  1. reversing the order and using $q_1q_2$ when the intended sequence is first , then ;
  2. mixing active and passive interpretations without inverting the quaternion;
  3. confusing scalar-first display with scalar-last storage;
  4. describing an intrinsic sequence but computing an extrinsic one;
  5. assuming finite rotations commute because small-angle infinitesimal rotations often appear to commute to first order.

What comes next

The next entry derives the direction-cosine matrix associated with a unit quaternion and shows how matrix and quaternion composition are related in component form.

Sources and historical notes

The active composition rule follows directly from quaternion associativity and conjugate order reversal. The engineer-facing convention discipline is closely aligned with the modern discussion by Sommer and coauthors on quaternion multiplication conventions and homomorphism properties. The use of frame-chain notation is also consistent with standard multibody and navigation practice.

License

This article is an original synthesis prepared for PhysicsLibrary and intended for release under CC BY-SA 4.0.



"composition of rotations and quaternion order" is owned by bloftin.
(view preamble)
View style:
Keywords:  quaternion, composition of rotations, rotation order, quaternion product, noncommutativity, active rotation, passive rotation, intrinsic rotations, extrinsic rotations, frame chain

Attachments:
example of composition of rotations and quaternion order (Example) by bloftin

Cross-references: scalar, relation, reference frame, matrix, commute, conjugation, quaternion multiplication, composition, work, mechanics, composition law, vector, quaternion
There is 1 reference to this object.

This is version 2 of composition of rotations and quaternion order, born on 2026-08-23, modified 2026-08-24.
Object id is 1099, canonical name is CompositionOfRotationsAndQuaternionOrder.
Accessed 19 times total.

Classification:
Physics Classification02.40.Yy (Geometric mechanics )
 02.10.Hh (Rings and algebras)
 45.40.-f (Dynamics and kinematics of rigid bodies)
Pending Errata and Addenda
None.
Discussion
Style: Expand: Order:

No messages.

Interact
rate | post | correct | update request | add derivation | add example | add (any)