<?xml version="1.0" encoding="UTF-8"?>

<record version="1" id="1095">
 <title>Axis Angle Representation and Unit Quaternion</title>
 <name>AxisAngleRepresentationAndUnitQuaternion</name>
 <created>2026-08-23 20:09:41</created>
 <modified>2026-08-23 20:09:41</modified>
 <type>Definition</type>
 <creator id="1" name="bloftin"/>
 <modifier id="1" name="bloftin"/>
 <comment>converted to passive rotation convention</comment>
 <author id="1" name="bloftin"/>
 <classification>
	<category scheme="pacs" code="02.40.Yy"/>
	<category scheme="pacs" code="02.10.Hh"/>
 </classification>
 <keywords>
	<term>quaternion</term>
	<term>unit quaternion</term>
	<term>axis angle</term>
	<term>Euler axis</term>
	<term>rotation</term>
	<term>rigid body attitude</term>
	<term>versor</term>
	<term>half angle</term>
	<term>rotation vector</term>
 </keywords>
 <preamble>% this is the default PhysicsLibrary preamble.  as your knowledge
% of TeX increases, you will probably want to edit this, but
% it should be fine as is for beginners.

% almost certainly you want these
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{amsfonts}

% used for TeXing text within eps files
%\usepackage{psfrag}
% need this for including graphics (\includegraphics)
%\usepackage{graphicx}
% for neatly defining theorems and propositions
%\usepackage{amsthm}
% making logically defined graphics
%\usepackage{xypic}

% there are many more packages, add them here as you need them

% define commands here</preamble>
 <content>\section*{Axis Angle Representation and Unit Quaternion}

