Book contents
Contents
raw Math
RAW Book Geometry Rotations

Introduction to Quaternion Derivatives

Robert Eisele

The expression quaternion derivative is ambiguous. It can mean the velocity of a quaternion-valued curve, the relation between an orientation quaternion and physical angular velocity, or the Jacobian of a function with respect to four quaternion components. These objects are related, but they are not interchangeable. The distinction between them is the key to deriving the formulas rather than memorizing them.

The algebra of quaternions and the geometry of the quaternion sandwich product are developed separately in quaternions and rotations with complex numbers and quaternions. Here the focus is differential: how an orientation moves, how rates are integrated, and how rotation functions are linearized for optimization and state estimation.

Three Different Derivative Questions

A Time Derivative in Four-Dimensional Space

If

\[\mathbf{q}(t)=w(t)+x(t)\mathbf{i}+y(t)\mathbf{j}+z(t)\mathbf{k},\]

then \(\mathbf{q}\) is a curve in the four-dimensional real vector space \(\mathbb{H}\cong\mathbb{R}^4\). Its derivative is the ordinary limit

\[\dot{\mathbf{q}}(t)=\lim_{h\to0}\frac{\mathbf{q}(t+h)-\mathbf{q}(t)}{h}.\]

No rotation assumption is needed for this definition.

Orientation Kinematics

If \(\mathbf{q}(t)\) has unit length and represents a rigid-body orientation, its four coordinate rates cannot vary independently. The physical velocity is a three-dimensional angular-velocity vector \(\boldsymbol{\omega}\). The problem is to determine how those three numbers produce the four components of \(\dot{\mathbf{q}}\), and why the answer depends on the frame in which \(\boldsymbol{\omega}\) is expressed.

Differentiation with Respect to a Quaternion

An expression such as \(\partial f/\partial\mathbf{q}\) normally means the real Fréchet derivative after identifying \(\mathbf{q}\) with \((w,x,y,z)^T\). It is a Jacobian matrix. When \(\mathbf{q}\) must remain a unit quaternion, however, the physically meaningful differential has only three tangent directions.

Central distinction. The quantity \(\dot{\mathbf{q}}\) is a four-component tangent vector; \(\boldsymbol{\omega}\) is a three-component physical vector. They carry the same instantaneous rotational information only after a frame convention and a multiplication side have been specified.

Conventions and Algebra

Every sign and multiplication order in quaternion kinematics depends on conventions. The following derivations use Hamilton multiplication, scalar-first components, active rotations, right-handed frames, column vectors, and the frame notation of McKerrow. Let \(W\) be the fixed world frame and \(B\) the moving body frame. A left superscript states the frame in which a vector is resolved, while the right subscript on a transformation states its source frame:

\[{}^{W}\mathbf{a}={}^{W}\mathbf{T}_{B}\,{}^{B}\mathbf{a}.\]

Thus \({}^{W}\mathbf{T}_{B}\) is a general transformation from coordinates in \(B\) to coordinates in \(W\). Its rotational part is represented here by the unit quaternion \({}^{W}\mathbf{q}_{B}\in S^3\). To apply it by Hamilton multiplication, embed a three-vector into the pure quaternions:

\[\iota_{\mathbb H}:\mathbb{R}^3\longrightarrow\mathbb{H}, \qquad {}^{W}\mathbf{a}^{\mathbb H}:=\iota_{\mathbb H}({}^{W}\mathbf{a}) =(0,{}^{W}\mathbf{a}).\]

The superscript \(\mathbb H\) identifies the pure-quaternion embedding; it is not a frame index. The coordinate transformation then expands to the sandwich

\[{}^{W}\mathbf{a}^{\mathbb H} ={}^{W}\mathbf{q}_{B}\otimes{}^{B}\mathbf{a}^{\mathbb H} \otimes\overline{{}^{W}\mathbf{q}_{B}}.\]

When no ambiguity is possible, \(\mathbf{q}:={}^{W}\mathbf{q}_{B}\) abbreviates the orientation quaternion. The symbol \(\otimes\) denotes Hamilton quaternion multiplication and distinguishes it from matrix, scalar, and frame-coordinate multiplication.

Subscripts are omitted once the convention is clear. For \(\mathbf{p}=(p_0,\mathbf{p}_v)\) and \(\mathbf{q}=(q_0,\mathbf{q}_v)\), Hamilton multiplication is

\[\boxed{ \mathbf{p}\otimes\mathbf{q} =\left( p_0q_0-\mathbf{p}_v\cdot\mathbf{q}_v, \ p_0\mathbf{q}_v+q_0\mathbf{p}_v+\mathbf{p}_v\times\mathbf{q}_v \right).}\]

The cross product makes multiplication noncommutative. Factor order must therefore remain unchanged in every product rule. Conjugation, norm, and inverse are

\[\overline{\mathbf{q}}=(w,-\mathbf{q}_v), \qquad \lVert\mathbf{q}\rVert^2=\mathbf{q}\otimes\overline{\mathbf{q}} =\overline{\mathbf{q}}\otimes\mathbf{q}, \qquad \mathbf{q}^{-1}=\frac{\overline{\mathbf{q}}}{\lVert\mathbf{q}\rVert^2}.\]

The cross-product matrix is defined by

\[[\mathbf{a}]_\times= \begin{bmatrix} 0&-a_z&a_y\\a_z&0&-a_x\\-a_y&a_x&0 \end{bmatrix}, \qquad [\mathbf{a}]_\times\mathbf{b}=\mathbf{a}\times\mathbf{b}.\]

The skew-symmetric matrix \([\mathbf{a}]_\times\) is the linear operator take the cross product with \(\mathbf{a}\). Left-multiplying a rotation matrix gives \([\mathbf{a}]_\times\mathbf{R}\): each column of \(\mathbf{R}\) is crossed with \(\mathbf{a}\), so the whole frame is instantaneously rotated about the axis \(\mathbf{a}\). Right-multiplying gives \(\mathbf{R}[\mathbf{b}]_\times\): the same infinitesimal rotation is resolved along the rotating frame's own axes.

Left and Right Multiplication Matrices

Writing a quaternion as its four-component column vector turns multiplication by a fixed quaternion into a matrix operation:

\[\mathcal{L}(\mathbf{q})= \begin{bmatrix} w&-\mathbf{q}_v^T\\ \mathbf{q}_v&w\mathbf{I}+[\mathbf{q}_v]_\times \end{bmatrix}, \qquad \mathcal{R}(\mathbf{q})= \begin{bmatrix} w&-\mathbf{q}_v^T\\ \mathbf{q}_v&w\mathbf{I}-[\mathbf{q}_v]_\times \end{bmatrix}.\]

Consequently,

\[\mathbf{q}\otimes\mathbf{p}=\mathcal{L}(\mathbf{q})\mathbf{p} =\mathcal{R}(\mathbf{p})\mathbf{q}.\]

The matrix multiplying the component vector of \(\mathbf{q}\) is named after the factor held fixed, not after the side on which the matrix appears.

The Ordinary Time Derivative

