Slide 04 Quaternions
Slide 04 Quaternions
Basilio Bona
DAUIN-Politecnico di Torino
September 2013
Figure: Sir William Rowland Hamilton (1805-1865) and the plaque on Broom
Bridge, where the quaternions were discovered.
i2 = j2 = k2 = ijk = −1
ij = −ji = k
jk = −kj = i
ki = −ik = j
q = c1 + jc2 ,
In analogy with complex numbers that are the sum of a real part and an
imaginary part, quaternions are the sum of a real part and a vectorial part.
The real part qr is defined as qr = q0 , and the vectorial part qv is defined
as qv = q1 i + q2 j + q3 k.
We write q = (qr , qv ) or q = qr + qv ; note that the vectorial part is not
“transposed” since the conventional definition for the vectorial part of a
quaternion assumes a row representation.
Using the convention that defines vectors as “column” vectors, we can
write q = (qr , qT
v ).
r = (r , 0, 0, 0) , r ∈ R
complex numbers
a + ib = (a, b, 0, 0) , a, b ∈ R
real vectors in R3 (with some caution, since not all vectorial parts
represents vectors)
v = (0, v1 , v2 , v3 ) , vi ∈ R.
In
this last
case, elements i j k are to be understood as unit vectors
i j k forming an orthonormal base in a cartesian right-handed
reference frame.
ij = k ⇔ i×j = k
ji = −k ⇔ −j × i = −k
etc.
q = q0 1 + q1 i + q2 j + q3 k = (qr , qv ) = qr + qv = (q0 , q1 , q2 , q3 )
q = q0 1 + q1 i + q2 j + q3 k
where now
1 0 i 0 0 1 0 i
1= ; i= ; j= ; k= ;
0 1 0 −i −1 0 i 0
and i 2 = −1.
Hence every matrix is of the form
c d
;
−d ∗ c ∗
These matrices are called Cayley matrices [see slide on Rotations - Pauli
spin matrices].
0 = 01 + 0i + 0j + 0k = (0, 0) = 0 + 0 = (0, 0, 0, 0)
a conjugate quaternion q∗ exists, having the same real part and the
opposite vectorial part:
q∗ = q0 − (q1 i + q2 j + q3 k) = (qr , −qv ) = qr − qv = (q0 , −q1 , −q2 , −q3 )
Conjugate quaternions satisfy (q∗ )∗ = q
kqk = kq∗ k
The quaternion
qv = 01 + q1 i + q2 j + q3 k = (0, qv ) = 0 + qv = (0, q1 , q2 , q3 ),
that has a zero real part is called pure quaternion or vector . The conjugate
of a pure quaternion qv is the opposite of the original pure quaternion
q∗v = −qv
h = h0 1 + h1 i + h2 j + h3 k = (hr , hv ) = hr + hv = (h0 , h1 , h2 , h3 )
and
g = g0 1 + g1 i + g2 j + g3 k = (gr , gv ) = gr + gv = (g0 , g1 , g2 , g3 )
Difference or subtraction
hg = (h0 g0 − h1 g1 − h2 g2 − h3 g3 )1 +
(h1 g0 + h0 g1 − h3 g2 + h2 g3 )i +
(h2 g0 + h3 g1 + h0 g2 − h1 g3 )j +
(h3 g0 − h2 g1 + h1 g2 + h0 g3 )k
= (hr gr − hv · gv , hr gv + gr hv + hv × gv )
where hv · gv is the scalar product
hv · gv = ∑ hvi gvi = hT T
v g v = gv hv
i
gv × hv = −hv × gv
it follows
gh = (hr gr − hv · gv , hr gv + gr hv − hv × gv ) 6= hg;
Notice that the real part remains the same, while the vectorial part
changes. Product commutes only if hv × gv = 0, i.e., when the vectorial
parts are parallel.
The conjugate of a quaternion product satisfies
(gh)∗ = h∗ g∗ .
associative
(gh)p = g(hp)
multiplication by the unit scalar
or
qr h = p
Hence
h∗ h∗
qℓ = p; qr = p
khk2 khk2
qq−1
ℓ = 1 = (1, 0, 0, 0); q−1
r q = 1 = (1, 0, 0, 0)
q q∗ q∗ q
= = 1 = (1, 0, 0, 0)
kqk kq∗ k kq∗ k kqk
u−1 = u∗ , kuk = 1
and for a pure unit quaternion q = (0, qv ), kqk = 1, i.e., a unit vector
q−1 ∗
v = qv = −qv .
Inverse satisfies
ρ(q) = q0 = qr
uv = (0, uv ) = u1 i + u2 j + u3 k
and
vv = (0, vv ) = v1 i + v2 j + v3 k
we obtain
uv vv = (−uv · vv , u × v).
Hence, with a slight notation abuse, we can define a new vector product,
called Hamilton product
uv = −u · v + u × v.
This product implies uu = −u · u, and for this reason, among others the
quaternions were abandoned in favor of vectors.
Nonetheless the quaternion product has an important role in representing
rotations.
Basilio Bona (DAUIN-Politecnico di Torino) Quaternions September 2013 23 / 1
Unit quaternions
c = cos θ + j sinθ
e uθ = cos θ + usin θ = u
The relation above shows a formal identity between a unit quaternion and
the exponential of a unit vector multiplied by a scalar θ
Notice the similarity between u = e uθ and R(u, θ) = e S(u)θ
From the previous relation one obtains the power p of a unit quaternion as
represents the rotation Rot(u, 2θ) around the axis specified by the unit
T
vector u = u1 u2 u3
The converse is also true, i.e., given a rotation Rot(u, θ) of an angle θ
T
around the axis specified by the unit vector u = u1 u2 u3 , the unit
quaternion
θ θ θ θ θ θ
u = cos , u1 sin , u2 sin , u3 sin = cos , u sin =
2 2 2 2 2 2
θ θ
cos + u sin
2 2
represents the same rotations.
To compute the rotation matrix R(u) given a unit quaternion u = (u0 , u),
we use the following relation
Elementary rotations around the three principal axes R(i, α), R(j, β) and
R(k, γ), correspond to the following elementary quaternions
α α
R(i, α) → ux = cos , sin , 0, 0
2 2
β β
R(j, β) → uy = cos , 0, sin , 0
2 2
γ γ
R(k, γ) → uz = cos , 0, 0, sin
2 2
It is easy to see that the “vectorial base” of quaternions correspond to
elementary rotations of π around the principal axes
i = (0, 1, 0, 0) → R(i, π)
j = (0, 0, 1, 0) → R(j, π)
k = (0, 0, 0, 1) → R(k, π)
Notice an important fact: while the product among the unit base
quaternions gives
ii = jj = kk = ijk = (−1, 0, 0, 0) ,
u = u1 u2 · · · un
Transpose matrix
Given the rotation R (u) and its corresponding unit quaternion u, the
transpose matrix (i.e., the inverse rotation) RT corresponds to the
conjugate unit quaternion u∗ (i.e., the inverse quaternion)
R ⇔ u
RT ⇔ u∗
Vector rotation
Given a generic vector x, and the corresponding pure quaternion
qx = (0, x) = (0, x1 , x2 , x3 )
and given a rotation matrix R (u) with its corresponding unit quaternion u,
the rotated vector y = R(u)x is given by the vectorial part of the
quaternion obtained as
qy = (0, y) = uqx u∗
where
qy
= kqx k
x = (w , w x)
y = (w , w R(u)x)
Product matrices
Since the bi-linearity property holds for the product between two
quaternions, this can be represented by linear operators (i.e., matrices).
We recall that the product qp can be expressed in matrix form as
qp = FL (q)p
Q = FL (q)FR (q∗ ) =
2
q0 + q12 − q22 − q32 2 (q1 q2 − q3 q0 )
2 (q1 q3 + q2 q0 ) 0
2 (q1 q2 + q3 q0 ) q02 − q12 + q22 − q32 2 (q2 q3 − q1 q0 ) 0
2 (q q − q q )
1 3 2 0 2 (q2 q3 + q1 q0 ) q02 − q12 − q22 + q32 0
2
0 0 0 kqk
We observe that the upper left 3 × 3 matrix of Q equals the matrix R(q)
previously defined
q∗ q = qq∗ = t 2 + x 2 + y 2 + z 2
that is the same to ask for the existence kak kbk = kabk in general cases
(three components vectors in particular).
[from J. Stillwell, Mathematics and Its History, Springer ]
are
the real numbers R = R1 .
the complex numbers C = R2 ; they are couples or real numbers.
the quaternions H = R4 ; they are couples or complex numbers.
the octonions O = R8 ; they are couples or quaternions.