3.5.8 · D4Guidance, Navigation & Control (GNC)

Exercises — Quaternion rotation formula — rotating vector v by quaternion q

2,101 words10 min readBack to topic

Two conventions we reuse everywhere on this page:

Here means a unit axis (length 1). The little hat is just a reminder "this arrow has length one." is the turn angle, and is the half-angle that lives inside because is used twice in the sandwich.


Level 1 — Recognition

Can you read a quaternion and spot what rotation it encodes?

Recall Solution L1.1

WHAT we do: match . The scalar part is , so and The vector part is . Since , the axis is — the -axis. Answer: a rotation about .

Recall Solution L1.2

A rotation quaternion must have length . Compute So no, it is not valid. Normalize by dividing by the length: Now about the -axis.

Recall Solution L1.3

For a unit quaternion, inverse = conjugate = flip the sign of the vector part only: Geometric read: rotates about ; rotates about — the undo.


Level 2 — Application

Actually rotate vectors.

Recall Solution L2.1

Use Rodrigues with (), , .

  • (so the last term vanishes),
  • . What it looks like: the arrow swings a quarter-turn counter-clockwise onto (see figure below).
Figure — Quaternion rotation formula — rotating vector v by quaternion q
Recall Solution L2.2

Here points along the axis .

  • , . Unchanged. A spin about cannot move something already pointing along .
Recall Solution L2.3

: , . , .

  • .
  • .

Term by term: Add: What it looks like: a turn about the body-diagonal cyclically maps ; indeed . ✓


Level 3 — Analysis

Reason about structure, not just plug numbers.

Recall Solution L3.1

The sandwich is . Because (flipping every entry flips the inverse too), The two minus signs cancel. Numerically both give from L2.1. Meaning: and are the same physical rotation — quaternions double-cover rotations.

Recall Solution L3.2

, .

(a) first. Rotate by about : , , . Then about : , . Result (a): .

(b) first. Rotate by about : it's on-axis ⇒ stays . Then about : . Result (b): .

order matters. The single-quaternion form makes it obvious: (a) is , (b) is , and .

Recall Solution L3.3

Take the conjugate of a product (it reverses order): . For unit : , so and . A pure quaternion satisfies . Substitute: A quaternion equal to minus its own conjugate has scalar part with . Hence is pure — a legal 3D vector. ∎


Level 4 — Synthesis

Combine several ideas or build a quaternion from scratch.

Recall Solution L4.1

Axis: perpendicular to both vectors ⇒ their cross product direction. , already unit. Angle: between and the angle is (dot product ). Half-angle build: Check with L2.1: this indeed sends . ✓

Recall Solution L4.2

, . Hamilton product with , , :

  • scalar: .
  • , ,
  • vector part: .

So . Check norm: ✓. Axis–angle: ; vector length , so Read: two turns fuse into one turn about .

Recall Solution L4.3

Apply then : the combined quaternion (rightmost first) is . But , the identity quaternion. Then Every vector comes home. This is why is literally the "undo" rotation.


Level 5 — Mastery

Edge cases, limits, and the tools of real GNC.

Recall Solution L5.1

: the identity (no rotation). The vector part is , so and the axis is undefined — you cannot divide by zero. Interpretation: a zero-angle rotation has no preferred axis; every axis works because nothing moves. Software must special-case this (e.g. return the identity axis) instead of dividing .

Recall Solution L5.2

, , so — a pure quaternion (zero scalar). This is the borderline where and are hardest to tell apart, and where the scalar carries no angle info; the axis lives entirely in the vector part. With , Rodrigues: , : A half-turn about flips to . ✓ (See figure.)

Figure — Quaternion rotation formula — rotating vector v by quaternion q
Recall Solution L5.3

From L2.3, . By the same cyclic symmetry, .

  • Lengths: , — preserved.
  • Dot product: — still perpendicular. Why this must happen: preserves dot products (it's an orthogonal transformation), so angles and lengths are untouched — this is what makes it a genuine rotation and not a stretch. This is the quaternion route to Rotation matrices & orthogonality.
Recall Solution L5.4

With constant along , the solution of is a steady rotation whose angle grows as about : At this is ✓. The half-angle reappears — the rate is inside but the body physically turns at . This connects to > Angular velocity & quaternion kinematics $\dot q=\tfrac12 q\omega$ and > Spacecraft attitude determination (GNC).


Recall One-line summary of the whole page

Build with the half-angle, rotate with the sandwich (or Rodrigues with the full angle), respect order in composition, and special-case the degenerate () and axes. Related: Rodrigues' rotation formula, SLERP — quaternion interpolation, Euler angles & gimbal lock, Quaternion algebra & Hamilton product.