Because the basis \(1,\mathbf{i},\mathbf{j},\mathbf{k}\) is constant, differentiation is componentwise:

\[\boxed{ \dot{\mathbf{q}} =\dot w+\dot x\mathbf{i}+\dot y\mathbf{j}+\dot z\mathbf{k} \ \longleftrightarrow\ \begin{bmatrix}\dot w\\\dot x\\\dot y\\\dot z\end{bmatrix}.}\]

This applies to every quaternion curve, including curves that change norm and therefore do not represent orientations. Linearity is unchanged. The product rule retains its familiar form but preserves order:

\[\frac{d}{dt}(\mathbf{p}\otimes\mathbf{q}) =\dot{\mathbf{p}}\otimes\mathbf{q}+\mathbf{p}\otimes\dot{\mathbf{q}}.\]

In general, \(d(\mathbf{q}\otimes\mathbf{q})/dt\) is not \(2\mathbf{q}\otimes\dot{\mathbf{q}}\), because \(\mathbf{q}\otimes\dot{\mathbf{q}}\) and \(\dot{\mathbf{q}}\otimes\mathbf{q}\) need not agree. Conjugation commutes with the derivative:

\[\frac{d}{dt}\overline{\mathbf{q}}=\overline{\dot{\mathbf{q}}}.\]

Differentiating \(\mathbf{q}\otimes\mathbf{q}^{-1}=1\) gives the noncommutative inverse rule

\[\boxed{ \frac{d}{dt}\mathbf{q}^{-1} =-\mathbf{q}^{-1}\otimes\dot{\mathbf{q}}\otimes\mathbf{q}^{-1}.}\]

Norm Derivative

Viewing quaternions as vectors in \(\mathbb{R}^4\),

\[\frac{d}{dt}\lVert\mathbf{q}\rVert^2=2\mathbf{q}^T\dot{\mathbf{q}}, \qquad \frac{d}{dt}\lVert\mathbf{q}\rVert =\frac{\mathbf{q}^T\dot{\mathbf{q}}}{\lVert\mathbf{q}\rVert} \quad(\mathbf{q}\ne0).\]

The scalar part of \(\dot{\mathbf{q}}\otimes\overline{\mathbf{q}}\) is the same dot product \(\mathbf{q}^T\dot{\mathbf{q}}\). Radial motion in \(\mathbb{R}^4\) is therefore detected algebraically as a scalar component.

Unit Quaternions: The Derivative Is Tangential

The orientation quaternion \(\mathbf{q}={}^{W}\mathbf{q}_{B}\) satisfies \(\mathbf{q}^T\mathbf{q}=1\). Differentiating the constraint gives

\[\boxed{\mathbf{q}^T\dot{\mathbf{q}}=0}.\]

Thus \(\dot{\mathbf{q}}\) is perpendicular to \(\mathbf{q}\) in \(\mathbb{R}^4\). The unit quaternions form the three-sphere

\[S^3=\{\mathbf{q}\in\mathbb{R}^4:\mathbf{q}^T\mathbf{q}=1\}, \qquad T_{\mathbf{q}}S^3 =\{\boldsymbol{\eta}\in\mathbb{R}^4:\mathbf{q}^T\boldsymbol{\eta}=0\}.\]

The derivative has four components but only three independent degrees of freedom because it lies in the three-dimensional tangent space \(T_{\mathbf{q}}S^3\).

A unit-quaternion curve remains on \(S^3\), represented here by a two-dimensional slice. Its derivative lies in the tangent space and is perpendicular to the radial quaternion. A radial perturbation changes norm rather than orientation.

Normalization as Tangent Projection

If an unconstrained four-vector \(\widetilde{\mathbf{q}}\), meaning four freely varying real components not yet required to have unit length, is normalized by \(\mathbf{q}=\widetilde{\mathbf{q}}/\lVert\widetilde{\mathbf{q}}\rVert\), then

\[\boxed{ \dot{\mathbf{q}} =\frac{1}{\lVert\widetilde{\mathbf{q}}\rVert} (\mathbf{I}_4-\mathbf{q}\mathbf{q}^T)\dot{\widetilde{\mathbf{q}}}.}\]

The projector \(\mathbf{I}_4-\mathbf{q}\mathbf{q}^T\) removes the radial component and retains the tangent component.

Half Angle and Infinitesimal Rotations

A physical rotation through angle \(\theta\) about the unit axis \(\mathbf{u}\) is represented by

\[\mathbf{q}(\theta,\mathbf{u}) =\left(\cos\frac{\theta}{2},\mathbf{u}\sin\frac{\theta}{2}\right) =\exp\!\left(\frac{1}{2}(0,\theta\mathbf{u})\right).\]

For an infinitesimal physical rotation vector \(d\boldsymbol{\theta}=\mathbf{u}\,d\theta\), Taylor expansion gives

\[d\mathbf{q}_{\mathrm{rot}} =\exp\!\left(\frac{1}{2}(0,d\boldsymbol{\theta})\right) =\left(1,\frac{1}{2}d\boldsymbol{\theta}\right) +O(\lVert d\boldsymbol{\theta}\rVert^2).\]

The factor \(1/2\) is not inserted later to repair the kinematic equation. It is already present in the local map from physical rotation angle to the unit-quaternion sphere.

A physical angular increment \(d\theta\) lifts to a displacement of half that angle on the unit-quaternion great circle. This geometric relation produces every factor \(1/2\) in quaternion kinematics.

Exponential, Logarithm, and Double Cover

For the pure quaternion \(\boldsymbol{\Phi}=(0,\boldsymbol{\phi})\), with \(\theta=\lVert\boldsymbol{\phi}\rVert\),

\[\exp\!\left(\frac{1}{2}\boldsymbol{\Phi}\right) =\left(\cos\frac{\theta}{2}, \frac{\boldsymbol{\phi}}{\theta}\sin\frac{\theta}{2}\right).\]

Conversely, for \(\mathbf{q}=(w,\mathbf{q}_v)\) on a chosen continuous branch, define the pure-vector half-angle by

\[\operatorname{Log}(\mathbf{q}) =\frac{\operatorname{atan2}(\lVert\mathbf{q}_v\rVert,w)}{\lVert\mathbf{q}_v\rVert}\mathbf{q}_v.\]

The physical rotation vector is \(2\operatorname{Log}(\mathbf{q})\). Changing \(\mathbf{q}\) to \(-\mathbf{q}\) leaves the sandwich unchanged:

\[(-\mathbf{q})\otimes\mathbf{r}^{\mathbb H}\otimes\overline{(-\mathbf{q})} =\mathbf{q}\otimes\mathbf{r}^{\mathbb H}\otimes\overline{\mathbf{q}}.\]

A physical \(2\pi\) turn moves a continuous quaternion curve from \(+1\) to \(-1\); only a \(4\pi\) turn returns it to \(+1\). This two-to-one map \(S^3\to SO(3)\) is the source of the sign-continuity rule needed for sampled data.

Angular Velocity Resolved in \(B\) and \(W\)

Angular velocity is one physical vector with two coordinate descriptions. Embed its components as the pure quaternions

