Quaternion Exercises for Physics and Engineering
This article is the consolidated self study problem bank for the PhysicsLibrary quaternion
series.
The problems are arranged roughly from foundational algebra through engineering attitude
propagation. All forty exercises are stated before any solutions so that the article can be used as a
genuine problem set.
Unless a problem explicitly states otherwise, use the PhysicsLibrary passive frame convention:
and Hamilton multiplication
Quaternion components are displayed scalar first.
1 Exercises
Part I: conventions and algebra
- Convention identification.
A software library stores quaternion arrays as
and documents
Identify the storage order and multiplication convention. Does the storage order
determine whether the quaternion is active or passive?
- Hamilton basis products.
Evaluate
- General quaternion product.
Let
and
Compute pq and qp.
- Conjugate and product reversal.
For arbitrary quaternions p and q, prove
Then verify the identity numerically using the quaternions in Exercise 3.
- norm and inverse.
For
compute ∥q∥, q∗, and q−1.
Verify directly that
- Normalization.
Normalize
State whether normalization changes the physical rotation axis represented by the
vector part.
- Double representation.
Show algebraically that for a unit quaternion,
Explain the geometric meaning.
- Pure quaternion square.
Let
Prove
Part II: axis angle and passive vector transformations
- Positive
frame rotation about
.
Construct Bq
A for a positive 90∘ frame rotation about +z.
- Arbitrary axis construction.
Construct the passive quaternion for a positive 60∘ frame rotation about
- Passive coordinate transformation.
Using the quaternion from Exercise 9, transform the fixed physical vector
into B coordinates.
- Passive Rodrigues formula.
Starting from
derive
- Extract axis and angle.
Given
recover the positive physical frame rotation axis and angle.
- Small frame rotation.
For
form the first order passive small rotation quaternion.
- Active versus passive diagnostic.
A positive 90∘ geometric rotation about +z is represented by the active rotor
Write the passive frame quaternion for the same geometry and state the relationship between
the two.
- Finite frame chain.
Suppose
and
Compute Cq
A.
Part III: composition, DCMs, and Euler angles
- Noncommuting order.
Using
compute qyqx and qxqy. Explain why the results differ.
- Quaternion to DCM.
Convert
to a direction cosine matrix.
- DCM to quaternion.
Recover a passive unit quaternion from
- DCM column interpretation.
For the matrix in Exercise 19, interpret each of the three columns geometrically.
- Transpose and conjugate.
Prove
Interpret this result as a reversal of frame map direction.
- Quaternion and DCM composition.
Show that under the PhysicsLibrary convention
Use Exercise 16 as a numerical check.
- Pure yaw Euler conversion.
For intrinsic 3-2-1 yaw, pitch, roll with
compute the passive quaternion.
- General
-
-
quaternion.
For
compute
to at least six decimal places.
- Recover Euler Angles.
Given a passive quaternion with corresponding DCM entries
recover the principal intrinsic 3-2-1 roll, pitch, and yaw angles.
- Gimbal lock.
Explain why the intrinsic 3-2-1 representation becomes singular at
What remains well defined?
Part IV: quaternion kinematics and angular velocity
- Derivative at the identity.
For
and constant body resolved angular velocity
compute q(0).
- Body resolved component equations.
Starting from
derive the four scalar component equations.
- Norm preservation.
Prove that the exact continuous quaternion kinematic equation preserves
- Exact constant rate propagation.
Let
Find the exact quaternion at
- Recover angular velocity.
Starting from
derive ωB in terms of q and q.
- Body versus reference resolved rate.
Prove that
when
- Forward Euler norm drift.
With
compute one forward Euler step and its norm.
- DCM kinematics.
Derive
Part V: relative attitude and error quaternions
- Left and right errors.
Given actual attitude q and desired attitude qd, derive
and
Show how each reconstructs qd.
- Same axis attitude error.
The actual attitude is positive passive yaw 10∘ and the desired attitude is positive
passive yaw 25∘.
Compute the relative quaternion and recover the physical frame error.
- Small passive attitude error.
An error quaternion is locally
Recover the first order physical frame error vector.
- Transport right error to left error.
Show that
Then derive the first order vector relation
- Principal sign choice.
An error calculation returns
Select the principal representative and recover the physical frame error.
Part VI: IMU attitude state propagation
- Bias corrected IMU update.
A body gyroscope reports
with bias estimate
For
compute the corrected rate, delta angle, exact passive increment, and qk+1.
- Body increment multiplication side.
Use frame labels to prove that a body resolved IMU increment satisfies
for qk = Bq
I.
- Two small increments and coning.
Two successive body increments are
and
Show to second order that the equivalent physical rotation vector is
- Quaternion sign continuity.
Suppose two successive numerical states satisfy
What operation should be performed if a continuous quaternion time history is desired?
Does the operation change physical attitude?
- Specific force transformation.
The attitude state is
An accelerometer measures Bf. Derive the DCM and quaternion expressions for If.
- Capstone convention audit.
A legacy routine propagates a quaternion using
and labels the state Bq
I.
Identify both convention inconsistencies relative to PhysicsLibrary and write the
corrected update.
2 Solutions
Solution 1: convention identification
The array
is scalar last storage.
The rule
identifies Hamilton multiplication.
Storage order does not determine active versus passive interpretation. That must be defined
separately by the frame map and vector transformation law.
Solution 2: Hamilton basis products
Using the Hamilton multiplication table,
Also,
Finally,
Solution 3: general quaternion product
Using scalar vector form or direct expansion,
The scalar part of pq is
The vector part is
The cross product is
Hence
For qp, the cross product reverses sign:
Solution 4: conjugate and product reversal
Write
Conjugation changes the sign of every vector part. Since Hamilton multiplication contains p × q,
conjugation changes the cross term sign. Reversing factor order also changes the cross term sign
because
Therefore
For Exercise 3,
so
Direct multiplication of q∗p∗ gives the same result.
Solution 5: norm and inverse
For
the norm is
The conjugate is
Therefore
Since
we have
Solution 6: normalization
The norm is
Therefore
Normalization rescales all four components by the same positive scalar. It does not change the
direction of the vector part, although it does change the half angle implied by a nonunit quaternion
if one had incorrectly attempted to interpret the original unnormalized components as a unit
rotation.
Solution 7: double representation
Because
we have
Thus q and −q represent the same physical orientation. Unit quaternions double cover the rotation
group.
Solution 8: pure quaternion square
Expand
The diagonal terms give
Every mixed pair cancels because, for example,
Therefore
Solution 9: positive
frame rotation about 
The passive axis angle formula gives
Hence
Solution 10: arbitrary axis construction
The half angle is 30∘, so
Thus
Therefore
Solution 11: passive coordinate transformation
From Exercise 9,
The corresponding passive DCM is
Therefore
The fixed physical vector has B coordinates along −y.
Solution 12: passive Rodrigues formula
Let
Expand
Using pure quaternion multiplication and collecting vector terms gives
Use
and
Then
Solution 13: extract axis and angle
The scalar component is
Therefore
The vector part is
Its norm is
For a passive quaternion, the physical frame axis is opposite the normalized vector
part:
Solution 14: small frame rotation
The passive first order small frame quaternion is
Hence
Solution 15: active versus passive diagnostic
The passive frame quaternion for the same positive geometric frame rotation is the conjugate of
the active rotor:
Thus
Solution 16: finite frame chain
The chain is
Therefore
Since
we obtain
Solution 17: noncommuting order
First,
Second,
They differ because
Finite rotations about different axes do not commute.
Solution 18: quaternion to DCM
For
we have
Substitution into the passive quaternion DCM formula gives
Solution 19: DCM to quaternion
The trace is
Hence
Then
The other vector components are zero.
Thus
The negative quaternion is equally valid.
Solution 20: DCM column interpretation
For
the first column is
so the A frame x basis direction has B coordinates −yB.
The second column is
so the A frame y basis direction has B coordinates +xB.
The third column is
so the z axes coincide.
Solution 21: transpose and conjugate
The conjugate is the inverse unit quaternion:
The DCM of the inverse transformation is the inverse matrix:
A proper DCM is orthogonal, so
Therefore
Quaternion conjugation reverses the passive frame map direction.
Solution 22: quaternion and DCM composition
For any vector,
is represented by the quaternion sandwich
Since
we have
Thus the transformation associated with q is applied first and the transformation associated with p
second. Therefore
For Exercise 16,
which gives the same direct A → C frame map.
Solution 23: pure yaw Euler conversion
For a pure yaw,
For
Solution 24: general
-
-
quaternion
Using
the passive scalar first components are approximately
Solution 25: recover Euler angles
For passive intrinsic 3-2-1,
Thus
Next,
Finally,
Therefore
Solution 26: gimbal lock
For intrinsic 3-2-1,
At
we have
The matrix entries used to recover roll and yaw lose independent information. The first and third
Euler axes become aligned.
The physical attitude remains perfectly well defined. Only the selected Euler coordinate chart
becomes singular.
A quaternion representation remains nonsingular.
Solution 27: derivative at the identity
The passive body resolved kinematic equation is
At
we obtain
Solution 28: body resolved component equations
Let
and
Expanding
gives
Solution 29: norm preservation
Differentiate
From
we have
because ωB is pure.
Therefore
Hence unit norm is preserved exactly in continuous time.
Solution 30: exact constant rate propagation
The rate magnitude is
The unit axis is
At t = 0.2 s,
Therefore
Numerically,
Solution 31: recover angular velocity
Start with
Right multiply by q∗:
Thus
Solution 32: body versus reference resolved rate
Given
we have
Therefore
The two equations describe the same physical angular velocity resolved in different
frames.
Solution 33: forward Euler norm drift
At the identity,
For Δt = 0.1 s,
The norm is
The result is not exactly unit because the Euler step follows a tangent line rather than the unit
quaternion three sphere.
Solution 34: DCM kinematics
For a physical vector fixed in inertial space,
A rotating frame observes
Thus
Since Iv is arbitrary,
Solution 35: left and right errors
For a left error,
Right multiply by q∗:
For a right error,
Left multiply by q∗:
Thus
Solution 36: same axis attitude error
The actual attitude is
The desired attitude is
Therefore
This represents a positive frame yaw error of
about +z.
Because the rotations share the same axis, the left and right errors coincide.
Solution 37: small passive attitude error
For the passive small error convention,
Therefore
Solution 38: transport right error to left error
Starting from
multiply by q on the left and q∗ on the right:
For small passive errors,
Then
Since the quaternion sandwich transforms vector coordinates,
Solution 39: principal sign choice
The scalar component is negative, so multiply the whole quaternion by −1:
The scalar is approximately
so the full angle is
The passive vector part is along −k, so the physical positive frame axis is +z.
Thus the principal physical error is positive 5∘ about +z.
Solution 40: bias corrected IMU update
The corrected rate is
The delta angle is
The exact passive increment is
Numerically,
Since qk = 1,
Solution 41: body increment multiplication side
At sample k,
maps
The measured body increment is
which maps
The frame chain is therefore
Thus
or
Solution 42: two small increments and coning
For small passive increments,
and
Chronological body increments compose as
Expanding through second order,
The vector part of the last product is
Matching
gives
Solution 43: quaternion sign continuity
If
replace
The new quaternion represents exactly the same physical attitude because q and −q are
equivalent.
The operation merely chooses the representative nearest the previous sample.
Solution 44: specific force transformation
The attitude quaternion
maps inertial coordinates into body coordinates.
Therefore the inverse DCM maps body specific force back into inertial coordinates:
The equivalent quaternion expression is
Solution 45: capstone convention audit
The legacy routine uses
Relative to the PhysicsLibrary state q = Bq
I, two inconsistencies are present.
First, a positive body frame increment must have a negative quaternion vector sign:
Second, a body resolved increment must left multiply the passive inertial to body state.
Therefore the corrected update is
3 Suggested grading progression
The problem set may be used in four passes:
- Exercises 1–8 for algebra and convention fluency;
- Exercises 9–26 for finite attitude representation and conversion;
- Exercises 27–39 for dynamics, estimation, and attitude error;
- Exercises 40–45 for sampled IMU propagation and implementation auditing.
A student who can solve the final convention audit without relying on a memorized active
quaternion formula has internalized the central PhysicsLibrary convention.
4 Sources and exercise provenance
The exercises and worked solutions in this article are newly written or rewritten for the
PhysicsLibrary passive quaternion series.
Hamilton provides the foundational algebra. Sommer and coauthors provide a modern analysis of
quaternion convention management. Henderson provides an engineering reference for quaternion,
matrix, and Euler conversion. Markley and Crassidis provide spacecraft attitude and error
quaternion context. Solà and Savage provide useful treatments of quaternion kinematics, error
states, and IMU propagation.
References
[1] W. R. Hamilton, Elements of Quaternions, 2nd ed., edited by C. J. Joly, Longmans,
Green, and Co., 1899. Public domain historical source. Internet Archive scan
[2] 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. Published under CC BY 4.0. Publisher article
[3] D. M. Henderson, Euler Angles, Quaternions, and Transformation Matrices: Working
Relationships, JSC-12960, NASA Johnson Space Center, 1977. NASA Technical Reports
Server search
[4] F. L. Markley and J. L. Crassidis, Fundamentals of Spacecraft Attitude Determination
and Control, Springer, 2014. Publisher book page
[5] J. Solà, “Quaternion Kinematics for the Error State Kalman Filter,”
arXiv:1711.02508, 2017. arXiv preprint
[6] P. G. Savage, “Strapdown Inertial Navigation Integration Algorithm Design Part 1:
Attitude Algorithms,” Journal of Guidance, Control, and Dynamics, vol. 21, no. 1, pp.
19–28, 1998. DOI record
License
Unless otherwise noted, this PhysicsLibrary entry is intended for release under the Creative
Commons Attribution ShareAlike 4.0 International license.