Physics Library
 An open source physics library
Encyclopedia | Forums | Docs | Random | Template Test |  
Login
create new user
Username:
Password:
forget your password?
Main Menu
Sections

Meta

Talkback

Downloads

Information
Axis Angle Representation and Unit Quaternion (Definition)

Axis Angle Representation and Unit Quaternion

A three dimensional rigid body rotation can be described by an axis and an angle. The axis is a unit vector $\widehat{\mathbf u}$ that remains fixed by the rotation, and the angle $\theta$ specifies how far the body or vector is rotated about that axis. Unit quaternions encode exactly this axis angle information in a compact algebraic form.

For the PhysicsLibrary convention, a positive active rotation through angle $\theta$ about the right-hand rule unit axis $\widehat{\mathbf u}$ is represented by

$\displaystyle \boxed{ q =\cos\frac{\theta}{2} +\widehat{\mathbf u}\sin\frac{\theta}{2}. }$ (1)
The appearance of the half angle is fundamental. It is not a storage convention and it is not an arbitrary factor inserted for convenience. It follows from the way a unit quaternion acts on three dimensional vectors.

This entry develops the axis angle form and explains the half angle. The next PhysicsLibrary entry derives the full vector rotation formula $q\mathbf v q^*$ and its equivalence to Rodrigues' rotation formula.

Convention declaration

Unless explicitly stated otherwise, this entry uses Hamilton multiplication,

$\displaystyle \mathbf i\mathbf j=\mathbf k, \qquad \mathbf j\mathbf k=\mathbf i, \qquad \mathbf k\mathbf i=\mathbf j, $
with reversed products changing sign. Physical Cartesian frames are right-handed, positive rotation follows the right-hand screw rule, and quaternion components are displayed scalar first:
$\displaystyle q =q_w+q_x\mathbf i+q_y\mathbf j+q_z\mathbf k \quad\longleftrightarrow\quad \begin{bmatrix} q_w&q_x&q_y&q_z \end{bmatrix}^{T}.$ (2)
Scalar-first versus scalar-last storage is only a component layout choice; it does not change the quaternion multiplication law or the physical rotation.

Axis angle representation

Euler's finite rotation result states that any proper rigid rotation in three dimensions can be represented by a rotation through some angle $\theta$ about some axis. Let

$\displaystyle \widehat{\mathbf u} =u_x\mathbf i+u_y\mathbf j+u_z\mathbf k, \qquad u_x^2+u_y^2+u_z^2=1.$ (3)
The vector $\widehat{\mathbf u}$ is identified with a pure quaternion. Because it is a unit pure quaternion,
$\displaystyle \boxed{\widehat{\mathbf u}^{\,2}=-1.}$ (4)
Thus an arbitrary spatial unit axis behaves algebraically like an imaginary unit.

The pair

$\displaystyle (\widehat{\mathbf u},\theta) $
is called an axis angle representation of the rotation. In engineering the same information is often packaged into the rotation vector
$\displaystyle \boxed{\boldsymbol\theta=\theta\widehat{\mathbf u}.}$ (5)
The direction of $\boldsymbol\theta$ is the Euler axis and its magnitude is the rotation angle.

Unit quaternions and quaternion exponentials

Since $\widehat{\mathbf u}^{\,2}=-1$, the power series expansion of the quaternion exponential separates into even and odd powers exactly as it does for the complex exponential:

$\displaystyle \boxed{ \exp(\widehat{\mathbf u}\phi) =\cos\phi+\widehat{\mathbf u}\sin\phi. }$ (6)
Indeed,

