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

<record version="1" id="1091">
 <title>quaternion definition and basic algebra</title>
 <name>QuaternionDefinitionAndBasicAlgebra</name>
 <created>2026-08-23 18:22:56</created>
 <modified>2026-08-23 18:22:56</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.10.Hh"/>
	<category scheme="pacs" code="02.10.De"/>
	<category scheme="pacs" code="02.10.Ud"/>
 </classification>
 <defines>
	<concept>quaternion</concept>
 </defines>
 <related>
	<object name="NotationQuaternionsForPhysicsAndEngineeringOrientation"/>
	<object name="QuaternionProduct"/>
	<object name="QuaternionConjugate"/>
	<object name="QuaternionNorm"/>
	<object name="QuaternionInverse"/>
 </related>
 <keywords>
	<term>quaternion</term>
	<term>Hamilton quaternion</term>
	<term>quaternion algebra</term>
	<term>% scalar part</term>
	<term>vector part</term>
	<term>pure quaternion</term>
	<term>Hamilton product</term>
	<term>noncommutative algebra</term>
	<term>% associative algebra</term>
	<term>division algebra</term>
	<term>quaternion multiplication table</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*{Quaternion Definition and Basic Algebra}

A \emph{quaternion} is a four-component number that extends the real and
complex numbers while preserving addition, multiplication, and division by any
nonzero element.  Quaternions are especially important in physics and
engineering because their multiplication law naturally encodes the orientation
of three-dimensional space.  Unit quaternions will later be used to represent
finite rotations, rigid-body attitude, and angular kinematics.

This entry develops only the algebra needed before those applications.  The
main goals are to define a quaternion precisely, derive Hamilton's multiplication
table, derive the component formula for a product, and make clear which familiar
algebraic rules remain valid and which do not.

The convention issues that arise in engineering applications are treated in the
preceding PhysicsLibrary entry, \emph{Quaternions for Physics and Engineering:
Orientation, Notation, and Conventions}.  The present entry uses the
PhysicsLibrary/Hamilton convention throughout.

\section{Definition}

The set of Hamilton quaternions is denoted by
\[
\mathbb H.
\]
A quaternion is an expression
\begin{equation}
\boxed{
q=q_w+q_x\mathbf i+q_y\mathbf j+q_z\mathbf k,
}
\end{equation}
where
\[
q_w,q_x,q_y,q_z\in\mathbb R.
\]
The four basis elements are
\[
1,\qquad \mathbf i,\qquad \mathbf j,\qquad \mathbf k.
\]
Therefore the same quaternion may be represented as the ordered four-tuple
\[
q\longleftrightarrow
(q_w,q_x,q_y,q_z)
\]
or, in the scalar-first column-vector notation used in this series,
\begin{equation}
[q]_\mathrm{PL}
=
\begin{bmatrix}
q_w\\q_x\\q_y\\q_z
\end{bmatrix}.
\end{equation}

Equation (2) is a representation of the coefficients of the quaternion.  It is
not an ordinary four-dimensional vector multiplication rule.  Quaternion
multiplication is defined by the special products of
$\mathbf i,\mathbf j,\mathbf k$ developed below.

\subsection{Scalar and vector parts}

It is useful to separate a quaternion into a real scalar part and a
three-component vector part:
\begin{equation}
q=q_w+\mathbf q,
\end{equation}
where
\[
\mathbf q=q_x\mathbf i+q_y\mathbf j+q_z\mathbf k.
\]
PhysicsLibrary will use
\begin{equation}
\operatorname{Sc}(q)=q_w,
\qquad
\operatorname{Vec}(q)=\mathbf q
\end{equation}
when a named scalar or vector part is useful.  Historical quaternion texts often
write $Sq$ and $Vq$ for the same ideas.  Joly, for example, defines a quaternion
as the sum of a scalar and a vector, while Kelland and Tait explicitly decompose
products into scalar and vector parts.

A quaternion with zero vector part,
\[
q=q_w,
\]
is simply a real number embedded in $\mathbb H$.

A quaternion with zero scalar part,
\begin{equation}
q=q_x\mathbf i+q_y\mathbf j+q_z\mathbf k,
\end{equation}
is called a \emph{pure quaternion}.  Ordinary three-dimensional vectors will
later be embedded into quaternion calculations in exactly this form.

\subsection{Equality}

