Quaternion Cheat Sheet and Problems Quaternion Arithmetic: 0 X y Z I 0 X y Z
Quaternion Cheat Sheet and Problems Quaternion Arithmetic: 0 X y Z I 0 X y Z
Quaternion Cheat Sheet and Problems Quaternion Arithmetic: 0 X y Z I 0 X y Z
Quaternion Arithmetic
q̇ ṗ = (q0 + iqx + jqy + kqz )(p0 + ipx + jpy + kpz ) = q0 p0 + iqo px + . . . − qx px + kqx py . . .
Notice q̇ ṗ 6= ṗq̇.
We can also write quaternion multiplication using matrices:
and
q0 −qx −qy −qz
qx q0 qz −qy
ṗq̇ = ṗ = Q̄ṗ
qy −qz q0 qx
qz −qy −qx q0
Notice the two matrices are different since quaternion multiplication is not commutative.
The dot-product (inner product) of two quaternions is their usual vector dot-product: ṗ · q̇ =
p 0 q 0 + p x qx + p y qy + p z qz .
The conjugate of a quaternion, analogous to the conjugate of a complex number, is q̇ ∗ =
q0 − iqx − jqy − kqz . Notice that q̇ q̇ ∗ = q02 + qx2 + qy2 + qz2 = q̇ · q̇ is the squared length of q̇, as
a vector. A unit quaternion has squared length one.
Unit quaternions have three degrees of freedom. There is a two-to-one correspondence be-
tween unit quaternions and 3D rotations around an axis through the origin. A rotation of
angle θ around the axis (ax , ay , az ) corresponds to the quaternion cos 2θ +sin 2θ (iax +jay +kaz ).
1
Notice that −q̇ = (−q0 , −qx , −qy , −qz ) corresponds to the same rotation as q̇; the inverse
rotation is the conjugate, q̇ ∗ .
To apply a rotation, represented as a quaternion, to a vector v, we represent v as a purely
imaginary quatenion v̇ = ivx + jvy + kvz . Then we compute the rotated vector as
q̇ v̇ q̇ ∗
We compose two rotations by multiplying the two quaternions. So q̇ ṗ is the rotation we get
by first doing ṗ, then q̇.
1 Problems
1. Work through the process of rotating a vector v = (x, y, z) by π around the z-axis
in three dimensional space by writing the rotation as a quaternion q, and computing
dotq v̇ q̇ ∗ using either quaternion multiplication or the matrices above. Do a sanity check
on your result!