Prerequisites
This page compares quaternion multiplication and orthogonal matrix multiplication as a means to represent rotation.
If you are not familiar with this subject you may like to look at the following pages first:
Description
Quaternions can be used to represent rotations and quaternion multiplication can be used to get the result of subsequent rotations. Here we will show the relationship between quaternion and axis angle representation and also show the equivilance of quaternion multiplication and orthogonal matrix multiplication.
In fact acording to group theory there are three main classical groups associated with rotations:
- The special orthogonal group, SO(n) - a square matrix where each element of the matrix is a real number.
- The special unitary group, SU(n) - a square matrix where each element of the matrix is a complex number.
- The symplectic group, Sp(n) - a square matrix where each element of the matrix is a quaternion.
So for example a rotation in 3D can be represented by either:
- A 3x3 matrix of real numbers.
- A 2x2 matrix of complex numbers.
- A 1x1 matrix of quaternions. (ie a single quaternion).
Rotations in other dimensions would have correspondingly bigger or smaller matrices.
All of these representations of rotations have more variables than the 3 degrees of freedom applicable to 3 dimentional rotation, therefore we need to apply additional constraints to restrict ourselves to rotations only, this constraint is:
T T* = T* T = 1
where: T* = the conjugate transpose of T (the conjugate transpose is also known as adjoint matrix, adjugate matrix, hermitian adjoint or hermitian transpose). The conjugate matrix is the complex conjugate of each element.
So in the case of matrices:
M M t = M t M = I
and in the case of quaternions:
q conj(q) = conj(q) q = 1
in other words q is normalised to unit length.
There are also other contstraints, the eigenvalue of the matrix is +1 rather than -1 which means that the transform represents a rotation and not a reflection.
Also for large scale rotations q and -q represent the same rotation, this means that the rotation repeats after 360 degrees of rotation. For fundamental particles the spin momentum repeats every 720 degrees and so q and -q may represent different rotations.
Relationship to Axis Angle representation
If we have an axis angle representation consisting of an angle and an axis represented by a vector (ax,ay,az) of unit length. The equivilant quaternion is then:
cos(angle/2) + i ax * sin(angle/2) + j ay * sin(angle/2)+ k az * sin(angle/2)
where:
- the axis is normalised so: ax*ax + ay*ay + az*az = 1
- the quaternion is also normalised so cos(angle/2)2 + ax*ax * sin(angle/2)2 + ay*ay * sin(angle/2)2+ az*az * sin(angle/2)2 = 1
This can be proved as follows:
from trig formula we get
cos(angle/2)2 + sin(angle/2)2 = 1
multiplying th sine part by 1 = ax*ax + ay*ay + az*az will have no effect so we can write:
cos(angle/2)2 + (ax*ax+ ay*ay + az*az) * sin(angle/2)2 = 1
expanding out gives:
cos(angle/2)2 + ax*ax * sin(angle/2)2 + ay*ay * sin(angle/2)2+ az*az * sin(angle/2)2 = 1
This shows that the quaternion is normalised since it is in the form:
qw2 + qx2 + qy2 +qz2 =1
and if we take the square root of each of these terms we get the parts of the quaternion:
qw = cos(angle/2)
qx = ax * sin(angle/2)
qy = ay * sin(angle/2)
qz = az * sin(angle/2)
That last part was not exactly a rigourous proof, but we can easily check that it is correct by checking rotations about each axis seperately as is done here.
see here for further information
Equivilance Quaternion multiplication and orthogonal matrix multiplication
Quaternion multiplication and orthogonal matrix multiplication can both be used to represent rotation, this page aims to show that these two notations are equivalent.
If a quaternion is represented by qw + i qx + j qy + k qz
Then the equivalent matrix, to represent the same rotation, is:
1 - 2*qy2 - 2*qz2 | 2*qx*qy - 2*qz*qw | 2*qx*qz + 2*qy*qw |
2*qx*qy + 2*qz*qw | 1 - 2*qx2 - 2*qz2 | 2*qy*qz - 2*qx*qw |
2*X*qz - 2*qy*qw | 2*qy*qz + 2*qx*qw | 1 - 2*qx2 - 2*qy2 |
To prove that this is an orthogonal matrix, the inverse of this is:
m11*m22 - m12*m21 | m02*m21 - m01*m22 | m01*m12 - m02*m11 |
m12*m20 - m10*m22 | m00*m22 - m02*m20 | m02*m10 - m00*m12 |
m10*m21 - m11*m20 | m01*m20 - m00*m21 | m00*m11 - m01*m10 |