A three dimensional rigid body rotation can be described by an \emph{axis} and
an \emph{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
\begin{equation}
\boxed{
q
=\cos\frac{\theta}{2}
+\widehat{\mathbf u}\sin\frac{\theta}{2}.
}
\end{equation}
The appearance of the \emph{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.

\section{Convention declaration}

Unless explicitly stated otherwise, this entry uses Hamilton multiplication,
\[
\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:
\begin{equation}
q
=q_w+q_x\mathbf i+q_y\mathbf j+q_z\mathbf k
\quad\longleftrightarrow\quad
\begin{bmatrix}
q_w&amp;q_x&amp;q_y&amp;q_z
\end{bmatrix}^{T}.
\end{equation}
Scalar-first versus scalar-last storage is only a component layout choice; it
does not change the quaternion multiplication law or the physical rotation.

\section{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
\begin{equation}
\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.
\end{equation}
The vector $\widehat{\mathbf u}$ is identified with a pure quaternion.  Because
it is a unit pure quaternion,
\begin{equation}
\boxed{\widehat{\mathbf u}^{\,2}=-1.}
\end{equation}
Thus an arbitrary spatial unit axis behaves algebraically like an imaginary
unit.

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

\section{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:
\begin{equation}
\boxed{
\exp(\widehat{\mathbf u}\phi)
=\cos\phi+\widehat{\mathbf u}\sin\phi.
}
\end{equation}
Indeed,
\[
\begin{aligned}
\exp(\widehat{\mathbf u}\phi)
&amp;=1+\widehat{\mathbf u}\phi
+\frac{(\widehat{\mathbf u}\phi)^2}{2!}
+\frac{(\widehat{\mathbf u}\phi)^3}{3!}+\cdots\\
&amp;=\left(1-\frac{\phi^2}{2!}+\frac{\phi^4}{4!}-\cdots\right)
+\widehat{\mathbf u}
\left(\phi-\frac{\phi^3}{3!}+\frac{\phi^5}{5!}-\cdots\right).
\end{aligned}
\]
Therefore a quaternion of the form
\begin{equation}
q=\cos\phi+\widehat{\mathbf u}\sin\phi
\end{equation}
has unit norm, because
\begin{equation}
\begin{aligned}
\lVert q\rVert^2
&amp;=\cos^2\phi
+\lVert\widehat{\mathbf u}\rVert^2\sin^2\phi\\
&amp;=\cos^2\phi+\sin^2\phi\\
&amp;=1.
\end{aligned}
\end{equation}
Hence $q$ is a \emph{unit quaternion}, and
\begin{equation}
\boxed{q^{-1}=q^*.}
\end{equation}

\section{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
\begin{equation}
\mathbf w=\widehat{\mathbf u}\times\mathbf v.
\end{equation}
For Hamilton multiplication and perpendicular pure quaternions,
\[
\widehat{\mathbf u}\mathbf v=\mathbf w,
\qquad
\mathbf v\widehat{\mathbf u}=-\mathbf w,
\qquad
\widehat{\mathbf u}\mathbf v\widehat{\mathbf u}=\mathbf v.
\]
Now write
\begin{equation}
q=\cos\phi+\widehat{\mathbf u}\sin\phi
=c+s\widehat{\mathbf u},
\end{equation}
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^*
&amp;=(c+s\widehat{\mathbf u})\mathbf v
  (c-s\widehat{\mathbf u})\\
&amp;=c^2\mathbf v-cs\mathbf v\widehat{\mathbf u}
  +cs\widehat{\mathbf u}\mathbf v
  -s^2\widehat{\mathbf u}\mathbf v\widehat{\mathbf u}\\
&amp;=(c^2-s^2)\mathbf v+2cs\mathbf w.
\end{aligned}
\end{equation}
Using the double angle identities,
\begin{equation}
\boxed{
q\mathbf v q^*
=\cos(2\phi)\mathbf v
+\sin(2\phi)\mathbf w.
}
\end{equation}
The vector has therefore rotated in the plane perpendicular to
$\widehat{\mathbf u}$ through the physical angle
\begin{equation}
\boxed{\theta=2\phi.}
\end{equation}
Consequently the unit quaternion that represents a physical rotation through
$\theta$ must use
\begin{equation}
\boxed{
q
=\cos\frac{\theta}{2}
+\widehat{\mathbf u}\sin\frac{\theta}{2}
=\exp\left(\frac{\theta}{2}\widehat{\mathbf u}\right).
}
\end{equation}
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.

\section{Scalar-first component form}

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

\section{Recovering axis and angle from a unit quaternion}

Suppose
\begin{equation}
q=q_w+\mathbf q,
\qquad
\lVert q\rVert=1.
\end{equation}
Define
\begin{equation}
s=\lVert\mathbf q\rVert.
\end{equation}
A numerically useful extraction is
\begin{equation}
\boxed{
\theta=2\operatorname{atan2}(s,q_w).
}
\end{equation}
When $s\neq0$, the axis is
\begin{equation}
\boxed{
\widehat{\mathbf u}=\frac{\mathbf q}{s}.
}
\end{equation}
The equivalent expression
\[
\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
\[
0\leq\theta\leq\pi
\]
is desired, a common engineering choice is first to replace $q$ by $-q$ when
$q_w&lt;0$.  This chooses the representative with nonnegative scalar part and
therefore selects the shorter of the two equivalent rotation angles.

\section{The sign ambiguity: $q$ and $-q$}

A unit quaternion and its negative represent the same physical orientation.
The vector rotation action satisfies
\begin{equation}
\boxed{
(-q)\mathbf v(-q)^*=q\mathbf v q^*.
}
\end{equation}
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)
&amp;=\cos\left(\frac{\theta}{2}+\pi\right)
 +\widehat{\mathbf u}
  \sin\left(\frac{\theta}{2}+\pi\right)\\
&amp;=-q(\theta).
\end{aligned}
\end{equation}
A further $2\pi$ returns to the same quaternion:
\begin{equation}
\boxed{q(\theta+4\pi)=q(\theta).}
\end{equation}
The deeper $S^3$ and $SU(2)$ interpretation of this double covering belongs to
the later mathematical branch of the PhysicsLibrary quaternion sequence.

\section{Important special cases}

\subsection*{Zero rotation}

For $\theta=0$,
\begin{equation}
\boxed{q=1.}
\end{equation}
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.

\subsection*{Rotation through $\pi$ radians}

For $\theta=\pi$,
\begin{equation}
\boxed{q=\widehat{\mathbf u}.}
\end{equation}
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.

\subsection*{Rotation through $2\pi$ radians}

For $\theta=2\pi$,
\begin{equation}
\boxed{q=-1.}
\end{equation}
This is the same physical orientation as $q=+1$, although the quaternion itself
has changed sign.

\section{Small-angle form used in engineering}

Let the rotation vector be
\[
\boldsymbol\theta=\theta\widehat{\mathbf u}.
\]
For a small rotation, $|\theta|\ll1$ rad,
\[
\cos\frac{\theta}{2}\approx1-\frac{\theta^2}{8},
\qquad
\sin\frac{\theta}{2}\approx\frac{\theta}{2}.
\]
Therefore
\begin{equation}
\boxed{
q
\approx
1+\frac12\boldsymbol\theta
}
\end{equation}
when the rotation vector is identified with a pure quaternion.  In scalar-first
components,
\begin{equation}
\boxed{
q\approx
\begin{bmatrix}
1\\
\tfrac12\theta_x\\
\tfrac12\theta_y\\
\tfrac12\theta_z
\end{bmatrix}.
}
\end{equation}
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.

\section{Active and passive interpretation}

Equation (14) is the PhysicsLibrary formula for a \emph{positive active}
rotation.  If $q$ actively rotates vectors by $+\theta$ about
$\widehat{\mathbf u}$, then
\begin{equation}
\boxed{
q^*=q^{-1}
=\cos\frac{\theta}{2}
-\widehat{\mathbf u}\sin\frac{\theta}{2}
}
\end{equation}
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.

\section{Common pitfalls}

\begin{enumerate}
\item \textbf{Forgetting to normalize the axis.}  The vector
      $\widehat{\mathbf u}$ in equation (14) must have unit length.
\item \textbf{Using the full angle inside the sine and cosine.}  The quaternion
      phase is $\theta/2$ because the sandwich action produces twice that angle.
\item \textbf{Treating $q$ and $-q$ as different orientations.}  They are
      distinct points on the unit-quaternion sphere but represent the same
      physical rotation.
\item \textbf{Extracting an axis at zero rotation.}  When
      $\lVert\mathbf q\rVert\approx0$, the rotation axis is physically
      indeterminate and numerically poorly conditioned.
\item \textbf{Using $q^*$ as an inverse for a nonunit quaternion.}  The identity
      $q^{-1}=q^*$ holds only when $\lVert q\rVert=1$.
\item \textbf{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.
\end{enumerate}

\section{What comes next}

The axis angle formula produces the unit quaternion associated with a finite
rotation.  The next PhysicsLibrary article, \emph{Rotating Vectors with
Quaternions}, derives the general action
\[
\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, \emph{Axis Angle Representation and Unit
Quaternion: Examples, Exercises, and Solutions}, provides a self study problem
set with all exercises stated before the solutions.

\section{Sources and historical notes}

Hamilton's \emph{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
\[
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
\emph{double} the quaternion angle, providing a useful historical cross-check of
the half-angle derivation.

\begin{thebibliography}{9}

\bibitem{Hamilton1899}
W. R. Hamilton,
\emph{Elements of Quaternions}, 2nd ed., Vol. I,
edited by C. J. Joly,
Longmans, Green, and Co., London, 1899.
Public-domain historical source.
\PMlinkexternal{Internet Archive copy}{https://archive.org/details/elementsofquater01hamiuoft}

\bibitem{Joly1905}
C. J. Joly,
\emph{A Manual of Quaternions},
Macmillan and Co., London, 1905.
Public-domain historical source.

\bibitem{Hathaway1896}
A. S. Hathaway,
\emph{A Primer of Quaternions}, 1896.
Public-domain text; Project Gutenberg edition and \LaTeX{} source available.
\PMlinkexternal{Project Gutenberg edition}{https://www.gutenberg.org/ebooks/9934}

\bibitem{Macfarlane1906}
A. Macfarlane,
\emph{Vector Analysis and Quaternions},
John Wiley \&amp; Sons, New York, 1906.
Public-domain historical source; Project Gutenberg edition available.
\PMlinkexternal{Project Gutenberg edition}{https://www.gutenberg.org/ebooks/13609}

\end{thebibliography}

\section*{License}

Unless otherwise noted, this PhysicsLibrary entry is intended for release under
the Creative Commons Attribution--ShareAlike 4.0 International license.</content>
</record>
