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

<record version="5" id="1091">
 <title>quaternion definition and basic algebra</title>
 <name>QuaternionDefinitionAndBasicAlgebra</name>
 <created>2026-08-23 18:22:56</created>
 <modified>2026-08-28 17:03:34</modified>
 <type>Definition</type>
 <creator id="1" name="bloftin"/>
 <modifier id="1" name="bloftin"/>
 <comment>removed the temp fix for external links from preamble as we are fixing it on the backend</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="QuaternionSeriesOverviewAndArticleGuide"/>
	<object name="NotationQuaternionsForPhysicsAndEngineeringOrientation"/>
	<object name="ExampleOfQuaternionDefinitionAndBasicAlgebra"/>
	<object name="QuaternionProduct"/>
	<object name="ExampleOfQuaternionProduct"/>
	<object name="QuaternionConjugate"/>
	<object name="ExampleOfQuaternionConjugate"/>
	<object name="QuaternionNorm"/>
	<object name="ExampleOfQuaternionNorm"/>
	<object name="QuaternionInverse"/>
	<object name="ExampleOfQuaternionInverse"/>
	<object name="AxisAngleRepresentationAndUnitQuaternion"/>
	<object name="ExampleOfAxisAngleRepresentationAndUnitQuaternion"/>
	<object name="RotatingVectorsWithQuaternions"/>
	<object name="ExampleOfRotatingVectorsWithQuaternions"/>
	<object name="CompositionOfRotationsAndQuaternionOrder"/>
	<object name="ExampleOfCompositionOfRotationsAndQuaternionOrder"/>
	<object name="QuaternionsAndDirectionCosineMatrices"/>
	<object name="ExampleOfQuaternionsAndDirectionCosineMatrices"/>
	<object name="QuaternionsAndEulerAngles"/>
	<object name="ExampleOfQuaternionsAndEulerAngles"/>
	<object name="QuaternionKinematicsAndAngularVelocity"/>
	<object name="ExampleOfQuaternionKinematicsAndAngularVelocity"/>
	<object name="RelativeAttitudeAndErrorQuaternions"/>
	<object name="ExampleOfRelativeAttitudeAndErrorQuaternions"/>
	<object name="NumericalQuaternionPropagationAndIMUAttitudeStateIntegration"/>
	<object name="ExampleOfNumericalQuaternionPropagationAndIMUAttitudeStateIntegration"/>
	<object name="QuaternionExercisesForPhysicsAndEngineering"/>
 </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
\usepackage{hyperref}
\providecommand{\PMlinkexternal}[2]{\href{#2}{#1}}</preamble>
 <content>\section*{Quaternion Definition and Basic Algebra}

A 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 ordered geometry of
three dimensional space.  Unit quaternions will later be used to represent
frame orientation, 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 identify
which familiar algebraic rules remain valid and which do not.

The convention issues that arise in engineering applications are treated in
the preceding PhysicsLibrary article
\emph{Quaternions for Physics and Engineering: Orientation, Notation, and
Conventions}.  The present article uses Hamilton multiplication throughout.
The later PhysicsLibrary attitude articles use passive coordinate
transformations, but that application convention does not alter the algebra
developed here.

\section{Definition}

The set of Hamilton quaternions is denoted by $\mathbb H$.  A quaternion is an
expression

\begin{equation}
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.
\]

The same quaternion may therefore be represented as the ordered four tuple

\[
q\longleftrightarrow(q_w,q_x,q_y,q_z).
\]

In the scalar first column 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 four real coefficients.  It does not
mean that quaternion multiplication is ordinary four dimensional vector
multiplication.  Quaternion multiplication is defined by the special products
of $\mathbf i$, $\mathbf j$, and $\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 uses

\begin{equation}
\operatorname{Sc}(q)=q_w,
\qquad
\operatorname{Vec}(q)=\mathbf q
\end{equation}

when a named scalar or vector part is useful.

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 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
p_w=q_w,\quad
p_x=q_x,\quad
p_y=q_y,\quad
p_z=q_z.
\end{equation}

Thus one quaternion equation generally represents four scalar equations.

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

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

Addition is componentwise:

\begin{equation}
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}
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}
\mathbf i^2
=
\mathbf j^2
=
\mathbf k^2
=
\mathbf i\mathbf j\mathbf k
=
-1.
\end{equation}

Together with associativity, this determines the standard Hamilton
multiplication table.

The squares are

\begin{equation}
\mathbf i^2=\mathbf j^2=\mathbf k^2=-1.
\end{equation}

To obtain $\mathbf i\mathbf j$, begin with

