Physics Library
 An open source physics library
Encyclopedia | Forums | Docs | Random  

[parent] quaternion exercises for physics and engineering

(Example)

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:

B    B    A  B    ∗
 v =   qA  v(  qA) ,
(1)

Bq  =  cos 𝜃-− ^u sin 𝜃-,
  A       2        2
(2)

and Hamilton multiplication

ij = k.

Quaternion components are displayed scalar first.

1 Exercises

Part I: conventions and algebra

  1. Convention identification.

    A software library stores quaternion arrays as

    [qx,qy,qz,qw]

    and documents

    ij = k.

    Identify the storage order and multiplication convention. Does the storage order determine whether the quaternion is active or passive?

  2. Hamilton basis products.

    Evaluate

    ik,     ki,     ji,     ijk,     jik.
  3. General quaternion product.

    Let

    p = 1 + 2i − j + 3k

    and

    q = 2 − i + 4j + k.

    Compute pq and qp.

  4. Conjugate and product reversal.

    For arbitrary quaternions p and q, prove

    (pq)∗ = q∗p∗.

    Then verify the identity numerically using the quaternions in Exercise 3.

  5. norm and inverse.

    For

    q = 2 − i + 2j + 2k,

    compute ∥q∥, q∗, and q−1.

    Verify directly that

    qq−1 = 1.
  6. Normalization.

    Normalize

        ⌊    ⌋
       2
    || − 1 ||
q = ⌈  2 ⌉ .
       2

    State whether normalization changes the physical rotation axis represented by the vector part.

  7. Double representation.

    Show algebraically that for a unit quaternion,

    (− q)v(− q )∗ = qvq ∗.

    Explain the geometric meaning.

  8. Pure quaternion square.

    Let

    u = ai + bj + ck,    a2 + b2 + c2 = 1.

    Prove

      2
u  = − 1.

Part II: axis angle and passive vector transformations

  1. Positive 90∘ frame rotation about +z  .

    Construct Bq A for a positive 90∘ frame rotation about +z.

  2. Arbitrary axis construction.

    Construct the passive quaternion for a positive 60∘ frame rotation about

          ⌊  ⌋
    1   1
^u = --⌈ 2⌉ .
    3   2
  3. Passive coordinate transformation.

    Using the quaternion from Exercise 9, transform the fixed physical vector

         ⌊  ⌋
       1
Av = ⌈ 0⌉
       0

    into B coordinates.

  4. Passive Rodrigues formula.

    Starting from

            𝜃        𝜃
q = cos --− ^u sin -,
        2        2

    derive

    vB = vA  cos𝜃 − (^u × vA )sin 𝜃 + ^u(^u ⋅ vA )(1 − cos𝜃).
    (3)

  5. Extract axis and angle.

    Given

        ⌊  √- ⌋
       -22√-
    || − -6||
q = |   √66| ,
    ⌈ − √6⌉
      − -66-

    recover the positive physical frame rotation axis and angle.

  6. Small frame rotation.

    For

         ⌊        ⌋
        0.010
δ𝜃 = ⌈ − 0.020 ⌉ rad,
        0.030

    form the first order passive small rotation quaternion.

  7. Active versus passive diagnostic.

    A positive 90∘ geometric rotation about +z is represented by the active rotor

    qa = 1√+-k-.
        2

    Write the passive frame quaternion for the same geometry and state the relationship between the two.

  8. Finite frame chain.

    Suppose

    BqA =  1√ −-i
         2

    and

           1 − j
C qB = -√---.
          2

    Compute Cq A.

Part III: composition, DCMs, and Euler angles

  1. Noncommuting order.

    Using

    qx =  1√ −-i,    qy = 1√−-j,
        2               2

    compute qyqx and qxqy. Explain why the results differ.

  2. Quaternion to DCM.

    Convert

        1 − k
q = -√----
       2

    to a direction cosine matrix.

  3. DCM to quaternion.

    Recover a passive unit quaternion from

         ⌊ 0   1  0⌋
     ⌈         ⌉
