Under Construction...

Related Topics: Euler's Equation


Quaternion is a geometrical operator to represent the relationship (relative length and relative orientation) between two vectors in 3D space. William Hamilton invented Quaternion and completed the calculus of Quaternions to generalize complex numbers in 4 dimension (one real part and 3 imaginary numbers). In this article, we focus on rotations of 3D vectors because Quaternion implementation for 3D rotation is usually simpler, cheaper and better behaved than other methods.

Background of Quaternion

Euler's equation (formula) can be used to represent a 2D point with a length and angle on a complex plane. Multiplication of 2 complex numbers implies a rotation in 2D. One may think instantly it can be extended to 3D rotation by adding additional dimension. William Hamilton initially studied it by adding an additional imaginary number, j to generalize complex numbers to 3D.

However, the set of 3 dimensional complex numbers is not closed under multiplication. For example, the multiplication of i and j cannot be represented as a form of a+ib+jc. If multiplication is closed, then there exist a, b, cR that satisfies ij=a+ib+jc.

The equation c2+1=0 gives the contradiction. There is no real number c to satisfy c2+1=0.

Later, Hamilton realized 4 dimensional complex numbers are required for multiplication to be closed by adding an additional imaginary part, k. And, he denoted this 4D complex number set as Quaternion. (In mathematics, each algebra has twice the dimension of the previous one. Therefore, the higher number set of complex number is quaternion, and the next number set is octonion.)

Now, the above example now satisfies as ij=0+i0+j0+k1. The condition of 3 imaginary numbers is explained later, in Quadrantal vectors.

Understanding of Quaternion


definition of quaternion
Definition of Quaternion operator

Hamilton's motivation was to create a geometrical operator to transform from a vector to the other in 3D space. This operator is the geometric quotient (ratio) between two vectors that changes the length and the orientation, and it is called a Quaternion because the operation is required 4 parameters.
quaternion definition, or,
(Note that this notation is not same as numerical division nor multiplication. Instead, it is translated as "the quaternion operator q on vector b to produce vector a, or the operator q to convert b into a ".)

Tensor and Versor

When vector b is transformed to vector vector a, quaternion operator performs 2 distinct operations:
1. Tensor: scaling the length of b, so as to make it of the same length as vector a.
2. Versor: rotating b, so as to cause it to coincide with vector a in direction.
These 2 opearions can be symbolically represented Tensor(q) (tensor of q) and Versor(q) (versor of q) respectively.

The order of these two operations does not make any difference of the result. The combined tensor and versor operation requires 4 numbers; 1 for scaling, 1 for rotation angle, 2 additional angles to determine the orientation of the rotation plane. For example, a xy-plane is rotated about x and y axis. But, rotation along z axis does not change the orientation of the xy plane.

tensor of quaternion
Tensor operator

Tensor of q is the geometric quotient (ratio) between the lengths of 2 parallel vectors. It changes the scale of the vector, but, keeps the orientation of the vector unchanged.

versor of quaternion
Versor operator

Versor of q is the geometric quotient of 2 non-parallel vectors of equal length. It represents the relative orientation of one vector with respect to the other vector, but, it does not change the length of the vector.

Expression with unit vectors

Quaternion with unit vectors

To investigate the quaternion operator deeper, let au and bu as unit vectors along a and b. so that

And, draw AC perpendicular to b, and let the unit vector along CA be cu. Therefore, OC becomes OC =A cos bu and CA = A sin cu . Since , we substitute OC and CA in the above equation, then we have a quaternion, q ;

Vector of Rotation axis

The last term contains the geometric quotient c/b of two unit vectors at right angles (90 degree) to each other. This quotient represents a unit vector perpendicular to the plane of bu and cu. (Think of cross product of 2 vectors) This unit vector is indicating the rotation axis of the plane and the direction of rotation. If we define it u, the above equation becomes
A/B(cos + u sin)