\[
\mathbf i\mathbf j\mathbf k=-1.
\]

Multiply on the right by $-\mathbf k$.  Since

\[
\mathbf k(-\mathbf k)=-\mathbf k^2=1,
\]

associativity gives

\begin{equation}
\mathbf i\mathbf j=\mathbf k.
\end{equation}

The cyclic positive products are therefore

\begin{equation}
\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}
\mathbf j\mathbf i=-\mathbf k,
\qquad
\mathbf k\mathbf j=-\mathbf i,
\qquad
\mathbf i\mathbf k=-\mathbf j.
\end{equation}

This failure of the commutative law is a defining feature of quaternion
multiplication.  Hamilton multiplication remains associative.

\subsection*{Multiplication table}

The complete basis table is

\[
\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}
\]

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

\[
\mathbf i\longrightarrow
\mathbf j\longrightarrow
\mathbf k\longrightarrow
\mathbf i.
\]

Following the arrows gives a positive product.  Going against the arrows gives
the negative of the remaining basis element.

The mnemonic is convenient, but the multiplication table is the actual rule
to use when checking an unfamiliar convention.  Some engineering literature
uses a flipped multiplication in which the signs of these cross like products
are reversed.  PhysicsLibrary uses Hamilton multiplication unless an article
explicitly states otherwise.

\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 not reorder quaternion factors:

\[
\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}
\]

Using Hamilton's basis products and collecting the coefficients of
$1,\mathbf i,\mathbf j,\mathbf k$ gives

\begin{equation}
\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}
[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}

This component formula is often implemented directly in software.  It should
never be copied into a program without also documenting the component ordering
and multiplication convention.

The next PhysicsLibrary quaternion article develops the same result in compact
scalar vector form.  That form exposes the ordinary dot and cross products
hidden inside this component expression.

\section{Why quaternion multiplication is not commutative}

Using the basis products,

\[
\mathbf i\mathbf j=\mathbf k,
\qquad
\mathbf j\mathbf i=-\mathbf k.
\]

Therefore

\begin{equation}
\mathbf i\mathbf j\neq\mathbf j\mathbf i.
\end{equation}

One counterexample is enough to show that multiplication in $\mathbb H$ is not
commutative.

This is not a defect.  Ordered spatial transformations do not generally
commute, so a noncommutative algebra is naturally suited to later orientation
applications.

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 the \emph{commutator}.  When $[p,q]=0$, those two particular
quaternions commute even though the algebra as a whole is noncommutative.

\section{Associativity and distributivity still hold}

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

Quaternion multiplication is associative:

\begin{equation}
(pq)r=p(qr).
\end{equation}

It is distributive over addition:

\begin{equation}
p(q+r)=pq+pr,
\end{equation}

and

\begin{equation}
(p+q)r=pr+qr.
\end{equation}

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, zero, and division}

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.  Therefore
$\mathbb H$ is a noncommutative division algebra over the real numbers.

The conjugate, norm, and explicit inverse formula are developed in later
PhysicsLibrary entries 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$, $\mathbf k$, or any unit pure quaternion.
This observation becomes useful in later orientation problems because a fixed
spatial axis behaves algebraically like an imaginary unit.

\section{Worked examples}

\subsection*{Example 1: multiplying basis expressions}

Compute

\[
(1+\mathbf i)(1+\mathbf j).
\]

Distribute without changing factor order:

\[
\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}
\]

Reverse the two factors:

\[
\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}
\]

The products differ only in the sign of the $\mathbf k$ term, but that is
enough to demonstrate noncommutativity.

\subsection*{Example 2: a numerical product}

Let

\[
p=2+\mathbf i-2\mathbf j+\mathbf k,
\qquad
q=-1+3\mathbf i+2\mathbf k.
\]

Using the general component formula,

\begin{equation}
pq=-7+\mathbf i+3\mathbf j+9\mathbf k.
\end{equation}

Reversing the order gives

\begin{equation}
qp=-7+9\mathbf i+\mathbf j-3\mathbf k.
\end{equation}

Hence $pq\neq qp$.

\subsection*{Example 3: associativity does not imply commutativity}

For the basis elements,

\[
(\mathbf i\mathbf j)\mathbf k
=
\mathbf i(\mathbf j\mathbf k)
=
-1.
\]

The product is associative.  But

\[
\mathbf i\mathbf j=\mathbf k,
\qquad
\mathbf j\mathbf i=-\mathbf k,
\]

so it is not commutative.

\subsection*{Example 4: a pure quaternion can square to a real number}

Consider

