Quaternion Definition and Basic Algebra: Examples, Exercises, and Solutions
This entry is the self study companion to quaternion definition and basic algebra. Its purpose is to
build fluency with quaternion notation and Hamilton multiplication before quaternions are used for
axis angle rotations, attitude, or angular kinematics.
All exercises are stated first. Complete worked solutions follow afterward.
1 Formula summary
A quaternion is
with real coefficients. PhysicsLibrary displays components scalar first:
The scalar and vector parts are
Hamilton’s basis rules are
and reversing two distinct basis factors changes the sign. quaternion multiplication is associative
and distributive but not generally commutative.
2 Exercises
- Identify quaternion parts.
For
determine qw,qx,qy,qz, the scalar part, the vector part, and the PhysicsLibrary scalar
first component column. Is q pure? Is it a real quaternion?
- Quaternion equality.
Let
Find a,b,c such that p = q. Explain why a quaternion equality represents four real
coefficient equations.
- Addition and scalar multiplication.
Let
Compute p + q, p − q, −2p, and 3q. Verify 2(p + q) = 2p + 2q.
- Hamilton basis multiplication.
Evaluate
- Derive a cyclic product.
Starting from
derive ij = k using associativity and k2 = −1. Then derive jk = i in the same spirit.
- Direct general product expansion.
Let
Compute pq by distributing all terms and using the basis multiplication table.
- Order matters.
Using the same p and q, compute qp and the commutator
Do the two quaternions commute?
- A cancellation identity.
Show directly that
Explain what incorrect extra term appears if i and j are treated as commuting
symbols.
- Associativity versus commutativity.
Verify explicitly that
but
State what each calculation demonstrates.
- Distributivity.
Let
Compute both sides of p(q + r) = pq + pr and (q + r)p = qp + rp.
- Complex subalgebra.
Let
with real a,b,c,d. Show
and verify pq = qp for this restricted pair. Explain why this does not imply that all
quaternions commute.
- Arbitrary unit pure quaternion.
Let
Expand u2 and prove
Why is this result important for later axis based quaternion formulas?
- Pure quaternion product and vector analysis.
Let
Expand uv and show
while the vector part equals u × v. Use u = i, v = j as a sign check.
- Storage order diagnostic.
Package A stores [qw,qx,qy,qz] and Package B stores [qx,qy,qz,qw]. Both use Hamilton
multiplication. A student claims Package B must use a different quaternion algebra. Is the
claim correct? Write
in the array order expected by both packages.
- Multiplication convention versus attitude convention.
An engineer writes quaternions scalar first and states
A colleague says the minus sign must indicate a passive attitude convention. Evaluate the
claim. What does the basis equation actually reveal, and what additional information is
required to decide whether an attitude quaternion is active or passive?
3 Solutions
Solution 1: identify quaternion parts
For
we have
Therefore
and
The component column is
A pure quaternion has zero scalar part, so q is not pure. A real quaternion has zero vector part, so
q is not real either.
Solution 2: quaternion equality
Equality requires corresponding coefficients to agree. Thus
Hence
A quaternion has four independent real coefficients, so one quaternion equality is shorthand for
four real equations.
Solution 3: addition and scalar multiplication
Componentwise addition gives
Subtraction gives
Also,
and
Finally,
and direct addition of 2p and 2q gives the same result.
Solution 4: Hamilton basis multiplication
Using the Hamilton table,
Also,
while
Since i2 = −1,
and
Solution 5: derive a cyclic product
Starting with
right multiply by −k:
Associativity gives
Because k(−k) = 1,
Similarly, left multiply the fundamental relation by −i:
Since (−i)i = 1,
Solution 6: direct general product expansion
Distribute without changing factor order:
Use
Collecting coefficients gives
Solution 7: order matters
Reversing the factors gives
Therefore
so
The commutator is nonzero, so p and q do not commute.
Solution 8: a cancellation identity
Expand in factor order:
Thus
Therefore
If the basis elements were incorrectly assumed to commute, the middle terms would be combined
as 2ij = 2k, which is wrong because ij≠ji.
Solution 9: associativity versus commutativity
First,
Also,
Hence associativity holds in this example. But
so commutativity fails. Quaternion factors may be regrouped but not generally reordered.
Solution 10: distributivity
For the first identity,
Separately,
so pq + pr = 2k. For the second identity,
Also,
so qp + rp = 2j.
Solution 11: complex subalgebra
Multiply directly:
Thus
Reversing the factors yields the same expression because the real coefficients commute and only
one imaginary basis direction is present. This restricted set is a copy of the complex numbers inside
the quaternions. It does not imply that general quaternions commute because different imaginary
basis directions do not commute.
Solution 12: arbitrary unit pure quaternion
Expand
Each mixed pair cancels because reversing distinct Hamilton basis factors changes the sign.
Hence
Using a2 + b2 + c2 = 1 gives
Thus every unit pure quaternion behaves algebraically like an imaginary unit. Later, this
allows an arbitrary spatial unit axis to appear naturally inside quaternion axis angle
formulas.
Solution 13: pure quaternion product and vector analysis
Expanding uv gives the scalar terms
so
The vector terms are
which is exactly u × v. Therefore
For u = i and v = j, the dot product is zero and the cross product is k, so the formula gives ij = k
as required.
Solution 14: storage order diagnostic
The claim is incorrect. Storage order changes only the order of the four real coefficients in memory
or display; it does not change Hamilton multiplication. For Package A,
For Package B,
The semantic quaternion is identical in both cases.
Solution 15: multiplication convention versus attitude convention
The colleague’s claim is incorrect. The basis equation
identifies a multiplication law whose cross-like basis products are flipped relative to the
PhysicsLibrary Hamilton rule ij = +k. It does not by itself identify active or passive attitude
semantics. Likewise, scalar first notation only specifies coefficient ordering. To determine attitude
semantics, one needs the declared physical map, for example an active vector rule such
as
or a frame labeled passive coordinate rule such as
Multiplication law, storage order, and attitude interpretation are separate convention
choices.
4 Compact review
The central facts tested here are
and, for pure quaternions,
The last identity is the bridge to the next PhysicsLibrary quaternion entry, which develops the
scalar vector Hamilton product in compact form.
5 Sources and exercise provenance
The exercises and solutions in this companion are newly written or expanded for PhysicsLibrary.
Hamilton is the foundational historical source; Joly, Kelland and Tait, and Hathaway provide later
systematic and pedagogical treatments. The present article uses modern scalar first engineering
notation rather than reproducing historical notation.
References
[1] W. R. Hamilton, Elements of Quaternions, 2nd ed., edited by C. J. Joly, Longmans,
Green, and Co., 1899. Internet Archive scan
[2] C. J. Joly, A Manual of Quaternions, Macmillan and Co., London, 1905. Internet
Archive search
[3] P. Kelland and P. G. Tait, Introduction to Quaternions, with Numerous Examples,
2nd ed., Macmillan and Co., London, 1882. Internet Archive search
[4] A. S. Hathaway, A Primer of Quaternions, 1896. Project Gutenberg edition
License
Unless otherwise noted, this PhysicsLibrary entry is intended for release under the Creative
Commons Attribution ShareAlike 4.0 International license.