Complex numbers have 1 imaginary axis and 1 real axis. Quaternions have 3 imaginary axes, their units called i, j and k, and 1 real axis, spanning a 4 dimensional world.
Quaternions are governed by i = j = k = ijk = -1
ij = k ji = -k | jk = i kj = -i | ki = j ik = -j |
Quaternions have the associative property, pqr = (pq)r = p(qr); p, q, r are arbitrary quaternions. You can multiply first pq and then times r, or calculate first qr and then times p, as long as you don't change multiplication order.
Quaternions don't have the commutative property. To
left-multiply
is different from
right-multiplication
. Swapping multiplication order often changes sign. rq is not equal to qr, mxm is not equal to m * x.
To playfully learn to work with quaternions, see excelquaternions.xls, an EXCEL sheet made by Gerald Tros, nuclear physicist and friend of mine. At tab page quaternion matrices
is shown an easy way to convert quaternions to matrices and matrix calculation.
Quaternions are extremely strong in rotations. Any quaternion q = a + bi + cj + dk is a point in 4-dimensional 1ijk-space (pronounce 1-i-j-k-space), but in that space any quaternion q also is one specific rotation (a, b, c, d are real numbers). That is, q * m * 1/q rotates arbitrary quaternion m over a certain angle α around a certain axis through the Origin O.
q * m * 1/q has more than one solution, but one of them has the magical property that this expression as well as q * n * 1/q (n is another arbitrary quaternion) are both rotations over the same angle around the same axis. So q indeed is one specific rotation.
( a + bi + cj + dk ) ( e + fi + gj + hk ) =
(ae -bf -cg -dh) +
(af +be +ch -dg) i +
(ag -bh +ce +df) j +
(ah +bg -cf +de) k
Multiplication of two quaternions. Regard the 16 terms ae, bf, cg, etc without the minus signs. Regard the second factor in each term. Start upper left and walking around the square
gives EFGHGFEFGHGFE. The diagonals are EEEE and HHHH. In the minus sign distribution I recognize chess play horse jumps
. Start at -bf -cg -dh -dg forms the first jump, then jump from -dg to -bh or from -dg to -cf. The division scheme has similar structure.
( a + bi + cj + dk ) / ( e + fi + gj + hk ) =
[ | ( ea + fb + gc + hd ) | + | ||
( eb - fa - gd + hc ) | i | + | ||
( ec + fd - ga - hb ) | j | + | ||
( ed - fc + gb - ha ) | k | ] / ( e + f + g + h ) |
So 1 / ( e + fi + gj + hk ) = ( e - fi - gj - hk ) / ( e + f + g + h ) and so 1/i = -i, 1/j = -j, 1/k = -k.
And also is i/j = 1/j * i = -j * i = k. When i dividing by j, then you have to left-multiply i by 1/j.
In the expression q * m * 1/q is q = a + bi + cj + dk, q = cos( α/2 ) + ( bi + cj + dk) * sin( α/2 ),
α = angle of rotation; bi + cj +dk = axis of rotation. So i rotates over 180 degrees and i rotates over 360 degrees.
When rotating the world according to quaternion q and then rotate the world according to another (arbitrary) quaternion r (eventually around a different axis and different angle) then the result is one single rotation rq about still another different axis and angle.
Mirroring x is given by uxu, u is a quaternion of length 1 (the distance of u to the Origin O is 1).
For 2 * 2 complex matrices of quaternions, see page 9 in the storyline QQD.
Mold a 4 * 4 real matrix multiplication into a quaternion multiplication as follows.
- Write quaternion a + bi + cj + dk as a row of four real numbers a b c d.
- Extend the row a b c d into the 4 * 4 matrix | a | b | c | d |
-b | a | -d | c | |
-c | d | a | -b | |
-d | -c | b | a |
The last 3 rows consist entirely of copies of the values in the first row. Except for the minus-signs, of course.
- Likewise quaternion e + fi + gj + hk becomes the matrix
e | f | g | h | |
-f | e | -h | g | |
-g | h | e | -f | |
-h | -g | f | e |
- When these two matrices are matrix multiplied, the upper row of the product matrix is the product quaternion ( a + bi + cj + dk ) ( e + fi + gj + hk ). The last three rows of the product matrix consist of copies of numbers from the first row in the same way as in the matrices of a b c d and e f g h shown above. The product matrix is a quaternion matrix and is ready for use in further quaternion multiplication.
- Use an excel-sheet to multiply the shown 4 * 4 matrices, see baryoncollision.xls.