Quaternions
From Create52 Cookbook
Contents |
Motivation for this page
This page is a collection of notes that was inspired by the question "What is the layout of roots of polynomials like z^3 = 1 in the Quaternions?" and the using of the Newton-Raphson method to find such roots. (The case of roots in the complex plane is well known, see below for more details). Please see also http://create52.com/blog and this flickr set of mine. Also, many years ago I wrote a short page on the Newton-Raphson method.
See also my Simple quaternion library for Processing.
Notation
The standard way of representing a quaternion is the form:
See Quaternions on wikipedia for more info and properties.
What are quaternions useful for?
- Modelling rotations in 3D and 4D (Wikipedia) - because the representation is more compact than other ways; Gimbal lock can be avoided, etc.
- Understanding low-dimension symmetry groups (see a fearsome book called On Quaternions and Octonions for more details)
- scaring kids
Roots of the simple polynomial in complex numbers
In the complex plane, the polynomial
has
roots, spaced equally on the unit circle. (Examining how Newton-Raphson method finds roots to polynomials like this reveals interesting fractal boundaries - see James Gleick's book Chaos, for example). Understanding Euler's famous equation:
and in particular de Moivre's equation:
leads to a fairly straightforward understanding of why these roots are where are are.
Specifically, the solutions to
(with
)
are given by:
where
In words: the roots are equally spaced out on a circle of radius
, and one root is on the real line.
In the more general case of the equation:
(with
)
we have solutions at:
where
Again, the roots are equally spaced out on a circle of radius
, but there isn't necessarily a root on the real line - they all are rotated around the origin by
.
(Note the use of polar coordinate form here - under multiplication and division, complex numbers in polar form retain independence in their radius and angle components. Conversely, under addition/subtraction, complex numbers in cartesian form retain independence of co-ordinate components.)
Roots of polynomials in the quaternions
Complex numbers are a subset of the quaternions (denoted
), and so the roots as described above also exist in the quaternion case. However, what other roots exist in
? What is their (geometrical) layout, and how many of them are there?
To give a quick initial answer: for the equation
(where
)
there are infinitely many roots. These roots lie on a number of 2-spheres which span the i, j and k axes (i.e. have no extent in the real axis). To be exact, there are
such 2-spheres. (Plus there is the obvious root at
.)
To understand the structure of these roots, we can look at a special subset of the quaternions, called the isomorphic complex numbers.
Isomorphic imaginary and complex numbers
This concept is well presented on the Wikipedia Quaternions page but it is presented below for completeness.
Isomorphic imaginary numbers
The fact that the quaternions anti-commute - i.e.
- means that when you square a quaternion, some terms drop out, as follows:
And if the quaternion has no real part, i.e.
, things get very simple indeed:
Bearing in mind the equation for a sphere (and Pythagoras), we can see that the above is telling us that there are an infinite amount of quaternions,
, with no real part, such that
, and they form the surface of a 2-sphere.
More formally, quaternions with this property belong to a subset of
, denoted
, and defined as:
Members of
have a length of 1 and a square of -1: in this way, they are analogous to imaginary numbers, and we refer to them generally as
. Properly speaking,
is isomorphic to the imaginary unit
.
Simple example of isomorphic imaginary numbers:
In the realm of imaginary numbers, finding the value of
goes as follows:
In the realm of the quaternions, we have exactly the same solution, but with
being defined as
(rather than plain old
), i.e.:
Remember, however, that
represents any member of
(and there are an infinite amount, in the form of all points on the unit 2-sphere spanning i, j, k). So the answer for the quaternion case is actually representing all points on a 2-sphere of radius 3 spanning i, j, k .
This 2-sphere includes on its surface
(i.e. the answer for the complex case), as well as
,
.
Isomorphic complex numbers
Every member
of
has a 'unused' real part. If we let that real part take any value, and allow scaling of the imaginary ('vector') part by any amount, we end up with an isomorphism to the complex numbers! More formally, for every
, there is a subset of quaternions,
, which is a plane (in quaternion space) which is isomorphic to the complex plane, defined like so:
Each possible
forms a plane in
, and every possible
contains the real axis. Any operations (e.g. negation, addition, multiplication) on, or between, members of
will have results also in
(because
is an algebraically closed field, as are the complex numbers).
The union of all possible
planes forms the entirety of the Quaternions
. Conversely, any Quaternion
with a non-zero imaginary (vector) part belongs to one and one only
, which we can refer to as
. (Quaternions with zero imaginary part belong to every
, because every
contains the real line.)
Layout of roots of simple polynomials in quaternions
So, back to the original question.
The roots of
(where
)
are the same as for the roots in the complex case, except that the roots are isomorphic complex numbers, not plain complex numbers.
An example: There are three roots of
in the complex plane, which are:
In the quaternions there are roots at:
Roots two and three above actually represent exactly the same thing (because ir concerns itself with length), so we can simplify and say that the roots are:
So there is a root at
and an infinite amount of roots lying on the surface of a 2-sphere in i, j, k of radius
positioned at
on the real axis.
The Newton-Raphson picture in quaternions (and other fractals)
The Newton-Raphson (N-R) picture in higher dimensions of the quaternions is not 'quaternionically interesting': the 2d complex plane structure (i.e. that colourful picture!) is in effect rotated, or 'swept out', in all imaginary directions i, j, k. There is no 'extra structure' in these higher dimensions. Another way of putting it is that the N-R picture is rotationally invariant in its imaginary parts. For example, if you plotted a N-R picture of an (i, j) plane slice (that passes through the origin) you will only see concentric circles - i.e. a rotationally invariant picture. The same goes for (j, k), or (i, k) slices, or any planar slices that pass through origin and have zero span (extension) in the real axis.
To understand why the above is so, consider the N-R iteration equation: each value iteration is based entirely on the previous iterations value, and the equation is a simple algebraic closed form (oof), hence the value varies only within one isomorphic complex plane (which is identified by the very first 'guess' value for the iteration). And if the value varies only within one isomorphic complex plane, then the structure cannot be any more complicated than that found in the complex plane case.
For similar reasons to those detailed above, the Mandelbrot set is also 'quaternionically uninteresting' - i.e. the iteration which defines the M-set is a closed form function concerning only the previous iteration value and the first iteration value - hence the iteration remains in only one isomorphic complex plane.
Julia sets, however, are 'interesting' - pictures and movies of their 3d, 4d structure litter the internet like rude jewels (e.g. 1, 2) - see also my ancient movies from 1997. Julia sets are interesting because their iteration features a single constant complex parameter that is unchanging over the whole 'picture' - hence the iteration will generally not stay in a single isomorphic complex plane.
An alternative representation of Quaternions
Another way of writing a quaternion is in the form of a pair: the scalar (real) part, and the 'vector' (imaginary) part:
where
and
.
This representation is useful as it demonstrates the result of multiplication of quaternions quite succinctly: given the two quaternions
we then have the product as:
And for squaring a quaternion, we have:

