Quaternion product as a matrix product
Pick a quaternion
p = p0 + p1i + p2j + p3k
and consider the function that acts on quaternions by multiplying them on the left by p.
If we think of q as a vector in R4 then this is a linear function of q, and so it can be represented by multiplication by a 4 * 4 matrix Mp.
It turns out
How might you remember or derive this matrix? Consider the matrix on the left below. It's easier to see the pattern here than in Mp.
You can derive Mp from this matrix.
Let's look at the second row, for example. The second row of Mp, when multiplied by q as a column vector, produces the i component of the product.
How do you get an i term in the product? By multiplying the i component of p by the real component of q, or by multiplying the real component of p times the i component of p, or by multiplying the i/ j component of p by the j component of q, or by multiplying the i/k component of p by the k component of q.
The other rows follow the same pattern. To get the x component of the product, you add up the products of the x/y term of p and the y term of q. Here x and y range over
{1, i, j, k}.
To get Mp from the matrix on the right, replace 1 with the real component of p, replace i with the i component of p, etc.
As a final note, notice that the off-diagonal elements of Mp are anti-symmetric:
mij = -mji
unless i = j.
The post Quaternion product as a matrix product first appeared on John D. Cook.