Two quaternions are equal if and only if all four corresponding real
coefficients are equal:
\begin{equation}
p=q
\quad\Longleftrightarrow\quad
\begin{cases}
p_w=q_w,\\
p_x=q_x,\\
p_y=q_y,\\
p_z=q_z.
\end{cases}
\end{equation}
Thus one quaternion equation generally represents four scalar equations.

\section{Addition, subtraction, and multiplication by a real scalar}

Addition is componentwise.  If
\[
p=p_w+p_x\mathbf i+p_y\mathbf j+p_z\mathbf k
\]
and
\[
q=q_w+q_x\mathbf i+q_y\mathbf j+q_z\mathbf k,
\]
then
\begin{equation}
\boxed{
p+q
=(p_w+q_w)
 +(p_x+q_x)\mathbf i
 +(p_y+q_y)\mathbf j
 +(p_z+q_z)\mathbf k.
}
\end{equation}
Subtraction is defined similarly.

For a real scalar $a$,
\begin{equation}
\boxed{
aq
=aq_w+aq_x\mathbf i+aq_y\mathbf j+aq_z\mathbf k.
}
\end{equation}
Real scalars commute with every quaternion:
\begin{equation}
aq=qa.
\end{equation}
With addition and real scalar multiplication, $\mathbb H$ is a
four-dimensional real vector space.  Quaternion multiplication gives this
vector space additional algebraic structure.