\[{}^{B}\boldsymbol{\Omega}=(0,{}^{B}\boldsymbol{\omega}), \qquad {}^{W}\boldsymbol{\Omega}=(0,{}^{W}\boldsymbol{\omega}).\]

Because \(\mathbf{q}={}^{W}\mathbf{q}_{B}\) maps \(B\)-coordinates into \(W\)-coordinates,

\[\boxed{{}^{W}\boldsymbol{\Omega} =\mathbf{q}\otimes{}^{B}\boldsymbol{\Omega}\otimes\overline{\mathbf{q}}}, \qquad \boxed{{}^{W}\boldsymbol{\omega} ={}^{W}\mathbf{R}_{B}\,{}^{B}\boldsymbol{\omega}},\]

where \({}^{W}\mathbf{R}_{B}=\mathbf{R}(\mathbf{q})\) is the corresponding \(3\times3\) rotation matrix. During a short interval \(dt\), the increment resolved about the moving \(B\)-axes is

\[{}^{B}\delta\mathbf{q} =\exp\!\left(\frac{dt}{2}{}^{B}\boldsymbol{\Omega}\right) =1+\frac{dt}{2}{}^{B}\boldsymbol{\Omega}+O(dt^2).\]

An increment resolved in \(B\) acts before the existing \(B\)-to-\(W\) map and is attached on the right:

\[\mathbf{q}(t+dt)=\mathbf{q}(t)\otimes{}^{B}\delta\mathbf{q}.\]

The same increment resolved about the fixed reference axes acts after the existing map and is attached on the left:

\[\mathbf{q}(t+dt)={}^{W}\delta\mathbf{q}\otimes\mathbf{q}(t).\]

Subtracting \(\mathbf{q}(t)\), dividing by \(dt\), and taking the limit gives the two fundamental equations

\[\boxed{\dot{\mathbf{q}}=\frac{1}{2}\mathbf{q}\otimes{}^{B}\boldsymbol{\Omega}}, \qquad \boxed{\dot{\mathbf{q}}=\frac{1}{2}{}^{W}\boldsymbol{\Omega}\otimes\mathbf{q}}.\]

An increment resolved in \(B\) multiplies on the right; the same increment resolved in \(W\) multiplies on the left. The two updates are equivalent when \({}^{W}\delta\mathbf{q}=\mathbf{q}\otimes{}^{B}\delta\mathbf{q}\otimes\overline{\mathbf{q}}\).

Convention dependence. Passive rotations, the inverse mapping, scalar-last storage, or a non-Hamilton product can change signs and multiplication sides. A remembered formula is safe only after its convention has been stated.

Derivation from a Rotated Vector

Let the vector be fixed in \(B\), so that its pure-quaternion representation is \({}^{B}\mathbf{r}^{\mathbb H}=(0,{}^{B}\mathbf{r})\). Its representation in \(W\) is

\[{}^{W}\mathbf{r}^{\mathbb H} =\mathbf{q}\otimes{}^{B}\mathbf{r}^{\mathbb H}\otimes\overline{\mathbf{q}}.\]

Since \({}^{B}\dot{\mathbf{r}}^{\mathbb H}=0\), the product rule gives

\[{}^{W}\dot{\mathbf{r}}^{\mathbb H} =\dot{\mathbf{q}}\otimes{}^{B}\mathbf{r}^{\mathbb H}\otimes\overline{\mathbf{q}} +\mathbf{q}\otimes{}^{B}\mathbf{r}^{\mathbb H}\otimes\overline{\dot{\mathbf{q}}}.\]

Insert \(\overline{\mathbf{q}}\otimes\mathbf{q}=1\) and use the original sandwich:

\[{}^{W}\dot{\mathbf{r}}^{\mathbb H} =(\dot{\mathbf{q}}\otimes\overline{\mathbf{q}})\otimes{}^{W}\mathbf{r}^{\mathbb H} +{}^{W}\mathbf{r}^{\mathbb H}\otimes(\mathbf{q}\otimes\overline{\dot{\mathbf{q}}}).\]

Differentiating \(\mathbf{q}\otimes\overline{\mathbf{q}}=1\) yields \(\mathbf{q}\otimes\overline{\dot{\mathbf{q}}}=-(\dot{\mathbf{q}}\otimes\overline{\mathbf{q}})\). Define

\[{}^{W}\boldsymbol{\Omega}:=2\dot{\mathbf{q}}\otimes\overline{\mathbf{q}}.\]

Its scalar part is zero because \(\mathbf{q}^T\dot{\mathbf{q}}=0\). Hence

\[{}^{W}\dot{\mathbf{r}}^{\mathbb H} =\frac{1}{2}({}^{W}\boldsymbol{\Omega}\otimes{}^{W}\mathbf{r}^{\mathbb H} -{}^{W}\mathbf{r}^{\mathbb H}\otimes{}^{W}\boldsymbol{\Omega}).\]

For pure quaternions, the commutator doubles the cross product:

\[(0,\mathbf{a})\otimes(0,\mathbf{b})-(0,\mathbf{b})\otimes(0,\mathbf{a}) =(0,2\mathbf{a}\times\mathbf{b}).\]

The quaternion derivative therefore reduces exactly to the rigid-body law

\[\boxed{{}^{W}\dot{\mathbf{r}} ={}^{W}\boldsymbol{\omega}\times{}^{W}\mathbf{r}}.\]

At the same time, the definition of \({}^{W}\boldsymbol{\Omega}\) gives \(\dot{\mathbf{q}}=\tfrac12{}^{W}\boldsymbol{\Omega}\otimes\mathbf{q}\). Resolving angular velocity in \(B\) gives

\[\boxed{{}^{B}\boldsymbol{\Omega}=2\overline{\mathbf{q}}\otimes\dot{\mathbf{q}}}, \qquad \boxed{\dot{\mathbf{q}}=\frac12\mathbf{q}\otimes{}^{B}\boldsymbol{\Omega}}.\]

Quaternion kinematics is the lift to \(S^3\) of \(\dot{\mathbf{r}}=\boldsymbol{\omega}\times\mathbf{r}\). The commutator produces the cross product, while the half angle produces the factor \(1/2\).

Component and Matrix Forms

Write \(\mathbf{q}=(w,x,y,z)\) and \({}^{B}\boldsymbol{\Omega}=(0,\omega_1,\omega_2,\omega_3)\). Hamilton multiplication gives

\[\mathbf{q}\otimes{}^{B}\boldsymbol{\Omega} =\begin{bmatrix} -x\omega_1-y\omega_2-z\omega_3\\ w\omega_1+y\omega_3-z\omega_2\\ w\omega_2+z\omega_1-x\omega_3\\ w\omega_3+x\omega_2-y\omega_1 \end{bmatrix}.\]

The first row is the negative dot product \(-\mathbf{q}_v^T{}^{B}\boldsymbol{\omega}\). The remaining rows are \(w{}^{B}\boldsymbol{\omega}+\mathbf{q}_v\times{}^{B}\boldsymbol{\omega}\). Multiplying by \(1/2\) and collecting the coefficients of \({}^{B}\boldsymbol{\omega}\) defines the kinematic lift matrix \(\mathbf{G}_B(\mathbf{q})\): it maps the three body-resolved angular-velocity components to the four components of \(2\dot{\mathbf{q}}\). Thus