C =   − 1  0  0  .
       0   0  1
  4. DCM column interpretation.

    For the matrix in Exercise 19, interpret each of the three columns geometrically.

  5. Transpose and conjugate.

    Prove

        ∗        T
C (q ) = C(q) .

    Interpret this result as a reversal of frame map direction.

  6. Quaternion and DCM composition.

    Show that under the PhysicsLibrary convention

    C (pq) = C (p)C(q).

    Use Exercise 16 as a numerical check.

  7. Pure yaw Euler conversion.

    For intrinsic 3-2-1 yaw, pitch, roll with

    ϕ = 0,     𝜃 = 0,    ψ =  60∘,

    compute the passive quaternion.

  8. General 3  -2  -1  quaternion.

    For

          ∘              ∘            ∘
ϕ = 20 ,     𝜃 = − 10 ,    ψ =  30 ,

    compute

    B       P    P     P
 qA =  q1 (ϕ)q2 (𝜃)q3 (ψ)

    to at least six decimal places.

  9. Recover Euler Angles.

    Given a passive quaternion with corresponding DCM entries

    C13 =  − 0.5,    C23 = 0.4330127,     C33 = 0.75,

    C   =  0.75,    C   =  0.4330127,
  12              11

    recover the principal intrinsic 3-2-1 roll, pitch, and yaw angles.

  10. Gimbal lock.

    Explain why the intrinsic 3-2-1 representation becomes singular at

    𝜃 = ±90 ∘.

    What remains well defined?

Part IV: quaternion kinematics and angular velocity

  1. Derivative at the identity.

    For

    q(0) = 1

    and constant body resolved angular velocity

    ωB =  Ωk,

    compute q(0).

  2. Body resolved component equations.

    Starting from

          1- B
˙q = − 2ω  q,

    derive the four scalar component equations.

  3. Norm preservation.

    Prove that the exact continuous quaternion kinematic equation preserves

    qTq = 1.
  4. Exact constant rate propagation.

    Let

                       ⌊  ⌋
                     1
q(0) = 1,    ωB  = ⌈ 2⌉ rad∕s.
                     2

    Find the exact quaternion at

    t = 0.2 s.
  5. Recover angular velocity.

    Starting from

          1  B
˙q = − -ω  q,
      2

    derive ωB in terms of q and q.

  6. Body versus reference resolved rate.

    Prove that

          1         1
˙q = − -ωBq  = − --qωI
      2         2

    when

    ωB =  qωIq∗.
  7. Forward Euler norm drift.

    With

    qk = 1,    ωB  = 0.5k,     Δt = 0.1 s,

    compute one forward Euler step and its norm.

  8. DCM kinematics.

    Derive

    B ˙        B  B
  CI = − [ω ]×  CI.

Part V: relative attitude and error quaternions

  1. Left and right errors.

    Given actual attitude q and desired attitude qd, derive

    δqL = qdq∗

    and

            ∗
δqR =  q qd.

    Show how each reconstructs qd.

  2. 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.

  3. Small passive attitude error.

    An error quaternion is locally

         ⌊   1   ⌋
     |       |
δq ≈ | 0.005 | .
     ⌈− 0.010⌉
       0.020

    Recover the first order physical frame error vector.

  4. Transport right error to left error.

    Show that

                ∗
δqL = qδqRq  .

    Then derive the first order vector relation

    δ𝜃L = C (q)δ𝜃R.
  5. Principal sign choice.

    An error calculation returns

         ⌊             ⌋
      − 0.99904822
δq = ||      0      || .
     ⌈      0      ⌉
       0.04361939

    Select the principal representative and recover the physical frame error.

Part VI: IMU attitude state propagation

  1. Bias corrected IMU update.

    A body gyroscope reports

          ⌊       ⌋
         0.01
ωBm = ⌈ − 0.02 ⌉rad ∕s,
         0.53

    with bias estimate

          ⌊      ⌋
        0.01