\section{Hamilton's multiplication law}

Hamilton's fundamental relation is
\begin{equation}
\boxed{
\mathbf i^2=\mathbf j^2=\mathbf k^2
=\mathbf i\mathbf j\mathbf k=-1.
}
\end{equation}
Together with associativity, equation (10) determines the familiar multiplication
table.

First, the squares are already known:
\begin{equation}
\mathbf i^2=\mathbf j^2=\mathbf k^2=-1.
\end{equation}
To obtain $\mathbf i\mathbf j$, start from
\[
\mathbf i\mathbf j\mathbf k=-1.
\]
Multiply on the right by $-\mathbf k$.  Because
\[
\mathbf k(-\mathbf k)=-\mathbf k^2=1,
\]
associativity gives
\begin{equation}
\mathbf i\mathbf j=\mathbf k.
\end{equation}
Cyclically,
\begin{equation}
\boxed{
\mathbf i\mathbf j=\mathbf k,
\qquad
\mathbf j\mathbf k=\mathbf i,
\qquad
\mathbf k\mathbf i=\mathbf j.
}
\end{equation}
Reversing the order changes the sign:
\begin{equation}
\boxed{
\mathbf j\mathbf i=-\mathbf k,
\qquad
\mathbf k\mathbf j=-\mathbf i,
\qquad
\mathbf i\mathbf k=-\mathbf j.
}
\end{equation}
Hamilton emphasized this failure of the commutative law while retaining the
associative law.  Joly likewise develops the multiplication of mutually
orthogonal unit vectors and shows that the resulting quaternion multiplication
is associative.

\subsection{Multiplication table}

The complete basis table is therefore
\begin{equation}
\begin{array}{c|rrrr}
      &amp;1&amp;\mathbf i&amp;\mathbf j&amp;\mathbf k\\ \hline
1     &amp;1&amp;\mathbf i&amp;\mathbf j&amp;\mathbf k\\
\mathbf i&amp;\mathbf i&amp;-1&amp;\mathbf k&amp;-\mathbf j\\
\mathbf j&amp;\mathbf j&amp;-\mathbf k&amp;-1&amp;\mathbf i\\
\mathbf k&amp;\mathbf k&amp;\mathbf j&amp;-\mathbf i&amp;-1
\end{array}
\end{equation}
where the entry in a row is the row factor multiplied on the left by the column
factor on the right.

A useful mnemonic for the positive products is the cycle
\begin{equation}
\mathbf i\longrightarrow\mathbf j\longrightarrow\mathbf k
\longrightarrow\mathbf i.
\end{equation}
Following the arrows gives a positive product; going against them gives the
negative of the remaining basis element.

The mnemonic is convenient, but equation (15) is the actual definition to use
when checking an unfamiliar convention.  Some engineering literature uses a
flipped multiplication in which the signs of the cross-like products are
reversed.  PhysicsLibrary does not use that multiplication unless explicitly
stated.

\section{Deriving the product of two general quaternions}

Let
\[
p=p_w+p_x\mathbf i+p_y\mathbf j+p_z\mathbf k
\]
and
\[
q=q_w+q_x\mathbf i+q_y\mathbf j+q_z\mathbf k.
\]
Quaternion multiplication is distributive, so expand as in ordinary algebra,
but do \emph{not} reorder quaternion factors:
\begin{equation}
\begin{aligned}
pq={}&amp;
 p_wq_w
+p_wq_x\mathbf i
+p_wq_y\mathbf j
+p_wq_z\mathbf k\\
&amp;+p_xq_w\mathbf i
+p_xq_x\mathbf i^2
+p_xq_y\mathbf i\mathbf j
+p_xq_z\mathbf i\mathbf k\\
&amp;+p_yq_w\mathbf j
+p_yq_x\mathbf j\mathbf i
+p_yq_y\mathbf j^2
+p_yq_z\mathbf j\mathbf k\\
&amp;+p_zq_w\mathbf k
+p_zq_x\mathbf k\mathbf i
+p_zq_y\mathbf k\mathbf j
+p_zq_z\mathbf k^2.
\end{aligned}
\end{equation}
Use equations (11)--(14), then collect the coefficients of
$1,\mathbf i,\mathbf j,\mathbf k$:
\begin{equation}
\boxed{
\begin{aligned}
pq={}&amp;
(p_wq_w-p_xq_x-p_yq_y-p_zq_z)\\
&amp;+(p_wq_x+p_xq_w+p_yq_z-p_zq_y)\mathbf i\\
&amp;+(p_wq_y-p_xq_z+p_yq_w+p_zq_x)\mathbf j\\
&amp;+(p_wq_z+p_xq_y-p_yq_x+p_zq_w)\mathbf k.
\end{aligned}}
\end{equation}
In scalar-first component form,
\begin{equation}
\boxed{
[pq]_\mathrm{PL}
=
\begin{bmatrix}
 p_wq_w-p_xq_x-p_yq_y-p_zq_z\\
 p_wq_x+p_xq_w+p_yq_z-p_zq_y\\
 p_wq_y-p_xq_z+p_yq_w+p_zq_x\\
 p_wq_z+p_xq_y-p_yq_x+p_zq_w
\end{bmatrix}.
}
\end{equation}

Equation (19) is the component formula most often implemented in software.  It
should never be copied into a program without also documenting the component
ordering and multiplication convention.

A more compact scalar--vector form of the same product will be derived in the
next PhysicsLibrary quaternion entry.  That form exposes the dot and cross
products hidden inside equation (18).

\section{Why quaternion multiplication is not commutative}

Using the basis products,
\[
\mathbf i\mathbf j=\mathbf k,
\qquad
\mathbf j\mathbf i=-\mathbf k.
\]
Hence
\begin{equation}
\boxed{\mathbf i\mathbf j\neq\mathbf j\mathbf i.}
\end{equation}
One counterexample is sufficient to show that multiplication in $\mathbb H$ is
not commutative.

This is not a defect.  Three-dimensional finite rotations themselves do not in
general commute, so a noncommutative product is exactly the sort of algebraic
structure needed to encode ordered rotations.

For two general quaternions $p$ and $q$, one should therefore expect
\begin{equation}
pq\neq qp.
\end{equation}
The difference
\begin{equation}
[p,q]\equiv pq-qp
\end{equation}
is called their \emph{commutator}.  When $[p,q]=0$, the two particular
quaternions commute even though the algebra as a whole is noncommutative.

\section{Associativity and distributivity still hold}

Although commutativity fails, the two other familiar multiplication laws remain
valid.

Quaternion multiplication is associative:
\begin{equation}
\boxed{(pq)r=p(qr).}
\end{equation}
It is also distributive over addition:
\begin{equation}
\boxed{p(q+r)=pq+pr,}
\end{equation}
\begin{equation}
\boxed{(p+q)r=pr+qr.}
\end{equation}
These properties are essential.  Associativity means that an unparenthesized
product such as
\[
pqr
\]
has a unique value.  What cannot be done is to exchange the order of the
factors.

For example,
\[
(\mathbf i\mathbf j)\mathbf k
=\mathbf k\mathbf k=-1,
\]
while
\[
\mathbf i(\mathbf j\mathbf k)
=\mathbf i\mathbf i=-1.
\]
Thus associativity works.  But interchanging $\mathbf i$ and $\mathbf j$ gives
\[
\mathbf j\mathbf i\mathbf k
=(-\mathbf k)\mathbf k=+1,
\]
which is different.

\section{Identity and zero}

The real number $1$ is the multiplicative identity:
\begin{equation}
1q=q1=q.
\end{equation}
The zero quaternion
\[
0=0+0\mathbf i+0\mathbf j+0\mathbf k
\]
is the additive identity:
\begin{equation}
q+0=q.
\end{equation}
It also satisfies
\begin{equation}
0q=q0=0.
\end{equation}

Every nonzero Hamilton quaternion has a multiplicative inverse.  This makes
$\mathbb H$ a noncommutative \emph{division algebra} over the real numbers.
The conjugate, norm, and explicit inverse formula are developed in a later
entry so that the present article can concentrate on the fundamental product.

\section{Important subalgebras}

The real numbers occur inside the quaternions as
\[
a+0\mathbf i+0\mathbf j+0\mathbf k.
\]
They commute with all quaternions.

If only one imaginary basis direction is used, for example
\[
a+b\mathbf i,
\]
then multiplication behaves exactly like ordinary complex-number multiplication
because $\mathbf i^2=-1$ and there are no $\mathbf j$ or $\mathbf k$ factors to
introduce noncommutativity.  Thus
\[
\{a+b\mathbf i:a,b\in\mathbb R\}
\]
is a copy of the complex numbers inside $\mathbb H$.  The same is true using
$\mathbf j$ or $\mathbf k$, or, as will be shown later, any unit pure quaternion.

This observation is useful in rotation problems: rotation about one fixed axis
behaves much like complex multiplication in the plane perpendicular to that
axis.  The genuinely quaternionic behavior appears when different spatial axes
interact.

\section{Worked example 1: multiplying basis expressions}

Compute
\[
(1+\mathbf i)(1+\mathbf j).
\]
Distribute without changing the factor order:
\begin{equation}
\begin{aligned}
(1+\mathbf i)(1+\mathbf j)
&amp;=1+\mathbf j+\mathbf i+\mathbf i\mathbf j\\
&amp;=1+\mathbf i+\mathbf j+\mathbf k.
\end{aligned}
\end{equation}
Reverse the two factors:
\begin{equation}
\begin{aligned}
(1+\mathbf j)(1+\mathbf i)
&amp;=1+\mathbf i+\mathbf j+\mathbf j\mathbf i\\
&amp;=1+\mathbf i+\mathbf j-\mathbf k.
\end{aligned}
\end{equation}
The products differ only in the sign of the $\mathbf k$ term, but that difference
is enough to demonstrate noncommutativity.

\section{Worked example 2: full numerical product}

Let
\[
p=1+2\mathbf i-\mathbf j+3\mathbf k,
\qquad
q=2-\mathbf i+4\mathbf j+\mathbf k.
\]
Using equation (18), the scalar coefficient is
\[
(1)(2)-(2)(-1)-(-1)(4)-(3)(1)=5.
\]
The $\mathbf i$ coefficient is
\[
(1)(-1)+(2)(2)+(-1)(1)-(3)(4)=-10.
\]
The $\mathbf j$ coefficient is
\[
(1)(4)-(2)(1)+(-1)(2)+(3)(-1)=-3.
\]
The $\mathbf k$ coefficient is
\[
(1)(1)+(2)(4)-(-1)(-1)+(3)(2)=14.
\]
Therefore
\begin{equation}
\boxed{pq=5-10\mathbf i-3\mathbf j+14\mathbf k.}
\end{equation}

If the factors are reversed, equation (18) gives
\begin{equation}
\boxed{qp=5+16\mathbf i+7\mathbf j.}
\end{equation}
The scalar parts happen to agree in this example, but the vector parts are very
different.  The general reason for this will become transparent in the
scalar--vector product formula developed in Q02.

\section{Worked example 3: an associativity check}

Let
\[
p=\mathbf i,
\qquad q=\mathbf j,
\qquad r=1+\mathbf k.
\]
First group the left pair:
\begin{equation}
(pq)r
=(\mathbf i\mathbf j)(1+\mathbf k)
=\mathbf k(1+\mathbf k)
=\mathbf k-1.
\end{equation}
Now group the right pair:
\begin{equation}
\begin{aligned}
p(qr)
&amp;=\mathbf i\left[\mathbf j(1+\mathbf k)\right]\\
&amp;=\mathbf i(\mathbf j+\mathbf i)\\
&amp;=\mathbf i\mathbf j+\mathbf i^2\\
&amp;=\mathbf k-1.
\end{aligned}
\end{equation}
Both groupings give the same quaternion, as required by associativity.

\section{Worked example 4: a pure quaternion can square to a real number}

Consider
\[
u=\frac{1}{\sqrt3}(\mathbf i+\mathbf j+\mathbf k).
\]
Then
\[
\begin{aligned}
u^2
&amp;=\frac13(\mathbf i+\mathbf j+\mathbf k)^2\\
&amp;=\frac13\bigl(
\mathbf i^2+\mathbf j^2+\mathbf k^2
+\mathbf i\mathbf j+\mathbf j\mathbf i
+\mathbf i\mathbf k+\mathbf k\mathbf i
+\mathbf j\mathbf k+\mathbf k\mathbf j
\bigr).
\end{aligned}
\]
Each reversed pair cancels:
\[
\mathbf i\mathbf j+\mathbf j\mathbf i=0,
\]
with analogous cancellation for the other pairs.  Hence
\begin{equation}
u^2=\frac13(-1-1-1)=-1.
\end{equation}
Thus $u$ behaves algebraically like an imaginary unit even though it points in
an arbitrary three-dimensional direction.  The general result for an arbitrary
unit pure quaternion is proved in Exercise 8.

\section{Common pitfalls}

\begin{enumerate}
\item \textbf{Reordering factors as if they were real variables.}
      In general $pq\neq qp$.  Do not sort terms alphabetically during an
      expansion.

\item \textbf{Confusing associativity with commutativity.}
      Parentheses may be moved according to $(pq)r=p(qr)$, but factors may not
      be exchanged.

\item \textbf{Forgetting the negative squares.}
      The Hamilton basis satisfies
      $\mathbf i^2=\mathbf j^2=\mathbf k^2=-1$.

\item \textbf{Using the multiplication table backward.}
      $\mathbf i\mathbf j=\mathbf k$ but
      $\mathbf j\mathbf i=-\mathbf k$.

\item \textbf{Treating a four-component storage array as an ordinary vector.}
      Quaternion addition is componentwise, but quaternion multiplication is
      not componentwise.

\item \textbf{Inferring the product convention from scalar-first or scalar-last
      storage.}
      Component order and multiplication law are separate choices.

\item \textbf{Calling every four-vector a quaternion.}
      A quaternion is not merely four numbers; it is four real coefficients
      together with the multiplication law of $\mathbb H$.
\end{enumerate}

\section{Exercises}

The exercises are stated first so that the article can be used for self-study.
Complete solutions follow in the next section.

\begin{enumerate}
\item \textbf{Basis multiplication.}
      Evaluate
      \[
      \mathbf i\mathbf k,\quad
      \mathbf k\mathbf i,\quad
      \mathbf j\mathbf i,\quad
      \mathbf k\mathbf j,\quad
      \mathbf i\mathbf j\mathbf k,\quad
      \mathbf j\mathbf i\mathbf k.
      \]

\item \textbf{Addition and scalar multiplication.}
      For
      \[
      p=3-2\mathbf i+4\mathbf j-\mathbf k,
      \qquad
      q=-1+5\mathbf i+2\mathbf k,
      \]
      find $p+q$, $p-q$, and $-2p$.

\item \textbf{General quaternion product.}
      Let
      \[
      p=2+\mathbf i-2\mathbf j+\mathbf k,
      \qquad
      q=-1+3\mathbf i+2\mathbf k.
      \]
      Compute $pq$ using equation (18).

\item \textbf{Order matters.}
      For the quaternions in Exercise 3, compute $qp$ and the commutator
      \[
      [p,q]=pq-qp.
      \]

\item \textbf{A cancellation identity.}
      Show directly from the multiplication table that
      \[
      (\mathbf i+\mathbf j)^2=-2.
      \]
      Explain why treating $\mathbf i$ and $\mathbf j$ as commuting symbols
      would give the wrong intermediate expression.

\item \textbf{Complex numbers inside the quaternions.}
      Let
      \[
      p=a+b\mathbf i,
      \qquad
      q=c+d\mathbf i,
      \]
      where $a,b,c,d$ are real.  Show that
      \[
      pq=(ac-bd)+(ad+bc)\mathbf i
      \]
      and verify that $pq=qp$ for this restricted pair.

\item \textbf{Associativity versus commutativity.}
      Verify explicitly that
      \[
      (\mathbf i\mathbf j)\mathbf k
      =\mathbf i(\mathbf j\mathbf k),
      \]
      but
      \[
      \mathbf i\mathbf j\neq\mathbf j\mathbf i.
      \]
      State in words what the two calculations demonstrate.

\item \textbf{Arbitrary unit pure quaternion.}
      Let
      \[
      u=a\mathbf i+b\mathbf j+c\mathbf k,
      \qquad
      a^2+b^2+c^2=1.
      \]
      Expand $u^2$ using only the multiplication table and prove that
      \[
      u^2=-1.
      \]

\item \textbf{Identify a convention error.}
      An engineer writes quaternions in scalar-first order and states
      $\mathbf i\mathbf j=-\mathbf k$.  A colleague claims that the minus sign
      must be caused by scalar-first storage.  Is that explanation correct?
      Identify what the equation actually reveals.
\end{enumerate}

\section{Solutions}

\subsection*{1. Basis multiplication}

From equations (13)--(14),
\[
\mathbf i\mathbf k=-\mathbf j,
\qquad
\mathbf k\mathbf i=\mathbf j,
\]
\[
\mathbf j\mathbf i=-\mathbf k,
\qquad
\mathbf k\mathbf j=-\mathbf i.
\]
Also,
\[
\mathbf i\mathbf j\mathbf k
=(\mathbf i\mathbf j)\mathbf k
=\mathbf k^2=-1,
\]
whereas
\[
\mathbf j\mathbf i\mathbf k
=(-\mathbf k)\mathbf k=+1.
\]

\subsection*{2. Addition and scalar multiplication}

Componentwise addition gives
\[
\boxed{
p+q=2+3\mathbf i+4\mathbf j+\mathbf k.
}
\]
Subtraction gives
\[
\boxed{
p-q=4-7\mathbf i+4\mathbf j-3\mathbf k.
}
\]
Finally,
\[
\boxed{
-2p=-6+4\mathbf i-8\mathbf j+2\mathbf k.
}
\]

\subsection*{3. General quaternion product}

For
\[
p=(2,1,-2,1),
\qquad
q=(-1,3,0,2),
\]
equation (18) gives
\[
\boxed{
pq=-7+\mathbf i+3\mathbf j+9\mathbf k.
}
\]

\subsection*{4. Order matters}

Reversing the factors gives
\[
\boxed{
qp=-7+9\mathbf i+\mathbf j-3\mathbf k.
}
\]
Therefore
\[
\begin{aligned}
\relax[p,q]
&amp;=pq-qp\\
&amp;=(-7+\mathbf i+3\mathbf j+9\mathbf k)
 -(-7+9\mathbf i+\mathbf j-3\mathbf k)\\
&amp;=\boxed{-8\mathbf i+2\mathbf j+12\mathbf k}.
\end{aligned}
\]
The nonzero commutator confirms that these two quaternions do not commute.

\subsection*{5. A cancellation identity}

Expand without reordering factors:
\[
\begin{aligned}
(\mathbf i+\mathbf j)^2
&amp;=\mathbf i^2+\mathbf i\mathbf j
 +\mathbf j\mathbf i+\mathbf j^2\\
&amp;=-1+\mathbf k-\mathbf k-1\\
&amp;=\boxed{-2}.
\end{aligned}
\]
If the symbols were incorrectly assumed to commute, the two middle terms would
be combined as $2\mathbf i\mathbf j=2\mathbf k$.  Quaternion multiplication
instead gives $\mathbf i\mathbf j+\mathbf j\mathbf i=0$.

\subsection*{6. Complex numbers inside the quaternions}

Using $\mathbf i^2=-1$ and the fact that real scalars commute,
\[
\begin{aligned}
pq
&amp;=(a+b\mathbf i)(c+d\mathbf i)\\
&amp;=ac+ad\mathbf i+bc\mathbf i+bd\mathbf i^2\\
&amp;=(ac-bd)+(ad+bc)\mathbf i.
\end{aligned}
\]
Reversing the factors produces
\[
qp=(ca-db)+(cb+da)\mathbf i,
\]
which is the same result because $a,b,c,d$ are real.  Thus this two-dimensional
subalgebra is commutative and isomorphic to the complex numbers.

\subsection*{7. Associativity versus commutativity}

The left grouping gives
\[
(\mathbf i\mathbf j)\mathbf k
=\mathbf k\mathbf k=-1.
\]
The right grouping gives
\[
\mathbf i(\mathbf j\mathbf k)
=\mathbf i\mathbf i=-1.
\]
Hence multiplication is associative for these basis elements.  But
\[
\mathbf i\mathbf j=\mathbf k,
\qquad
\mathbf j\mathbf i=-\mathbf k,
\]
so multiplication is not commutative.  Associativity permits regrouping;
commutativity would permit reordering.  Quaternions permit the former but not
the latter.

\subsection*{8. Arbitrary unit pure quaternion}

Expand
\[
\begin{aligned}
u^2
={}&amp;a^2\mathbf i^2+b^2\mathbf j^2+c^2\mathbf k^2\\
&amp;+ab(\mathbf i\mathbf j+\mathbf j\mathbf i)
+ac(\mathbf i\mathbf k+\mathbf k\mathbf i)
+bc(\mathbf j\mathbf k+\mathbf k\mathbf j).
\end{aligned}
\]
Each mixed pair cancels because reversing two distinct basis factors changes
its sign.  Therefore
\[
u^2=-a^2-b^2-c^2.
\]
With $a^2+b^2+c^2=1$,
\[
\boxed{u^2=-1.}
\]
This result is one of the algebraic reasons arbitrary spatial axes can play the
role of an imaginary unit in quaternion rotation formulas.

\subsection*{9. Identify a convention error}

The colleague's explanation is incorrect.  Scalar-first versus scalar-last
specifies only the order in which the four real coefficients are displayed or
stored.  The equation
\[
\mathbf i\mathbf j=-\mathbf k
\]
identifies a multiplication law whose orientation is flipped relative to the
PhysicsLibrary/Hamilton rule $\mathbf i\mathbf j=+\mathbf k$.  The storage order
did not cause the sign change.

\section{What comes next}

Equation (18) is correct and useful, but its pattern of signs can look arbitrary.
The next PhysicsLibrary entry rewrites
\[
p=p_w+\mathbf p,
\qquad
q=q_w+\mathbf q
\]
and derives the compact Hamilton product
\[
pq
=
\left(p_wq_w-\mathbf p\cdot\mathbf q\right)
+
\left(p_w\mathbf q+q_w\mathbf p+\mathbf p\times\mathbf q\right).
\]
That scalar--vector form explains the entire multiplication table through the
dot and cross products of ordinary three-dimensional vector analysis and is the
main bridge from quaternion algebra to mechanics and rigid-body rotations.

\section{Sources and historical notes}

Hamilton's \emph{Elements of Quaternions} is the primary historical source for
the relations among $\mathbf i,\mathbf j,\mathbf k$, including the failure of the
commutative law and preservation of associativity.  Joly's later
\emph{A Manual of Quaternions} gives a compact development beginning from the
scalar and vector parts of a quaternion and explicitly proves associativity.
Kelland and Tait likewise separate products into scalar and vector parts and
provide extensive examples.  Hathaway's \emph{A Primer of Quaternions} was
written as an elementary treatment and contains exercise sets on the fundamental
basis relations.  The Wikibooks quaternion article provides a modern openly
licensed four-tuple definition and elementary multiplication exercises.

The notation and pedagogical organization of this PhysicsLibrary entry are
modernized for physics and engineering use; the text and worked solutions above
are newly written rather than transcribed from the historical sources.

\begin{thebibliography}{9}

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

\bibitem{Joly1905}
C. J. Joly,
\emph{A Manual of Quaternions},
Macmillan and Co., London, 1905.
Public-domain historical source.
\PMlinkexternal{Internet Archive search}{https://archive.org/search?query=title\%3A\%22A+Manual+of+Quaternions\%22+AND+creator\%3A\%22Joly\%22}

\bibitem{KellandTait1882}
P. Kelland and P. G. Tait,
\emph{Introduction to Quaternions, with Numerous Examples}, 2nd ed.,
Macmillan and Co., London, 1882.
Public-domain historical source.
\PMlinkexternal{HathiTrust copy}{https://hdl.handle.net/2027/uc2.ark:/13960/t6g15wg8x}

\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{WikibooksQuat}
Wikibooks contributors,
``Abstract Algebra/Quaternions.''
Openly licensed instructional source; consult the current page history and
license notice for attribution requirements.
\PMlinkexternal{Wikibooks quaternion article}{https://en.wikibooks.org/wiki/Abstract_Algebra/Quaternions}

\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>