\[
u=\frac{1}{\sqrt3}
(\mathbf i+\mathbf j+\mathbf k).
\]

Then

\[
u^2
=
\frac13
(\mathbf i+\mathbf j+\mathbf k)^2.
\]

Expanding without reordering gives diagonal square terms and reversed mixed
pairs.  The mixed pairs cancel:

\[
\mathbf i\mathbf j+\mathbf j\mathbf i=0,
\]

with analogous cancellation for the other pairs.  Therefore

\begin{equation}
u^2
=
\frac13(-1-1-1)
=
-1.
\end{equation}

Thus a unit pure quaternion in an arbitrary three dimensional direction can
behave algebraically like an imaginary unit.

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

\item \textbf{Inferring multiplication convention from storage order.}
Scalar first and scalar last describe only component layout.  They do not
determine whether the multiplication law is Hamilton or flipped.

\item \textbf{Calling every four component array a quaternion.}
A quaternion is not merely four numbers.  It is four real coefficients
together with the multiplication law of $\mathbb H$.

\item \textbf{Changing the later active or passive attitude convention and
then changing Hamilton's algebra as well.}
These are separate choices.  PhysicsLibrary's move to passive coordinate
transformations does not change the Q01 multiplication table.

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

\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 gives
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 quaternion components 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 the Hamilton table,

\[
\mathbf i\mathbf k=-\mathbf j,
\qquad
\mathbf k\mathbf i=\mathbf j,
\]

and

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

\[
p+q=2+3\mathbf i+4\mathbf j+\mathbf k.
\]

Subtraction gives

\[
p-q=4-7\mathbf i+4\mathbf j-3\mathbf k.
\]

Finally,

\[
-2p=-6+4\mathbf i-8\mathbf j+2\mathbf k.
\]

\subsection*{3. General quaternion product}

With

\[
p=(2,1,-2,1),
\qquad
q=(-1,3,0,2),
\]

the general product formula gives

\[
pq=-7+\mathbf i+3\mathbf j+9\mathbf k.
\]

\subsection*{4. Order matters}

Reversing the factors gives

\[
qp=-7+9\mathbf i+\mathbf j-3\mathbf k.
\]

Therefore

\[
[p,q]
=
pq-qp
=
-8\mathbf i+2\mathbf j+12\mathbf k.
\]

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;=-2.
\end{aligned}
\]

If the symbols were incorrectly assumed to commute, the two middle terms would
instead be combined as $2\mathbf i\mathbf j=2\mathbf k$.  Quaternion
multiplication gives
$\mathbf i\mathbf j+\mathbf j\mathbf i=0$.

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

Using $\mathbf i^2=-1$,

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

\subsection*{8. Arbitrary unit pure quaternion}

Expand

\[
u^2
=
(a\mathbf i+b\mathbf j+c\mathbf k)^2.
\]

Grouping reversed mixed pairs gives

\[
\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)\\
&amp;+ac(\mathbf i\mathbf k+\mathbf k\mathbf i)\\
&amp;+bc(\mathbf j\mathbf k+\mathbf k\mathbf j).
\end{aligned}
\]

Each mixed pair cancels, so

\[
u^2=-a^2-b^2-c^2.
\]

Since $a^2+b^2+c^2=1$,

\begin{equation}
u^2=-1.
\end{equation}

This result is one of the algebraic reasons arbitrary spatial axes can play
the role of an imaginary unit in later quaternion orientation 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
\]

instead 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}

The component product derived above is correct and useful, but its pattern of
signs can look arbitrary.  The next PhysicsLibrary quaternion entry rewrites

\[
p=p_w+\mathbf p,
\qquad
q=q_w+\mathbf q
\]

and derives the compact Hamilton scalar vector product

\begin{equation}
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).
\end{equation}

That form explains the multiplication table through the dot and cross products
of ordinary three dimensional vector analysis and is the principal bridge from
quaternion algebra to mechanics and later passive frame orientation.

\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 \emph{A Manual of Quaternions} gives a compact development beginning
from the scalar and vector parts of a quaternion and explicitly discusses the
algebraic properties of the product.  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 exercises on the fundamental basis relations.

The Wikibooks quaternion article provides a modern openly licensed elementary
reference.  The notation and organization of this PhysicsLibrary entry are
modernized for physics and engineering use; the exposition and worked
solutions here 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/details/manualofquaterni00jolyrich}

\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 catalog search}
{https://archive.org/details/introductiontoqu00kelliala}

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

\bibitem{WikibooksQuaternion}
Wikibooks contributors,
``Abstract Algebra/Quaternions.''
Openly licensed instructional source.
\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>