\[\dot{\mathbf{q}_c} =\frac12\mathbf{G}_B(\mathbf{q}){}^{B}\boldsymbol{\omega} =\frac12 \begin{bmatrix} -x&-y&-z\\ w&-z&y\\ z&w&-x\\ -y&x&w \end{bmatrix} \begin{bmatrix}\omega_1\\\omega_2\\\omega_3\end{bmatrix}_{\!B}, \qquad \mathbf{q}_c:=\begin{bmatrix}w\\x\\y\\z\end{bmatrix}.\]

Equivalently,

\[\begin{aligned} \dot w&=-\tfrac12(x\omega_x+y\omega_y+z\omega_z),\\ \dot x&= \tfrac12(w\omega_x+y\omega_z-z\omega_y),\\ \dot y&= \tfrac12(w\omega_y+z\omega_x-x\omega_z),\\ \dot z&= \tfrac12(w\omega_z+x\omega_y-y\omega_x). \end{aligned}\]

The same result can be collected by quaternion coefficients rather than angular-velocity components. Since \(\mathbf{q}\otimes{}^{B}\boldsymbol{\Omega} =\mathcal{R}({}^{B}\boldsymbol{\Omega})\mathbf{q}_c\),

\[\boxed{\dot{\mathbf{q}_c}=\mathbf{F}_B({}^{B}\boldsymbol{\omega})\mathbf{q}_c},\]

with the system matrix

\[\boxed{\mathbf{F}_B({}^{B}\boldsymbol{\omega}) =\frac12 \begin{bmatrix} 0&-\omega_1&-\omega_2&-\omega_3\\ \omega_1&0&\omega_3&-\omega_2\\ \omega_2&-\omega_3&0&\omega_1\\ \omega_3&\omega_2&-\omega_1&0 \end{bmatrix}}.\]

This is the matrix form of \(\dot{\mathbf{q}}=\tfrac12\mathbf{q}\otimes{}^{B}\boldsymbol{\Omega}\). Resolving angular velocity in \(W\) instead changes the sign pattern of the cross-product terms because the pure quaternion multiplies on the left:

\[\dot{\mathbf{q}_c} =\frac12\mathbf{G}_W(\mathbf{q}){}^{W}\boldsymbol{\omega} =\frac12 \begin{bmatrix} -x&-y&-z\\ w&z&-y\\ -z&w&x\\ y&-x&w \end{bmatrix} \begin{bmatrix}\omega_1\\\omega_2\\\omega_3\end{bmatrix}_{\!W}.\]

Accordingly, \(\mathbf{G}_W(\mathbf{q})\) is the analogous lift for world-resolved angular velocity. Neither matrix is introduced independently: both are the coefficient matrices obtained by expanding the two quaternion products in the kinematic equations.

Using multiplication matrices, the same statements are

\[\dot{\mathbf{q}_c} =\frac12\mathcal{R}({}^{B}\boldsymbol{\Omega})\mathbf{q}_c, \qquad \dot{\mathbf{q}_c} =\frac12\mathcal{L}({}^{W}\boldsymbol{\Omega})\mathbf{q}_c.\]

The compact quaternion form is best for reasoning; the \(4\times3\) form is often best for Jacobians and numerical work.

Checks, Invariants, and a Moving Axis

At the identity \(\mathbf{q}=(1,0,0,0)\), frames \(B\) and \(W\) coincide:

\[\dot{\mathbf{q}}=\frac12(0,\boldsymbol{\omega}).\]

This is the fastest check for the factor \(1/2\) and scalar-first ordering. A second check is rotation about a fixed \(z\)-axis:

\[\mathbf{q}(t)=\left(\cos\frac{\theta}{2},0,0,\sin\frac{\theta}{2}\right),\]

\[\dot{\mathbf{q}} =\frac{\dot\theta}{2}\left(-\sin\frac{\theta}{2},0,0,\cos\frac{\theta}{2}\right) =\frac12\mathbf{q}\otimes(0,0,0,\dot\theta).\]

Quaternion multiplication preserves norms, so every unit-quaternion trajectory also satisfies

\[\boxed{\lVert\dot{\mathbf{q}}\rVert=\frac12\lVert\boldsymbol{\omega}\rVert}.\]

A Moving Axis

Suppose

\[\mathbf{q}(t)=\left(\cos\frac{\theta(t)}2, \mathbf{u}(t)\sin\frac{\theta(t)}2\right), \qquad \lVert\mathbf{u}(t)\rVert=1.\]

Direct differentiation gives

\[\dot{\mathbf{q}}=\left( -\frac{\dot\theta}{2}\sin\frac\theta2, \frac{\dot\theta}{2}\mathbf{u}\cos\frac\theta2 +\dot{\mathbf{u}}\sin\frac\theta2\right).\]

Using \(\mathbf{u}\cdot\dot{\mathbf{u}}=0\) and extracting angular velocity yields

\[\boxed{ {}^{W}\boldsymbol{\omega} =\dot\theta\mathbf{u}+\sin\theta\dot{\mathbf{u}} +(1-\cos\theta)\mathbf{u}\times\dot{\mathbf{u}}},\]

\[\boxed{ {}^{B}\boldsymbol{\omega} =\dot\theta\mathbf{u}+\sin\theta\dot{\mathbf{u}} -(1-\cos\theta)\mathbf{u}\times\dot{\mathbf{u}}}.\]

Only when \(\dot{\mathbf{u}}=0\) does the axis in a global axis-angle parameterization coincide with the instantaneous angular-velocity axis.

Recovering Angular Velocity

The kinematic equations invert without a linear solve:

\[\boxed{{}^{B}\boldsymbol{\Omega}=2\overline{\mathbf{q}}\otimes\dot{\mathbf{q}}}, \qquad \boxed{{}^{W}\boldsymbol{\Omega}=2\dot{\mathbf{q}}\otimes\overline{\mathbf{q}}}.\]

The desired angular velocity is the vector part. For a normalized quaternion, the scalar part is exactly zero. If the quaternion is not normalized, the conjugate is not the inverse. The scale-independent products are

\[2\mathbf{q}^{-1}\otimes\dot{\mathbf{q}}, \qquad 2\dot{\mathbf{q}}\otimes\mathbf{q}^{-1}.\]

Their vector parts are angular velocity resolved in \(B\) and \(W\), respectively. Their scalar part is the logarithmic norm rate:

\[\operatorname{scalar}(\mathbf{q}^{-1}\otimes\dot{\mathbf{q}}) =\frac{d}{dt}\log\lVert\mathbf{q}\rVert.\]

A nonzero scalar part is therefore a direct diagnostic for norm drift.

Sign Continuity

The antipodes \(\mathbf{q}\) and \(-\mathbf{q}\) represent the same orientation. A sampled trajectory may therefore contain artificial sign jumps. For consecutive samples, if \(\mathbf{q}_k^T\mathbf{q}_{k+1}<0\), replace \(\mathbf{q}_{k+1}\) by \(-\mathbf{q}_{k+1}\) before differentiating, interpolating, or taking a logarithm. If a sample changes sign, its derivative must change sign as well.