^bg =  ⌈− 0.02⌉ rad∕s.
        0.03

    For

    qk = 1,     Δt =  0.1 s,

    compute the corrected rate, delta angle, exact passive increment, and qk+1.

  2. Body increment multiplication side.

    Use frame labels to prove that a body resolved IMU increment satisfies

    qk+1 = δqBqk

    for qk = Bq I.

  3. Two small increments and coning.

    Two successive body increments are

    Δ𝜃1

    and

    Δ 𝜃2.

    Show to second order that the equivalent physical rotation vector is

                          1
Δ 𝜃eq ≈ Δ 𝜃1 + Δ 𝜃2 + -Δ 𝜃1 × Δ 𝜃2.
                      2
  4. Quaternion sign continuity.

    Suppose two successive numerical states satisfy

    qT  qk < 0.
 k+1

    What operation should be performed if a continuous quaternion time history is desired? Does the operation change physical attitude?

  5. Specific force transformation.

    The attitude state is

    q = BqI.

    An accelerometer measures Bf. Derive the DCM and quaternion expressions for If.

  6. Capstone convention audit.

    A legacy routine propagates a quaternion using

                  (        )
q    = q  exp  + 1-Δ𝜃B
 k+1    k        2

    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

[q ,q ,q ,q ]
  x  y  z  w

is scalar last storage.

The rule

ij = k

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,

ik =  − j,

ki = j,

ji = − k.

Also,

ijk = kk =  − 1.

Finally,

jik = (− k)k = 1.

Solution 3: general quaternion product

Using scalar vector form or direct expansion,

p = (1,[2,− 1,3]),    q = (2,[− 1,4,1]).

The scalar part of pq is

1(2) − [2,− 1,3] ⋅ [− 1,4,1] = 2 − (− 3) = 5.

The vector part is

1[− 1,4,1] + 2[2,− 1,3] + [2, − 1,3 ] × [− 1,4, 1].

The cross product is

[− 13,− 5,7].

Hence

pq = 5 − 10i − 3j + 14k.

For qp, the cross product reverses sign:

qp = 5 + 16i + 7j.

Solution 4: conjugate and product reversal

Write

p = pw + p,     q = qw + q.

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

q × p  = − p × q.

Therefore

(pq)∗ = q∗p∗.

For Exercise 3,

pq = 5 − 10i − 3j + 14k,

so

(pq )∗ = 5 + 10i + 3j − 14k.

Direct multiplication of q∗p∗ gives the same result.

Solution 5: norm and inverse

For

q = 2 − i + 2j + 2k,

the norm is

       √-------------   √ ---
∥q∥ =   4 + 1 + 4 + 4 =   13.

The conjugate is

 ∗
q =  2 + i − 2j − 2k.

Therefore

 −1   2-+-i −-2j −-2k-
q   =       13       .

Since

qq∗ = 13,

we have

  −1   qq ∗
qq   = -13-=  1.

Solution 6: normalization

The norm is

√ -------------   √ ---
  4 + 1 + 4 + 4 =   13.

Therefore

         ⌊   ⌋
           2
^q = √1---||− 1|| .
      13 ⌈ 2 ⌉
           2

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

     ∗      ∗
(− q) =  − q ,

we have

(− q)v(− q)∗ = (− q)v(− q∗) = qvq ∗.

Thus q and −q represent the same physical orientation. Unit quaternions double cover the rotation group.

Solution 8: pure quaternion square

Expand

u2 = (ai + bj + ck)2.

The diagonal terms give

   2   2    2
− a − b  − c .

Every mixed pair cancels because, for example,

ab(ij + ji) = ab(k − k) = 0.

Therefore

u2 =  − (a2 + b2 + c2) = − 1.

Solution 9: positive 90∘ frame rotation about +z

The passive axis angle formula gives

B            ∘         ∘
  qA = cos45  − k sin45 .

Hence

B      1-−-k-
 qA =   √2-- .