From this equation, A/B is tensor (scaling) operation of a quaternion, and os + u sin is versor (rotation) operator of a quaternion. Note that versor of q is very similar to Euler's equation. Euler's equation contains an imaginary number i, but a quaternion has a vector instead, which is the rotation axis perpendicular to its rotation plane.

Thus, a quaternion is also expressed as the sum of scalar S(q) and vector parts V(q);

Quaternion can be also written as a 2-tuple form, [s, v]. A unit quaternion can be represented as [cos, usin], because tensor of q is 1 (no scaling).

Quadrantal vectors, i j k

Quadrantal vectors
Quadrantal vectors

Let i, j, k represent unit vectors orthogonal (perpendicular) each other. We define multiplications and divisions as rotating a unit vector to another at right angle. Note that, this multiplication and division is not numeric algebra. This kind of multiplication and quotient is called geometric. Thus, production or quotient of two unit vectors at right angles to each other produces a unit vector, perpendicular to their plane. And, it reads as i operating on j (or, rotating from i to j) produces k.

In same manner, we can write other multiplications and divisions;

The square of a unit vector can be defined from above equations;

In same manner,

Also, ijk can be defined as -1 using above multiplication table and square of unit vector.

Quaternion Algebra

Here, the basic quaternion mathematics is described. These algebraic definitions and properties are specially required for rotation in 3D space, which describe in the next section. You may skip this section and move on the next section. And, come back later if you need to review a specific definition or property.

1. Addition

quaternion addition

2. Multiplication

quaternion multiplication

Note that quaternion multiplication is not commutative, however, multiplication is associative and distributive across addition.

3. Scalar Multiplication

Unlike quaternion multiplication, scalar multiplication is commutative.

4. Subtraction

Quaternion subtraction can be derived from scalar multiplication and quaternion addition.
quaternion subtraction

5. Conjugate

Quaternion congugate is defined by negating the vector part of the quaternion.
quaternion conjugate
Note that the multiplication of a quaternion and its conjugate is commutative.

6. Norm

The norm of a quaternion is defined by;
quaternion norm

The norm of quaternion is multiplicative meaning that the norm of the multiplication of multiple quaternions equals to the multiplication of the norms of quaternions.
quaternion norm multiplicative

7. Inverse

The inverse of a quaternion is defined to be;
quaternion inverse
The quaternion inverse makes it possible to divide two quaternions.

8. Unit Quaternion

Note that the inverse of a unit quaternion equals to the conjugate of the unit quaternion.

3D Rotation with Quaternion

In 2D, the multiplication of two complex numbers implies 2D rotation. When z=x+iy is multiplied by , the length of z' remains same (|z|=|z'|), but the angle of z' is added by θ. (See details in Euler's equation.)

However, multiplying a quaternion p by a unit quaternion q does not conserve the length (norm) of the vector part of the quaternion p. For example;

Thus, we need a special multiplication for 3D rotations that is length-conserving transformation. For this reason, we multiply the unit quaternion q at the front of p and multiplying q-1 at the back of p, in order to cancel out the length changes. This special double multiplication is called "conjugation by q".

If q is a unit quaternion and p = [s, v], then the scalar (s) and the length of v, |v| are unchanged after conjugation by q. For the above example;


If p = [s, v] and p' = qpq-1, then p' = [s, v'] where |v| = |v'|

The proof takes 3 steps. First, we show S(p)=S(p') for p=[s, 0], then for p=[0, v]. Finally, both results are used to show S(p)=S(p') for p=[s, v]=[s, 0]+[0, v].

1. If p has a scalar part only p = [s, 0], then

2. If p has a vector part only p = [0, v], then the scalar part of qpq-1 can be computed by 2S(q)=q+q*.

3. If p = [s, v] = [s, 0] + [0, v], then

Since we found that the scalar parts of p and p' are same, the norm of p' is;


Hide Comments
comments powered by Disqus