The Rotation-Matrix Derivative

Let \({}^{W}\mathbf{R}_{B}=\mathbf{R}(\mathbf{q})\) be the matrix representation of \({}^{W}\mathbf{q}_{B}\). For a vector fixed in \(B\),

\[{}^{W}\dot{\mathbf{r}} ={}^{W}\dot{\mathbf{R}}_{B}\,{}^{B}\mathbf{r} ={}^{W}\boldsymbol{\omega}\times({}^{W}\mathbf{R}_{B}\,{}^{B}\mathbf{r}) =[{}^{W}\boldsymbol{\omega}]_\times{}^{W}\mathbf{R}_{B}\,{}^{B}\mathbf{r}.\]

Since this holds for every \({}^{B}\mathbf{r}\),

\[\boxed{{}^{W}\dot{\mathbf{R}}_{B} =[{}^{W}\boldsymbol{\omega}]_\times{}^{W}\mathbf{R}_{B}}, \qquad \boxed{{}^{W}\dot{\mathbf{R}}_{B} ={}^{W}\mathbf{R}_{B}[{}^{B}\boldsymbol{\omega}]_\times}.\]

The equality follows from \({}^{W}\boldsymbol{\omega}={}^{W}\mathbf{R}_{B}\,{}^{B}\boldsymbol{\omega}\) and \([\mathbf{R}\mathbf{a}]_\times=\mathbf{R}[\mathbf{a}]_\times\mathbf{R}^T\). Conversely,

\[\boxed{[{}^{W}\boldsymbol{\omega}]_\times ={}^{W}\dot{\mathbf{R}}_{B}({}^{W}\mathbf{R}_{B})^T}, \qquad \boxed{[{}^{B}\boldsymbol{\omega}]_\times =({}^{W}\mathbf{R}_{B})^T{}^{W}\dot{\mathbf{R}}_{B}}.\]

Differentiating \(({}^{W}\mathbf{R}_{B})^T{}^{W}\mathbf{R}_{B}=\mathbf{I}\) proves that both products are skew-symmetric. For measured or numerically imperfect data, project explicitly to the skew part:

\[{}^{B}\boldsymbol{\omega} =\left( \frac{({}^{W}\mathbf{R}_{B})^T{}^{W}\dot{\mathbf{R}}_{B} -({}^{W}\dot{\mathbf{R}}_{B})^T{}^{W}\mathbf{R}_{B}}{2} \right)^{\vee},\]

Here \((\cdot)^{\vee}:\mathfrak{so}(3)\to\mathbb{R}^3\) is the inverse of the cross-product-matrix map: \(([\mathbf{a}]_\times)^{\vee}=\mathbf{a}\). The superscript notation emphasizes that \(\vee\) acts on a skew-symmetric matrix rather than multiplying it.

Exponential Map and Exact Constant-Rate Motion

Suppose \({}^{B}\boldsymbol{\omega}\) is constant and let \(\Delta t=t-t_0\). The component differential equation

\[\dot{\mathbf{q}_c}=\mathbf{F}_B({}^{B}\boldsymbol{\omega})\mathbf{q}_c\]

has the transition-matrix solution

\[\boxed{\mathbf{q}_c(t) =\boldsymbol{\Phi}_q(t,t_0;{}^{B}\boldsymbol{\omega})\mathbf{q}_c(t_0)}, \qquad \boldsymbol{\Phi}_q =\exp\!\left(\mathbf{F}_B\Delta t\right).\]

Because a pure quaternion squares to minus its squared vector norm,

\[\mathbf{F}_B^2 =-\frac{\lVert{}^{B}\boldsymbol{\omega}\rVert^2}{4}\mathbf{I}_4.\]

Separating the even and odd powers in the exponential series therefore gives

\[\boxed{ \boldsymbol{\Phi}_q(t,t_0;{}^{B}\boldsymbol{\omega}) =\cos\!\left(\frac{\lVert{}^{B}\boldsymbol{\omega}\rVert\Delta t}{2}\right)\mathbf{I}_4 +\frac{2\sin(\lVert{}^{B}\boldsymbol{\omega}\rVert\Delta t/2)} {\lVert{}^{B}\boldsymbol{\omega}\rVert}\mathbf{F}_B}.\]

The same solution in quaternion form is

\[\boxed{\mathbf{q}(t)=\mathbf{q}(t_0)\otimes\boldsymbol{\varphi}_q(t,t_0;{}^{B}\boldsymbol{\omega})},\]

where the transition quaternion is

\[\boxed{ \boldsymbol{\varphi}_q =\exp\!\left(\frac{\Delta t}{2}{}^{B}\boldsymbol{\Omega}\right) =\left( \cos\frac{\lVert{}^{B}\boldsymbol{\omega}\rVert\Delta t}{2}, \frac{\sin(\lVert{}^{B}\boldsymbol{\omega}\rVert\Delta t/2)} {\lVert{}^{B}\boldsymbol{\omega}\rVert}{}^{B}\boldsymbol{\omega} \right)}.\]

If \({}^{W}\boldsymbol{\omega}\) is constant instead, the exponential belongs on the left:

\[\boxed{ \mathbf{q}(t)= \exp\!\left(\frac{\Delta t}{2}{}^{W}\boldsymbol{\Omega}\right)\otimes\mathbf{q}(t_0)}.\]

For \(\boldsymbol{\phi}=\boldsymbol{\omega}\Delta t\),

\[\exp\!\left(\frac12(0,\boldsymbol{\phi})\right) =\left( \cos\frac{\lVert\boldsymbol{\phi}\rVert}{2}, \frac{\sin(\lVert\boldsymbol{\phi}\rVert/2)}{\lVert\boldsymbol{\phi}\rVert} \boldsymbol{\phi}\right).\]

Near zero, evaluate the ratio with a stable series:

\[\frac{\sin(\theta/2)}{\theta} =\frac12-\frac{\theta^2}{48}+O(\theta^4).\]

If the angular-velocity axis changes with time, increments at different times generally do not commute. Therefore \(\exp(\tfrac12\int\boldsymbol{\Omega}(t)\,dt)\) is exact only when those increments commute. The general solution is a time-ordered exponential, approximated by small exponential steps, midpoint rules, Runge–Kutta methods, or Lie-group integrators.

Second Derivatives and Angular Acceleration

Differentiating the equation for angular velocity resolved in \(B\) gives

\[\ddot{\mathbf{q}} =\frac12\dot{\mathbf{q}}\otimes{}^{B}\boldsymbol{\Omega} +\frac12\mathbf{q}\otimes{}^{B}\dot{\boldsymbol{\Omega}}.\]

Since \({}^{B}\boldsymbol{\Omega}\otimes{}^{B}\boldsymbol{\Omega} =(-\lVert{}^{B}\boldsymbol{\omega}\rVert^2,\mathbf{0})\), substitution yields