Solution 10: arbitrary axis construction

The half angle is 30∘, so

         √ --
cos30∘ = --3-,    sin30∘ =  1.
          2                 2

Thus

       √3--   1( 1    2    2  )
BqA  = ----−  -- --i +--j +--k  .
        2     2  3    3    3

Therefore

       √ --
Bq   = --3-− 1-i − 1j − 1k.
   A    2    6     3    3

Solution 11: passive coordinate transformation

From Exercise 9,

     1 −-k-
q =   √2--.

The corresponding passive DCM is

        ⌊         ⌋
          0   1  0
C (q) = ⌈− 1  0  0⌉ .
          0   0  1

Therefore

           ⌊1 ⌋   ⌊  0 ⌋
B          ⌈  ⌉   ⌈    ⌉
  v = C (q) 0   =   − 1 .
            0        0

The fixed physical vector has B coordinates along −y.

Solution 12: passive Rodrigues formula

Let

q = c − ^us,     c = cos 𝜃-,   s = sin 𝜃-.
                       2             2

Expand

qvq∗ = (c − ^us)v (c + ^us ).

Using pure quaternion multiplication and collecting vector terms gives

(c2 − s2)v −  2cs(^u × v) + 2s2^u(^u ⋅ v ).

Use

c2 − s2 = cos𝜃,

2cs = sin𝜃,

and

  2
2s  = 1 − cos𝜃.

Then

vB = vA  cos𝜃 − (^u × vA )sin 𝜃 + ^u(^u ⋅ vA )(1 − cos𝜃).

Solution 13: extract axis and angle

The scalar component is

      √2--
qw =  ----= cos45 ∘.
       2

Therefore

𝜃 = 90∘.

The vector part is

      ⌊ ⌋
  √ -- 1
− --6-⌈1⌉ .
   6
       1

Its norm is

√ --
--2.
 2

For a passive quaternion, the physical frame axis is opposite the normalized vector part:

        ⌊  ⌋
     1    1
^u =  √--⌈ 1⌉ .
      3   1

Solution 14: small frame rotation

The passive first order small frame quaternion is

     [     ]
δq ≈    11    .
      − 2δ𝜃

Hence

     ⌊       ⌋
         1
     |− 0.005|
δq ≈ |⌈       |⌉ .
       0.010
      − 0.015

Solution 15: active versus passive diagnostic

The passive frame quaternion for the same positive geometric frame rotation is the conjugate of the active rotor:

      ∗    1 − k
qp = qa =  -√---.
              2

Thus

q =  q∗.
 p    a

Solution 16: finite frame chain

The chain is

C qA = CqBBqA.

Therefore

Cq  =  1(1 − j)(1 − i).
  A    2

Since

ji = − k,

we obtain

Cq  =  1(1 − i − j − k ).
  A    2

Solution 17: noncommuting order

First,

       1-                1-
qyqx = 2 (1 − j)(1 − i) = 2(1 − i − j − k).

Second,

       1-                1-
qxqy = 2 (1 − i)(1 − j) = 2(1 − i − j + k).

They differ because

ij = k,    ji = − k.

Finite rotations about different axes do not commute.

Solution 18: quaternion to DCM

For

     1 − k
q =  -√---,
        2

we have

      √ --           √ --
qw =  --2,    qz = − --2-.
       2              2

Substitution into the passive quaternion DCM formula gives

        ⌊         ⌋
          0   1  0
C (q) = ⌈− 1  0  0⌉ .

          0   0  1

Solution 19: DCM to quaternion

The trace is

1.

Hence

      1√ -----   √2--
qw =  -- 1 + 1 = ---.
      2           2

Then

                               √ --
qz = C21-−-C12-=  -− 1√-−-1-= − --2-.
        4qw       4(  2∕2)      2

The other vector components are zero.

Thus

     1 −-k-
q =   √2--.

The negative quaternion is equally valid.

Solution 20: DCM column interpretation

For

     ⌊ 0   1  0⌋
     ⌈         ⌉
