The product of two
quaternions p = [
a b c d ] =
a+
bi+
cj+
dk and
q = [
e f g h ] =
e+
fi+
gj+
hk is given by the quaternion
pq
= (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
= [ (ae-bf-cg-dh) (af+be+ch-dg) (ag-bh+ce+df) (ah+bg-cf+de) ].
To
derive this
formula, just remember the rules
i2 = j2 = k2 = -1
ij = -ji = k
jk = -kj = i
ki = -ik = j,
distribute the
multiplication, and
collect terms.