\begin{equation*} \begin{aligned} \exp(\widehat{\mathbf u}\phi) &=1+\widehat{\ma... ...-\frac{\phi^3}{3!}+\frac{\phi^5}{5!}-\cdots\right). \end{aligned}\end{equation*}
Therefore a quaternion of the form
$\displaystyle q=\cos\phi+\widehat{\mathbf u}\sin\phi$ (7)
has unit norm, because
\begin{equation*}\begin{aligned} \lVert q\rVert^2 &=\cos^2\phi +\lVert\widehat{\... ...Vert^2\sin^2\phi\ &=\cos^2\phi+\sin^2\phi\ &=1. \end{aligned}\end{equation*}
Hence $q$ is a unit quaternion, and
$\displaystyle \boxed{q^{-1}=q^*.}$ (9)

Why the quaternion uses half the physical rotation angle

The half angle can be seen with a minimal rotation calculation. Let $\mathbf v$ be a unit vector perpendicular to the proposed rotation axis $\widehat{\mathbf u}$, and define

$\displaystyle \mathbf w=\widehat{\mathbf u}\times\mathbf v.$ (10)
For Hamilton multiplication and perpendicular pure quaternions,

$\displaystyle \widehat{\mathbf u}\mathbf v=\mathbf w, \qquad \mathbf v\widehat{... ...=-\mathbf w, \qquad \widehat{\mathbf u}\mathbf v\widehat{\mathbf u}=\mathbf v. $
Now write
$\displaystyle q=\cos\phi+\widehat{\mathbf u}\sin\phi =c+s\widehat{\mathbf u},$ (11)
where $c=\cos\phi$ and $s=\sin\phi$. Since $q$ is unit, $q^*=c-s\widehat{\mathbf u}$. Acting on the perpendicular test vector gives
\begin{equation*}\begin{aligned} q\mathbf v q^* &=(c+s\widehat{\mathbf u})\mathb... ...at{\mathbf u}\ &=(c^2-s^2)\mathbf v+2cs\mathbf w. \end{aligned}\end{equation*}
Using the double angle identities,
$\displaystyle \boxed{ q\mathbf v q^* =\cos(2\phi)\mathbf v +\sin(2\phi)\mathbf w. }$ (13)
The vector has therefore rotated in the plane perpendicular to $\widehat{\mathbf u}$ through the physical angle
$\displaystyle \boxed{\theta=2\phi.}$ (14)
Consequently the unit quaternion that represents a physical rotation through $\theta$ must use
$\displaystyle \boxed{ q =\cos\frac{\theta}{2} +\widehat{\mathbf u}\sin\frac{\theta}{2} =\exp\left(\frac{\theta}{2}\widehat{\mathbf u}\right). }$ (15)
This limited perpendicular vector calculation establishes the half angle. The next article carries out the general calculation for an arbitrary vector with components both parallel and perpendicular to the rotation axis.

Scalar-first component form

With

$\displaystyle \widehat{\mathbf u} =u_x\mathbf i+u_y\mathbf j+u_z\mathbf k, $
equation (14) becomes
$\displaystyle \boxed{ q= \begin{bmatrix} \cos(\theta/2)\ u_x\sin(\theta/2)\ u_y\sin(\theta/2)\ u_z\sin(\theta/2) \end{bmatrix}. }$ (16)
Thus
$\displaystyle q_w=\cos\frac{\theta}{2}, \qquad \mathbf q =\widehat{\mathbf u}\sin\frac{\theta}{2}.$ (17)
The vector part points along the rotation axis, while its magnitude is the sine of half the rotation angle.

Recovering axis and angle from a unit quaternion

Suppose

$\displaystyle q=q_w+\mathbf q, \qquad \lVert q\rVert=1.$ (18)
Define
$\displaystyle s=\lVert\mathbf q\rVert.$ (19)
A numerically useful extraction is
$\displaystyle \boxed{ \theta=2\operatorname{atan2}(s,q_w). }$ (20)
When $s\neq0$, the axis is
$\displaystyle \boxed{ \widehat{\mathbf u}=\frac{\mathbf q}{s}. }$ (21)
The equivalent expression

$\displaystyle \theta=2\arccos(q_w) $
is common, but $\operatorname{atan2}$ uses both scalar and vector information and is generally preferable in numerical software. The quaternion should be normalized before extracting an angle.

If a principal rotation with

$\displaystyle 0\leq\theta\leq\pi $
is desired, a common engineering choice is first to replace $q$ by $-q$ when $q_w<0$. This chooses the representative with nonnegative scalar part and therefore selects the shorter of the two equivalent rotation angles.

The sign ambiguity: $q$ and $-q$

A unit quaternion and its negative represent the same physical orientation. The vector rotation action satisfies

$\displaystyle \boxed{ (-q)\mathbf v(-q)^*=q\mathbf v q^*. }$ (22)
Therefore the mapping from unit quaternions to physical rotations is two-to-one. This is the practical source of the familiar sign ambiguity in attitude data.

The axis angle form makes the same fact visible. Increasing the physical angle by $2\pi$ gives

\begin{equation*}\begin{aligned} q(\theta+2\pi) &=\cos\left(\frac{\theta}{2}+\pi... ...n\left(\frac{\theta}{2}+\pi\right)\ &=-q(\theta). \end{aligned}\end{equation*}
A further $2\pi$ returns to the same quaternion:
$\displaystyle \boxed{q(\theta+4\pi)=q(\theta).}$ (24)
The deeper $S^3$ and $SU(2)$ interpretation of this double covering belongs to the later mathematical branch of the PhysicsLibrary quaternion sequence.

Important special cases

Zero rotation

For $\theta=0$,

$\displaystyle \boxed{q=1.}$ (25)
The axis is physically irrelevant and therefore undefined. This is why axis extraction becomes ill-conditioned when the vector part of the quaternion is very small.

Rotation through $\pi$ radians

For $\theta=\pi$,

$\displaystyle \boxed{q=\widehat{\mathbf u}.}$ (26)
The scalar part is zero. Both $\widehat{\mathbf u}$ and $-\widehat{\mathbf u}$ represent the same $180^\circ$ physical rotation because the corresponding quaternions differ only by sign.

Rotation through $2\pi$ radians

For $\theta=2\pi$,

$\displaystyle \boxed{q=-1.}$ (27)
This is the same physical orientation as $q=+1$, although the quaternion itself has changed sign.

Small-angle form used in engineering

Let the rotation vector be

$\displaystyle \boldsymbol\theta=\theta\widehat{\mathbf u}. $
For a small rotation, $\vert\theta\vert\ll1$ rad,

$\displaystyle \cos\frac{\theta}{2}\approx1-\frac{\theta^2}{8}, \qquad \sin\frac{\theta}{2}\approx\frac{\theta}{2}. $
Therefore
$\displaystyle \boxed{ q \approx 1+\frac12\boldsymbol\theta }$ (28)
when the rotation vector is identified with a pure quaternion. In scalar-first components,
$\displaystyle \boxed{ q\approx \begin{bmatrix} 1\ \tfrac12\theta_x\ \tfrac12\theta_y\ \tfrac12\theta_z \end{bmatrix}. }$ (29)
This approximation is ubiquitous in attitude-error Kalman filters and local linearizations. It is a first-order approximation; the quaternion should not be assumed to have exactly unit norm after arbitrary finite updates unless it is renormalized or constructed with the exact trigonometric formula.

Active and passive interpretation

Equation (14) is the PhysicsLibrary formula for a positive active rotation. If $q$ actively rotates vectors by $+\theta$ about $\widehat{\mathbf u}$, then

$\displaystyle \boxed{ q^*=q^{-1} =\cos\frac{\theta}{2} -\widehat{\mathbf u}\sin\frac{\theta}{2} }$ (30)
represents the inverse active rotation, namely $-\theta$ about the same axis. The same inverse quaternion also appears when the corresponding transformation is interpreted passively as a coordinate change in the opposite direction.

This sign change must not be confused with scalar-first versus scalar-last storage or with Hamilton versus flipped quaternion multiplication. Those are separate convention choices established in the PhysicsLibrary convention entry.

Common pitfalls

  1. Forgetting to normalize the axis. The vector $\widehat{\mathbf u}$ in equation (14) must have unit length.
  2. Using the full angle inside the sine and cosine. The quaternion phase is $\theta/2$ because the sandwich action produces twice that angle.
  3. Treating $q$ and $-q$ as different orientations. They are distinct points on the unit-quaternion sphere but represent the same physical rotation.
  4. Extracting an axis at zero rotation. When $\lVert\mathbf q\rVert\approx0$, the rotation axis is physically indeterminate and numerically poorly conditioned.
  5. Using $q^*$ as an inverse for a nonunit quaternion. The identity $q^{-1}=q^*$ holds only when $\lVert q\rVert=1$.
  6. Changing signs to match another source without checking its convention. Active/passive interpretation, frame direction, and Hamilton/flipped multiplication can each alter the appearance of formulas.

What comes next

The axis angle formula produces the unit quaternion associated with a finite rotation. The next PhysicsLibrary article, Rotating Vectors with Quaternions, derives the general action

$\displaystyle \mathbf v'=q\mathbf v q^* $
and reduces it to Rodrigues' rotation formula. That derivation will make the parallel and perpendicular components of an arbitrary vector explicit.

A separate companion entry, Axis Angle Representation and Unit Quaternion: Examples, Exercises, and Solutions, provides a self study problem set with all exercises stated before the solutions.

Sources and historical notes

Hamilton's Elements of Quaternions develops the versor as the unit quaternion carrying axis and angle information. Joly gives an especially clear historical statement that the transformation $q(\cdot)q^{-1}$ rotates vectors about the axis of $q$ through twice the quaternion's angle. Hathaway develops finite rotations before introducing quaternions, making the axis angle geometry explicit. Macfarlane similarly uses half-angle versors in the composition of finite rotations. These public domain sources motivate the historical and geometric discussion here. The notation and engineering organization are modernized for PhysicsLibrary.

The PhysicsLibrary convention contract also uses the modern scalar-first Hamilton form

$\displaystyle q=\cos(\theta/2)+\widehat{\mathbf u}\sin(\theta/2), $
which was established in the preceding convention entry. The existing Q00 source states the same active rotation convention explicitly. The public domain Joly source states that the sandwich transformation produces a rotation through double the quaternion angle, providing a useful historical cross-check of the half-angle derivation.

Bibliography

1
W. R. Hamilton, Elements of Quaternions, 2nd ed., Vol. I, edited by C. J. Joly, Longmans, Green, and Co., London, 1899. Public-domain historical source. Internet Archive copy
2
C. J. Joly, A Manual of Quaternions, Macmillan and Co., London, 1905. Public-domain historical source.
3
A. S. Hathaway, A Primer of Quaternions, 1896. Public-domain text; Project Gutenberg edition and LATEX source available. Project Gutenberg edition
4
A. Macfarlane, Vector Analysis and Quaternions, John Wiley & Sons, New York, 1906. Public-domain historical source; Project Gutenberg edition available. Project Gutenberg edition

License

Unless otherwise noted, this PhysicsLibrary entry is intended for release under the Creative Commons Attribution–ShareAlike 4.0 International license.



"Axis Angle Representation and Unit Quaternion" is owned by bloftin.
(view preamble)
View style:
Keywords:  quaternion, unit quaternion, axis angle, Euler axis, rotation, rigid body attitude, versor, half angle, rotation vector

Attachments:
example of Axis Angle Representation and Unit Quaternion (Example) by bloftin

Cross-references: domain, composition, covering, identities, norm, powers, power series, magnitude, representation, quaternion multiplication, scalar, formula, algebraic, quaternions, vector, unit vector, rigid body
There is 1 reference to this object.

This is version 1 of Axis Angle Representation and Unit Quaternion, born on 2026-08-23.
Object id is 1095, canonical name is AxisAngleRepresentationAndUnitQuaternion.
Accessed 12 times total.

Classification:
Physics Classification02.40.Yy (Geometric mechanics )
 02.10.Hh (Rings and algebras)
Pending Errata and Addenda
None.
Discussion
Style: Expand: Order:

No messages.

Interact
rate | post | correct | update request | add derivation | add example | add (any)