\[\boxed{ \ddot{\mathbf{q}} =-\frac14\lVert{}^{B}\boldsymbol{\omega}\rVert^2\mathbf{q} +\frac12\mathbf{q}\otimes{}^{B}\dot{\boldsymbol{\Omega}}}.\]

When angular velocity is resolved in \(W\),

\[\boxed{ \ddot{\mathbf{q}} =-\frac14\lVert{}^{W}\boldsymbol{\omega}\rVert^2\mathbf{q} +\frac12{}^{W}\dot{\boldsymbol{\Omega}}\otimes\mathbf{q}}.\]

The first term points radially inward on \(S^3\); it is the curvature term required even at constant angular velocity. Indeed, differentiating \(\mathbf{q}^T\mathbf{q}=1\) twice gives

\[\mathbf{q}^T\ddot{\mathbf{q}} =-\dot{\mathbf{q}}^T\dot{\mathbf{q}} =-\frac14\lVert\boldsymbol{\omega}\rVert^2.\]

For a rotated vector,

\[\boxed{ {}^{W}\ddot{\mathbf{r}} ={}^{W}\boldsymbol{\alpha}\times{}^{W}\mathbf{r} +{}^{W}\boldsymbol{\omega}\times({}^{W}\boldsymbol{\omega}\times{}^{W}\mathbf{r})}, \qquad {}^{W}\boldsymbol{\alpha}={}^{W}\dot{\boldsymbol{\omega}}.\]

Numerical Integration on the Sphere

The simplest update for angular velocity resolved in \(B\) is additive Euler followed by normalization:

\[\widetilde{\mathbf{q}}_{k+1} =\mathbf{q}_k+\frac{\Delta t}{2}\mathbf{q}_k\otimes{}^{B}\boldsymbol{\Omega}_k, \qquad \mathbf{q}_{k+1} =\frac{\widetilde{\mathbf{q}}_{k+1}}{\lVert\widetilde{\mathbf{q}}_{k+1}\rVert}.\]

This method is first-order accurate. Normalization repairs the norm, but it does not remove integration error along the sphere. The multiplicative step

\[\boxed{ \mathbf{q}_{k+1} =\mathbf{q}_k\otimes\exp\!\left(\frac{\Delta t}{2}{}^{B}\boldsymbol{\Omega}_k\right)}\]

stays exactly on \(S^3\) and is exact when \({}^{B}\boldsymbol{\omega}\) is constant during the step. A midpoint rate improves accuracy when the rate varies.

The exponential update follows the great-circle arc. An additive Euler step follows the tangent away from \(S^3\), and normalization projects its endpoint back. Projection repairs radius, not the error along the sphere.

SLERP, Its Derivative, and Finite Differences

Let \(\mathbf{q}_0\) and \(\mathbf{q}_1\) be two samples of \({}^{W}\mathbf{q}_{B}\). Choose the short branch by replacing \(\mathbf{q}_1\) with \(-\mathbf{q}_1\) when \(\mathbf{q}_0^T\mathbf{q}_1<0\), then put

\[d=\mathbf{q}_0^T\mathbf{q}_1, \qquad \Theta=\arccos d, \qquad 0\le\Theta\le\frac\pi2.\]

The great-circle interpolation on \(S^3\) is

\[\operatorname{SLERP}(\mathbf{q}_0,\mathbf{q}_1;u) =\frac{\sin((1-u)\Theta)}{\sin\Theta}\mathbf{q}_0 +\frac{\sin(u\Theta)}{\sin\Theta}\mathbf{q}_1.\]

Differentiating with respect to \(u\) gives

\[\boxed{ \frac{d\mathbf{q}}{du} =\frac{\Theta}{\sin\Theta} \left[-\cos((1-u)\Theta)\mathbf{q}_0 +\cos(u\Theta)\mathbf{q}_1\right]}.\]

The exponential form makes constant angular speed clearer. Define

\[{}^{B}\delta\mathbf{q} =\overline{\mathbf{q}_0}\otimes\mathbf{q}_1 =\exp\!\left(\frac12{}^{B}\boldsymbol{\Phi}\right).\]

Then

\[\mathbf{q}(u)=\mathbf{q}_0\otimes\exp\!\left(\frac u2{}^{B}\boldsymbol{\Phi}\right), \qquad \boxed{\frac{d\mathbf{q}}{du}=\frac12\mathbf{q}(u)\otimes{}^{B}\boldsymbol{\Phi}}.\]

If interpolation lasts time \(T\), then \(u=t/T\) and \({}^{B}\boldsymbol{\omega}=\operatorname{vec}({}^{B}\boldsymbol{\Phi})/T\).

Finite Differences on the Rotation Group

Component subtraction ignores both group composition and the double cover. Instead form a relative rotation and take its logarithm:

\[{}^{B}\delta\mathbf{q}=\overline{\mathbf{q}(t)}\otimes\mathbf{q}(t+h), \qquad \boxed{{}^{B}\boldsymbol{\omega}(t) \approx\frac{2}{h}\operatorname{Log}({}^{B}\delta\mathbf{q})},\]

\[{}^{W}\delta\mathbf{q}=\mathbf{q}(t+h)\otimes\overline{\mathbf{q}(t)}, \qquad \boxed{{}^{W}\boldsymbol{\omega}(t) \approx\frac{2}{h}\operatorname{Log}({}^{W}\delta\mathbf{q})}.\]

Differentials with Respect to Quaternion Components

Time differentiation follows one curve \(\mathbf{q}(t)\). A Jacobian describes the response to every possible small displacement \(d\mathbf{q}\). Before imposing the unit constraint, identify \(\mathbb{H}\) with \(\mathbb{R}^4\) and use ordinary real multivariable calculus.

For \(f(\mathbf{r},\mathbf{q})=\mathbf{r}\otimes\mathbf{q}\),

\[d(\mathbf{r}\otimes\mathbf{q}) =d\mathbf{r}\otimes\mathbf{q}+\mathbf{r}\otimes d\mathbf{q} =\mathcal{R}(\mathbf{q})\,d\mathbf{r} +\mathcal{L}(\mathbf{r})\,d\mathbf{q}.\]

Therefore

\[\boxed{ \frac{\partial(\mathbf{r}\otimes\mathbf{q})}{\partial\mathbf{r}} =\mathcal{R}(\mathbf{q})}, \qquad \boxed{ \frac{\partial(\mathbf{r}\otimes\mathbf{q})}{\partial\mathbf{q}} =\mathcal{L}(\mathbf{r})}.\]

Conjugation is linear:

\[d\overline{\mathbf{q}}=\mathbf{C}\,d\mathbf{q}, \qquad \mathbf{C}=\operatorname{diag}(1,-1,-1,-1).\]

The inverse differential and unconstrained inverse Jacobian are

\[d(\mathbf{q}^{-1})=-\mathbf{q}^{-1}\otimes d\mathbf{q}\otimes\mathbf{q}^{-1},\]

\[\boxed{ \frac{\partial\mathbf{q}^{-1}}{\partial\mathbf{q}} =-\mathcal{L}(\mathbf{q}^{-1})\mathcal{R}(\mathbf{q}^{-1})}.\]