C =   − 1  0  0  ,
       0   0  1

the first column is

⌊    ⌋
   0
⌈ − 1 ⌉,
   0

so the A frame x basis direction has B coordinates −yB.

The second column is

⌊  ⌋
  1
⌈ 0⌉ ,

  0

so the A frame y basis direction has B coordinates +xB.

The third column is

⌊  ⌋
  0
⌈ 0⌉ ,
  1

so the z axes coincide.

Solution 21: transpose and conjugate

The conjugate is the inverse unit quaternion:

q∗ = q− 1.

The DCM of the inverse transformation is the inverse matrix:

   ∗         −1
C(q ) = C (q)  .

A proper DCM is orthogonal, so

    −1        T
C(q)   = C (q) .

Therefore

C (q∗) = C(q)T.

Quaternion conjugation reverses the passive frame map direction.

Solution 22: quaternion and DCM composition

For any vector,

C (pq)v

is represented by the quaternion sandwich

         ∗
(pq)v(pq) .

Since

    ∗    ∗ ∗
(pq)  = q p ,

we have

(pq)vq∗p∗ = p(qvq∗)p∗.

Thus the transformation associated with q is applied first and the transformation associated with p second. Therefore

C (pq) = C (p)C(q).

For Exercise 16,

C(qyqx) = C (qy)C(qx),

which gives the same direct A → C frame map.

Solution 23: pure yaw Euler conversion

For a pure yaw,

B       P          ψ         ψ
 qA =  q3 (ψ ) = cos-−  ksin --.
                   2         2

For

       ∘
ψ  = 60 ,

       √3--   1
BqA  = ----−  -k.
        2     2

Solution 24: general 3  -2  -1  quaternion

Using

BqA =  qP1 (20∘)qP2 (− 10∘)qP3 (30 ∘),

the passive scalar first components are approximately

       ⌊           ⌋
         0.943714
       |− 0.189308 |
BqA ≈  |⌈           |⌉ .
         0.038135
        − 0.268536

Solution 25: recover Euler angles

For passive intrinsic 3-2-1,

𝜃 = arcsin(− C  ).
              13

Thus

                    ∘
𝜃 = arcsin(0.5 ) = 30 .

Next,

ϕ =  atan2(C23,C33 ) = atan2 (0.4330127,0.75) = 30∘.

Finally,

ψ =  atan2(C  ,C   ) = atan2(0.75,0.4330127) = 60 ∘.
             12   11

Therefore

              ∘   ∘   ∘
(ϕ, 𝜃,ψ) = (30 ,30 ,60 ).

Solution 26: gimbal lock

For intrinsic 3-2-1,

C13 = − sin 𝜃.

At

𝜃 = ±90 ∘,

we have

cos𝜃 = 0.

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

      1  B
˙q = − -ω  q.
      2

At

            B
q = 1,    ω   = Ωk,

we obtain

         Ω
q˙(0) = − --k.
         2

Solution 28: body resolved component equations

Let

q = qw + qxi + qyj + qzk

and

ωB =  ωxi + ωyj + ωzk.

Expanding

− 1ωBq
  2

gives

˙qw = 1-(ωxqx + ωyqy + ωzqz),
     2

     1
˙qx = -(− ωxqw +  ωzqy − ωyqz),
     2

     1-
˙qy = 2(− ωyqw − ωzqx +  ωxqz),

˙q =  1(− ω q  + ω  q −  ω q ).
 z   2    z w     y x    x y

Solution 29: norm preservation

Differentiate

q∗q = 1.

From

      1- B
˙q = − 2ω  q,

we have

˙q∗ = 1q∗ωB,
     2

because ωB is pure.

Therefore

d-  ∗      ∗     ∗
dt(q q) = ˙q q + q ˙q
          1         1
       =  -q∗ωBq  − --q∗ωBq
          2         2
       =  0.

Hence unit norm is preserved exactly in continuous time.

Solution 30: exact constant rate propagation

