# Quaternion

The quaternions are an extension of the real numbers, similar to the complex numbers, except: they have dimension 4 rather than 2 over the real numbers, and the multiplication of quaternions is not commutative.

## Definition

While the real numbers are extended to the complex numbers by adding a number i such that i2 = -1, quaternions are obtained by adding elements i, j and k to the real numbers such that

i2 = j2 = k2 = ijk = -1.
A quaternion then is a number of the form a + bi + cj + dk, where a, b, c, and d are real numbers uniquely determined by the quaternion. The multiplication of quaternions could be deduced from the following multiplication table:

 · 1 i j k 1 1 i j k i i -1 k -j j j -k -1 i k k j -i -1

These products form the quaternion group of order 8, Q8.

## Properties

Unlike real or complex numbers, multiplication of quaternions is not commutative: ij = k, ji = -k, jk = i, kj = -i, ki = j, ik = -j. The quaternions are an example of a skew field, an algebraic structure similar to a field except for commutativity of multiplication. In particular, multiplication is still associative and every non-zero element has a unique inverse. They form a 4-dimensional associative algebra over the reals (in fact a division algebra) and contain the complex numbers, but they do not form an associative algebra over the complex numbers. The quaternions, along with the complex and real numbers, are the only finite dimensional skew fields over the field of real numbers.

The non-commutativity of multiplication has some unexpected consequences, among them that polynomial equations over the quaternions can have more solutions than the polynomial's degree indicates. The equation z2 + 1 = 0 for instance has the infinitely many quaternions z = bi + cj + dk with b2 + c2 + d2 = 1 as solutions.

The conjugate of the quaternion z = a + bi + cj + dk is defined as z* = a - bi - cj - dk, and the absolute value of z is the non-negative real number defined by |z| = √(zz*) = √(a2 + b2 + c2 + d2). Note that (wz)*z*w*, which is not in general equal to w*z*. The multiplicative inverse of the non-zero quaternion z can be conveniently computed as z-1 = z* / |z|2.

By using the distance function d(z,w) = |z - w|, the quaternions form a metric space and the arithmetic operations are continuous. We also have |zw| = |z| |w| for all quaternions z and w. Using the absolute value as norm, the quaternions form a real Banach algebra.

As is explained in more detail in quaternions and spatial rotation, the multiplicative group of non-zero quaternions acts by conjugation on the copy of R3 consisting of quaternions with real part equal to zero: it is not hard to see that the conjugation by a unit quaternion (a quaternion of absolute value 1) with real part cos t is a rotation by an angle 2t, the axis of the rotation being the direction of the imaginary part. Quaternions are sometimes used in computer graphics (and associated geometric analysis) to represent rotations or orientations of objects in 3d space. The advantages are: non singular representation (compared with Euler angles for example), more compact (and faster) than matrices.

The set of all unit quaternions forms a 3-dimensional sphere S3 and a group (even a Lie group) under multiplication. S3 is the double cover of the group SO(3,R) of real orthogonal 3x3 matrices of determinant 1 since two unit quaternions correspond to every rotation under the above correspondence. The group S3 is isomorphic to SU(2), the group of complex unitary 2x2 matrices of determinant 1.

Let A be the set of quaternions of the form a + bi + cj + dk where a, b, c and d are either all integers or all rational numbers with odd numerator and denominator 2. The set A is a ring and a lattice. There are 24 unit quaternions in this ring and they are the vertices of a 24-cell regular polytope with Schläfli symbol {3,4,3}.

## Representing quaternions by matrices

There are at least two ways of representing quaternions as matrices, in such a way that quaternion addition and multiplication correspond to matrix addition and matrix multiplication. One is to use 2x2 complex matrices, and the other is to use 4x4 real matrices.

In the first way, the quaternion a + bi + cj + dk is represented as:

This representation has several nice properties:
• All complex numbers (c = d = 0) correspond to matrices with only real entries.
• The square of the absolute value of a quaternion is the same as the determinant of the corresponding matrix.
• The conjugate of a quaternion corresponds to the conjugate transpose of the matrix.
• Restricted to unit quaternions, this representation provides the isomorphism between S3 and SU(2). The latter group is important in quantum mechanics when dealing with spin; see all Pauli matrices.

In the second way, the quaternion a + bi + cj + dk is represented as:

In this representation, the conjugate of a quaternion corresponds to the transpose of the matrix.

## History

Quaternions were discovered by William Rowan Hamilton of Ireland in 1843. Hamilton was looking for ways of extending complex numbers (which can be viewed as points on a plane) to higher spatial dimensions. He could not do so for 3-dimensions, but 4-dimensions produce quaternions. According to a story he told, he was out walking one day with his wife when the solution in the form of equation i2 = j2 = k2 = ijk = -1 suddenly occurred to him; he then promptly carved this equation into the side of nearby Brougham bridge (now called Broom Bridge) in Dublin.

This involved abandoning the commutative law, a radical step for the time. Vector algebra and matrices were still in the future. Not only this, but Hamilton had in a sense invented the cross and dot products of vector algebra. Hamilton also described a quaternion as an ordered four-element multiple of real numbers, and described the first element as the 'scalar' part, and the remaining three as the 'vector' part. If two quaternions with zero scalar parts are multiplied, the scalar part of the product is the negative of the dot product of the vector parts, while the vector part of the product is the cross product. But the significance of these was still to be discovered.

Hamilton proceeded to popularize quaternions with several books, the last of which, Elements of Quaternions, had 800 pages and was published shortly after his death.

Even by this time there was controversy about the use of quaternions. Some of Hamilton's supporters vociferously opposed the growing fields of vector algebra and vector calculus (developed by Oliver Heaviside and Willard Gibbs among others), maintaining that quaternions provided a superior notation. While this is debatable in three dimensions, quaternions cannot be used in other dimensions (though extensions like octonions and Clifford algebras may be more applicable). In any case, vector notation had nearly universally replaced quaternions in science and engineering by the mid-20th century.

Today, quaternions see use in computer graphics, control theory, signal processing and orbital mechanics, mainly for representing rotations/orientations in three dimensions. For example, it is common for spacecraft attitude-control systems to be commanded in terms of quaternions, which are also used to telemeter their current attitude. The rationale is that combining many quaternion transformations is more numerically stable than combining many matrix transformations.

## Generalizations

If F is any field and a and b are elements of F, one may define a four-dimensional unitary associative algebra over F by using two generators i and j and the relations i2 = a, j2 = b and ij = -ji. These algebras are either isomorphic to the algebra of 2-by-2 matrices over F, or they are division algebras over F. They are called quaternion algebras.