For normalization \(\mathbf{n}(\mathbf{q})=\mathbf{q}/\lVert\mathbf{q}\rVert\),

\[\boxed{ \frac{\partial\mathbf{n}}{\partial\mathbf{q}} =\frac{1}{\lVert\mathbf{q}\rVert} \left(\mathbf{I}_4- \frac{\mathbf{q}\mathbf{q}^T}{\lVert\mathbf{q}\rVert^2}\right)}.\]

At unit length, this is the tangent projector. A four-column Jacobian contains a radial direction that changes quaternion scale but not normalized orientation.

Jacobian of a Rotated Vector

Let \(\mathbf{q}=(w,\mathbf{v})\) and rotate the fixed vector \(\mathbf{a}\) by

Embed \(\mathbf{a}\) as \(\mathbf{a}^{\mathbb H}=(0,\mathbf{a})\). Then

\[\mathbf{a}'=\operatorname{vec}\!\left( \mathbf{q}\otimes\mathbf{a}^{\mathbb H}\otimes\overline{\mathbf{q}}\right).\]

Expanding gives

\[\mathbf{a}' =(w^2-\mathbf{v}^T\mathbf{v})\mathbf{a} +2\mathbf{v}(\mathbf{v}^T\mathbf{a}) +2w(\mathbf{v}\times\mathbf{a}).\]

Differentiating with respect to the scalar and vector components yields

\[\boxed{ \frac{\partial\mathbf{a}'}{\partial w} =2(w\mathbf{a}+\mathbf{v}\times\mathbf{a})},\]

\[\boxed{ \frac{\partial\mathbf{a}'}{\partial\mathbf{v}} =2\left[ (\mathbf{v}^T\mathbf{a})\mathbf{I} +\mathbf{v}\mathbf{a}^T -\mathbf{a}\mathbf{v}^T -w[\mathbf{a}]_\times \right]}.\]

The unconstrained \(3\times4\) Jacobian is the horizontal concatenation of these blocks. It differentiates \(\mathbf{q}\otimes(0,\mathbf{a})\otimes\overline{\mathbf{q}}\), which scales by \(\lVert\mathbf{q}\rVert^2\) away from unit length. If an implementation normalizes first, compose this Jacobian with the normalization Jacobian. If it uses \(\mathbf{q}^{-1}\) instead of \(\overline{\mathbf{q}}\), differentiate the inverse explicitly.

A product-rule check computes the \(i\)-th column with the standard basis quaternion \(\mathbf{e}_i\):

\[\frac{\partial}{\partial q_i} \left(\mathbf{q}\otimes\mathbf{a}^{\mathbb H}\otimes\overline{\mathbf{q}}\right) =\mathbf{e}_i\otimes\mathbf{a}^{\mathbb H}\otimes\overline{\mathbf{q}} +\mathbf{q}\otimes\mathbf{a}^{\mathbb H}\otimes\overline{\mathbf{e}_i}.\]

Minimal Perturbations and \(SO(3)\) Jacobians

A physical orientation has three degrees of freedom. A minimal perturbation uses a small rotation vector \(\delta\boldsymbol{\theta}\in\mathbb{R}^3\), not an arbitrary four-vector.

Perturbation Resolved in \(B\)

\[\mathbf{q}({}^{B}\delta\boldsymbol{\theta}) =\mathbf{q}\otimes\exp\!\left(\frac12(0,{}^{B}\delta\boldsymbol{\theta})\right).\]

To first order,

\[\delta\mathbf{q} \approx\frac12\mathbf{G}_B(\mathbf{q}){}^{B}\delta\boldsymbol{\theta}, \qquad \mathbf{G}_B(\mathbf{q})= \begin{bmatrix} -x&-y&-z\\ w&-z&y\\ z&w&-x\\ -y&x&w \end{bmatrix}.\]

For \({}^{W}\mathbf{a}={}^{W}\mathbf{R}_{B}\,{}^{B}\mathbf{a}\),

\[\boxed{{}^{W}\delta\mathbf{a} =-{}^{W}\mathbf{R}_{B}[{}^{B}\mathbf{a}]_\times{}^{B}\delta\boldsymbol{\theta}}.\]

Perturbation Resolved in \(W\)

\[\mathbf{q}({}^{W}\delta\boldsymbol{\theta}) =\exp\!\left(\frac12(0,{}^{W}\delta\boldsymbol{\theta})\right)\otimes\mathbf{q},\]

\[\delta\mathbf{q} \approx\frac12\mathbf{G}_W(\mathbf{q}){}^{W}\delta\boldsymbol{\theta}, \qquad \mathbf{G}_W(\mathbf{q})= \begin{bmatrix} -x&-y&-z\\ w&z&-y\\ -z&w&x\\ y&-x&w \end{bmatrix},\]

\[\boxed{{}^{W}\delta\mathbf{a} =-[{}^{W}\mathbf{a}]_\times{}^{W}\delta\boldsymbol{\theta}}.\]

The same tangent displacement can be resolved in either frame. Its coordinate vectors satisfy \({}^{W}\delta\boldsymbol{\theta}={}^{W}\mathbf{R}_{B}\,{}^{B}\delta\boldsymbol{\theta}\), just like angular velocity.

If \(\mathbf{J}_{\mathbf{q}}=\partial f/\partial\mathbf{q}\) is known, its minimal Jacobians for increments resolved in \(B\) and \(W\) are

\[\boxed{ \mathbf{J}_{{}^{B}\delta\theta} =\frac12\mathbf{J}_{\mathbf{q}}\mathbf{G}_B(\mathbf{q})}, \qquad \boxed{ \mathbf{J}_{{}^{W}\delta\theta} =\frac12\mathbf{J}_{\mathbf{q}}\mathbf{G}_W(\mathbf{q})}.\]

Finite Rotation-Vector Increments

Addition in rotation-vector coordinates is not composition. Let \(\boldsymbol{\phi}\in\mathbb{R}^3\), \(\theta=\lVert\boldsymbol{\phi}\rVert\), and \(\operatorname{Exp}(\boldsymbol{\phi})\in SO(3)\). The right Jacobian is defined by

\[\operatorname{Exp}(\boldsymbol{\phi}+\delta\boldsymbol{\phi}) \approx\operatorname{Exp}(\boldsymbol{\phi}) \operatorname{Exp}(\mathbf{J}_r(\boldsymbol{\phi})\delta\boldsymbol{\phi}),\]

\[\boxed{ \mathbf{J}_r(\boldsymbol{\phi}) =\mathbf{I}-\frac{1-\cos\theta}{\theta^2}[\boldsymbol{\phi}]_\times +\frac{\theta-\sin\theta}{\theta^3}[\boldsymbol{\phi}]_\times^2}.\]

The left Jacobian satisfies \(\mathbf{J}_l(\boldsymbol{\phi})=\mathbf{J}_r(-\boldsymbol{\phi})\). Near zero,

\[\mathbf{J}_r =\mathbf{I}-\frac12[\boldsymbol{\phi}]_\times +\frac16[\boldsymbol{\phi}]_\times^2+O(\theta^3),\]

\[\mathbf{J}_l =\mathbf{I}+\frac12[\boldsymbol{\phi}]_\times +\frac16[\boldsymbol{\phi}]_\times^2+O(\theta^3).\]

Euler-Angle Rates Are Not Angular Velocity

For the active intrinsic roll–pitch–yaw convention

\[\mathbf{R}=\mathbf{R}_z(\psi)\mathbf{R}_y(\theta)\mathbf{R}_x(\phi),\]

let \(\phi\) be roll, \(\theta\) pitch, and \(\psi\) yaw. If \((p,q,r)\) are the components of \({}^{B}\boldsymbol{\omega}\), then

\[\boxed{ \begin{bmatrix}p\\q\\r\end{bmatrix} =\begin{bmatrix} 1&0&-\sin\theta\\ 0&\cos\phi&\sin\phi\cos\theta\\ 0&-\sin\phi&\cos\phi\cos\theta \end{bmatrix} \begin{bmatrix}\dot\phi\\\dot\theta\\\dot\psi\end{bmatrix}}.\]

The inverse relationship is

\[\begin{bmatrix}\dot\phi\\\dot\theta\\\dot\psi\end{bmatrix} =\begin{bmatrix} 1&\sin\phi\tan\theta&\cos\phi\tan\theta\\ 0&\cos\phi&-\sin\phi\\ 0&\sin\phi/\cos\theta&\cos\phi/\cos\theta \end{bmatrix} \begin{bmatrix}p\\q\\r\end{bmatrix}.\]

At \(\cos\theta=0\), this coordinate map is singular: roll and yaw axes align. Physical angular velocity remains finite and quaternion kinematics remains regular; only the Euler chart fails. The conventional angular-rate component \(q\) in this one matrix is not the orientation quaternion \(\mathbf{q}\).

State Estimation

A gyroscope fixed in \(B\) measures angular velocity resolved in \(B\), with bias and noise:

\[\boldsymbol{\omega}_m ={}^{B}\boldsymbol{\omega}+\mathbf{b}_g+\mathbf{n}_g.\]

With estimated bias \(\widehat{\mathbf{b}}_g\), propagate the nominal orientation by

\[\dot{\widehat{\mathbf{q}}} =\frac12\widehat{\mathbf{q}}\otimes (0,\boldsymbol{\omega}_m-\widehat{\mathbf{b}}_g),\]

or by the corresponding multiplicative exponential step. An error quaternion resolved in \(B\) is

\[{}^{B}\delta\mathbf{q} =\overline{\widehat{\mathbf{q}}}\otimes\mathbf{q}, \qquad {}^{B}\delta\boldsymbol{\theta}=2\operatorname{Log}({}^{B}\delta\mathbf{q}).\]

After an estimator computes a small correction, inject it multiplicatively:

\[\widehat{\mathbf{q}}^+ =\widehat{\mathbf{q}}^-\otimes \exp\!\left(\frac12(0,{}^{B}\delta\boldsymbol{\theta})\right).\]

This is the geometry behind multiplicative extended Kalman filters and error-state filters: the nominal state lies on \(S^3\), while small uncertainty lives in a three-dimensional tangent space.

Common Failure Modes

MistakeWhy it failsRepair
Writing \(\mathbf{q}\times\boldsymbol{\omega}\)A quaternion is not a three-vector.Embed the rate as \(\boldsymbol{\Omega}=(0,\boldsymbol{\omega})\) and use quaternion multiplication.
Omitting \(1/2\)Unit quaternions encode half the physical angle.Begin with the infinitesimal exponential.
Swapping multiplication sideThe side determines the frame in which components are resolved.Right for \(B\), left for \(W\) under the convention used here.
Using \(\overline{\mathbf{q}}\) as the inverse off the unit sphereConjugate and inverse agree only at unit norm.Normalize or divide the conjugate by \(\lVert\mathbf{q}\rVert^2\).
Subtracting sampled quaternion componentsSubtraction ignores composition and antipodal sign changes.Sign-align, form a relative quaternion, then take \(\operatorname{Log}\).
Treating Euler rates as \(\boldsymbol{\omega}\)The successive Euler axes move.Use the sequence-specific rate matrix.
Using a free \(3\times4\) Jacobian in a minimal optimizerIt includes a nonphysical radial direction.Compose with \(\tfrac12\mathbf{G}_B\) or \(\tfrac12\mathbf{G}_W\).
Normalizing an Euler step and calling it exactNormalization fixes radius, not tangential error.Use exponential or higher-order manifold integration.

Formula Map

QuestionResolved in \(B\)Resolved in \(W\)
Quaternion kinematics\(\dot{\mathbf{q}}=\tfrac12\mathbf{q}\otimes{}^{B}\boldsymbol{\Omega}\)\(\dot{\mathbf{q}}=\tfrac12{}^{W}\boldsymbol{\Omega}\otimes\mathbf{q}\)
Extract angular velocity\({}^{B}\boldsymbol{\Omega}=2\overline{\mathbf{q}}\otimes\dot{\mathbf{q}}\)\({}^{W}\boldsymbol{\Omega}=2\dot{\mathbf{q}}\otimes\overline{\mathbf{q}}\)
Frame relation\({}^{W}\boldsymbol{\Omega}=\mathbf{q}\otimes{}^{B}\boldsymbol{\Omega}\otimes\overline{\mathbf{q}}\), \({}^{W}\boldsymbol{\omega}={}^{W}\mathbf{R}_{B}\,{}^{B}\boldsymbol{\omega}\)
Matrix kinematics\({}^{W}\dot{\mathbf{R}}_{B}={}^{W}\mathbf{R}_{B}[{}^{B}\boldsymbol{\omega}]_\times\)\({}^{W}\dot{\mathbf{R}}_{B}=[{}^{W}\boldsymbol{\omega}]_\times{}^{W}\mathbf{R}_{B}\)
Exact constant-rate step\(\mathbf{q}^+=\mathbf{q}\otimes\exp(\Delta t\,{}^{B}\boldsymbol{\Omega}/2)\)\(\mathbf{q}^+=\exp(\Delta t\,{}^{W}\boldsymbol{\Omega}/2)\otimes\mathbf{q}\)
Relative rotation\({}^{B}\delta\mathbf{q}=\overline{\mathbf{q}_0}\otimes\mathbf{q}_1\)\({}^{W}\delta\mathbf{q}=\mathbf{q}_1\otimes\overline{\mathbf{q}_0}\)
Rotated-vector Jacobian\(-{}^{W}\mathbf{R}_{B}[{}^{B}\mathbf{a}]_\times\)\(-[{}^{W}\mathbf{a}]_\times\)

Closing Mental Model

A unit quaternion is a point on \(S^3\). Its derivative is a tangent vector. Angular velocity is the same tangent information expressed in the three-dimensional Lie algebra and resolved either in \(B\) or in \(W\). The exponential lifts a tangent increment to a finite rotation; the logarithm brings a relative rotation back. Left and right multiplication determine the coordinate frame, and the double cover determines the sign branch. Once these ideas are kept separate, the formulas become consequences rather than facts to memorize.

References