On-Line Computer Graphics Notes

Quaternions


Overview

The quaternion number system was discovered by Hamilton, a physicist who was looking for an extension of the complex number system to use in geometric optics. Quaternions have developed a wide-spread use in computer graphics and robotics research because they can be used to control rotations in three dimensional space. In these notes we define and review the basic properties of quaternions.

For a postscript version of these notes look here


What are Quaternions?

Remember complex numbers? These numbers are an extension of the real number system and can be written in the form tex2html_wrap_inline219, where a and b are both real numbers and tex2html_wrap_inline225. The quaternions are just an extension of this complex number form.

A quaternion is usually written as
displaymath25
where a, b, and c are scalar values, and tex2html_wrap_inline233, tex2html_wrap_inline235 and tex2html_wrap_inline237 are the unique quaternions with the properties that
displaymath239
and
singlespace27

This is clearly an extension of the complex number system - where the complex numbers are those quaternions that have c = d = 0 and the real numbers are those that have b = c = d = 0.


Adding and Multiplying Quaternions

Addition of quaternions is very straightforward: We just add the coefficients. That is, if tex2html_wrap_inline245 and tex2html_wrap_inline247, then the sum of the two quaternions is
displaymath249

Multiplication is somewhat more complicated, as we must first multiply componentwise, and then use the product formulas for tex2html_wrap_inline251, tex2html_wrap_inline253, and tex2html_wrap_inline255 to simplify the resulting expression. So the product of tex2html_wrap_inline257 and tex2html_wrap_inline259 is
align32


An Alternate Representation for Quaternions

The expression for multiplication of quaternions, given above, is quite complex - and results in even worse complexity for the division and inverse formulas. The quaternions can be written in an different form - one which involves vectors - which dramatically simplifies the formulas. These expressions have become the preferred form for representing quaternions.

In this form, the quaternion tex2html_wrap_inline261 is written as
displaymath263
where tex2html_wrap_inline265 is the vector < b, c, d >.

We can rewrite the addition formula for two quaternions tex2html_wrap_inline269 and tex2html_wrap_inline271 as
displaymath273
and the product formula as
displaymath275

With some algebraic manipulation, these formulas can be shown to be identical with those of the tex2html_wrap_inline277, tex2html_wrap_inline279, tex2html_wrap_inline281 representation. We note that the quaternions of the form (a,<0,0,0>) can be associated with the real numbers, and the quaternions of the form (a, <b,0,0>) can be associated with the complex numbers.


Properties of Quaternions

With this new representation, it is straightforward to develop a complete set of properties of quaternions.

Given the quaternions tex2html_wrap_inline287, tex2html_wrap_inline289, and tex2html_wrap_inline291, we can verify the following properties.


Notation

Quaternions of the form tex2html_wrap_inline333 are normally denoted in their real number form - as a. this allows a scalar multiplication property to be given by

It also allows us to simplify some expressions. For example, the expression for the multiplicative inverse can now be written This also allows us to write the multiplicative identity of the quaternions as 1 instead of tex2html_wrap_inline347, and the additive identity as 0.


The Quaternions are not Commutative under Multiplication

Whereas we can add, subtract, multiply and divide quaternions, we must always be aware of the order in which these operations are made. This is because quaternions do not commute under multiplication - in general tex2html_wrap_inline351.

To give an example of this consider the two quaternions tex2html_wrap_inline353 and tex2html_wrap_inline355. Multiplying these we obtain
displaymath357
or
displaymath359
and they are not equal. This is because the vector cross products give different results depending on the order of the vectors - in general, tex2html_wrap_inline361.


Length of a Quaternion, Unit Quaternions

We define the length of a quaternion tex2html_wrap_inline363 to be
displaymath365
where tex2html_wrap_inline367 is the length of the vector tex2html_wrap_inline369. The unit quaternions are those that have length one.


This document maintained by Ken Joy

Comments to the Author

All contents copyright (c) 1996, 1997
Computer Science Department,
University of California, Davis
All rights reserved.



Ken Joy
Fri May 2 14:57:21 PDT 1997