The rate magnitude is

     √ -2----2---2-
Ω =    1 + 2  + 2  = 3 rad∕s.

The unit axis is

      ⌊  ⌋
        1
^ω =  1⌈ 2⌉ .
     3
        2

At t = 0.2 s,

𝜃 = Ωt =  0.6 rad.

Therefore

                1
q(t) = cos0.3 − --(i + 2j + 2k)sin0.3.
                3

Numerically,

    ⌊              ⌋
      0.955336489
    ||− 0.098506736 ||
q ≈ ⌈− 0.197013471 ⌉ .
     − 0.197013471

Solution 31: recover angular velocity

Start with

˙q = − 1ωBq.
      2

Right multiply by q∗:

  ∗     1- B  ∗     1- B
˙qq  = − 2ω  qq  = − 2 ω  .

Thus

ωB  = − 2q˙q∗.

Solution 32: body versus reference resolved rate

Given

 B      I ∗
ω  =  qω q ,

we have

  B       I ∗      I
ω  q = qω  q q = qω .

Therefore

− 1ωBq  = − 1qωI .
  2         2

The two equations describe the same physical angular velocity resolved in different frames.

Solution 33: forward Euler norm drift

At the identity,

      1-
˙q = − 2(0.5k) = − 0.25k.

For Δt = 0.1 s,

qE  =  1 − 0.025k.
 k+1

The norm is

√ ----------   √ ---------
  1 + 0.0252 =   1.000625 ≈ 1.000312451.

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,

B     B   I
  v =  CI  v.

A rotating frame observes

B ˙v = − ωB ×  Bv.

Thus

B ˙v = − [ωB ]×BCI Iv.

Since Iv is arbitrary,

B ˙C  = − [ωB] BC  .
   I         ×   I

Solution 35: left and right errors

For a left error,

qd = δqLq.

Right multiply by q∗:

         ∗
δqL = qdq .

For a right error,

qd = qδqR.

Left multiply by q∗:

        ∗
δqR =  q qd.

Thus

qd = δqLq = qδqR.

Solution 36: same axis attitude error

The actual attitude is

q = cos5∘ − k sin 5∘.

The desired attitude is

qd = cos 12.5∘ − k sin12.5∘.

Therefore

δqL =  qdq∗ = cos7.5∘ − ksin7.5∘.

This represents a positive frame yaw error of

  ∘
15

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,

δ 𝜃 ≈ − 2δqv.

Therefore

        ⌊        ⌋   ⌊        ⌋
           0.005       − 0.010
δ𝜃 ≈ − 2⌈ − 0.010 ⌉ = ⌈  0.020 ⌉ rad.
           0.020       − 0.040

Solution 38: transport right error to left error

Starting from

        ∗
δqR =  q qd,

multiply by q on the left and q∗ on the right:

     ∗     ∗   ∗      ∗
qδqRq  = qq qdq  = qdq =  δqL.

For small passive errors,

           1
δqR ≈  1 − -δ𝜃R.
           2

Then

          1-      ∗
δqL ≈ 1 − 2 qδ𝜃Rq  .

Since the quaternion sandwich transforms vector coordinates,

δ𝜃  = C (q)δ𝜃  .
  L          R

Solution 39: principal sign choice

The scalar component is negative, so multiply the whole quaternion by −1:

      ⌊             ⌋
         0.99904822
      |       0     |
δqp = |⌈       0     |⌉ .

        − 0.04361939

The scalar is approximately

cos2.5∘,

so the full angle is

 ∘
5 .

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

                  ⌊    ⌋
                     0
^ωB  = ωBm − ^bg =  ⌈  0 ⌉ rad∕s.
                   0.50

The delta angle is

                ⌊     ⌋
                   0
Δ 𝜃B = ω^B  Δt = ⌈  0  ⌉ rad.
                  0.05

The exact passive increment is

δqB  = cos0.025 − k sin 0.025.

Numerically,

      ⌊              ⌋
        0.999687516
δq  ≈ ||       0      || .
  B   ⌈       0      ⌉
        − 0.024997396

Since qk = 1,

q   =  δq q  = δq  .
 k+1     B k     B

Solution 41: body increment multiplication side

At sample k,

     B
qk =  kqI

maps

I → Bk.

The measured body increment is

δq   = Bk+1q  ,
   B        Bk

which maps

Bk →  Bk+1.

The frame chain is therefore

I →  Bk →  Bk+1.

Thus

B        B      B
 k+1qI =  k+1qBk kqI,

or

qk+1 = δqBqk.

Solution 42: two small increments and coning

For small passive increments,

δq1 ≈ 1 − 1Δ 𝜃1
          2

and

δq2 ≈  1 − 1Δ 𝜃2.
           2

Chronological body increments compose as

δq21 = δq2δq1.

Expanding through second order,

δq   ≈ 1 − 1-(Δ 𝜃 +  Δ𝜃  ) + 1Δ 𝜃 Δ 𝜃 .
   21       2     1      2    4   2   1

The vector part of the last product is

1Δ 𝜃2 × Δ 𝜃1 = − 1Δ 𝜃1 × Δ 𝜃2.
4                4

Matching

1 −  1Δ 𝜃
     2   eq

gives

Δ 𝜃eq ≈ Δ 𝜃1 + Δ 𝜃2 + 1Δ 𝜃1 × Δ 𝜃2.
                      2

Solution 43: quaternion sign continuity

If

qTk+1qk < 0,

replace

qk+1 ←  − qk+1.

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

q = BqI

maps inertial coordinates into body coordinates.

Therefore the inverse DCM maps body specific force back into inertial coordinates:

If = IC  Bf = C (q)TBf .
       B

The equivalent quaternion expression is

I     ∗B
 f = q  f q.

Solution 45: capstone convention audit

The legacy routine uses

             (         )
                 1-  B
qk+1 = qk exp  + 2Δ 𝜃    .

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:

           (  1    B)
δqB =  exp  − --Δ𝜃    .
              2

Second, a body resolved increment must left multiply the passive inertial to body state.

Therefore the corrected update is

           (         )
qk+1 = exp   − 1Δ 𝜃B   qk.
               2

3 Suggested grading progression

The problem set may be used in four passes:

  1. Exercises 1–8 for algebra and convention fluency;
  2. Exercises 9–26 for finite attitude representation and conversion;
  3. Exercises 27–39 for dynamics, estimation, and attitude error;
  4. 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.


"quaternion exercises for physics and engineering" is owned by bloftin.
(view preamble)
View style:
See Also: quaternion series overview and article guide, Quaternions for Physics and Engineering: Orientation, Notation, and Conventions, quaternion definition and basic algebra, example of quaternion definition and basic algebra, quaternion product, example of quaternion product, quaternion conjugate, example of quaternion conjugate, quaternion norm, example of quaternion norm, quaternion inverse, example of quaternion inverse

Keywords:  quaternion, rotation, attitude, direction cosine matrix, Euler angles, angular velocity, IMU, exercises, worked solutions

This object's parent.

Cross-references: magnitude, trace, commute, conjugation, cross product, force, operation, relation, error quaternion, kinematic, angular velocity, Euler Angles, composition, matrix, direction cosine matrix, formula, square, unit, representation, vector, norm, identity, quaternion product, scalar, quaternion
There is 1 reference to this object.

This is version 2 of quaternion exercises for physics and engineering, born on 2026-08-24, modified 2026-08-28.
Object id is 1112, canonical name is QuaternionExercisesForPhysicsAndEngineering.
Accessed 285 times total.

Classification:
Physics Classification: 02.40.Yy (Geometric mechanics )
 02.10.Hh (Rings and algebras)
 45.40.-f (Dynamics and kinematics of rigid bodies)
 06.30.Gv (Velocity, acceleration, and rotation)

Pending Errata and Addenda

None.

Discussion

No messages.

Interact