Quaternion and Rotation: (Com S 477/577 Notes)
Quaternion and Rotation: (Com S 477/577 Notes)
Quaternion and Rotation: (Com S 477/577 Notes)
Yan-Bin Jia
Sep 5, 2017
1 Introduction
Up until now we have learned that a rotation in R3 about an axis through the origin can be repre-
sented by a 3 3 orthogonal matrix with determinant 1. However, the matrix representation seems
redundant because only four of its nine elements are independent. Also the geometric interpretation
of such a matrix is not clear until we carry out several steps of calculation to extract the rotation
axis and angle. Furthermore, to compose two rotations, we need to compute the product of the
two corresponding matrices, which requires twenty-seven multiplications and eighteen additions.
Quaternions are very efficient for analyzing situations where rotations in R3 are involved. A
quaternion is a 4-tuple, which is a more concise representation than a rotation matrix. Its geo-
metric meaning is also more obvious as the rotation axis and angle can be trivially recovered. The
quaternion algebra to be introduced will also allow us to easily compose rotations. This is because
quaternion composition takes merely sixteen multiplications and twelve additions.
The development of quaternions is attributed to W. R. Hamilton [5] in 1843. Legend has it that
Hamilton was walking with his wife Helen at the Royal Irish Academy when he was suddenly struck
by the idea of adding a fourth dimension in order to multiply triples. Excited by this breakthrough,
as the couple passed the Brougham bridge of the Royal Canal, he carved the newfound quaternion
equations
2 2 2
i = j = k = ij k = 1
into the stone of the bridge. This event is marked by a plaque at the exact location today. Hamilton
spent the rest of his life working on quaternions, which became the first non-commutative algebra
to be studied.
2 Quaternion Algebra
The set of quaternions, together with the two operations of addition and multiplication, form a
non-commutative ring.1 The standard orthonormal basis for R3 is given by three unit vectors
Appendices are optional for reading unless specifically required. Sections 2.1, 2.2, 3, and 4 are based on Chap-
ters 36 of the book [9] by J. B. Kuipers, Sections 1 and 6 are partially based on the essay by S. Oldenburger [10]
who took the course, and Section 5 is based on [6].
1
For the purpose of this course, you dont really need to know what a ring is although it can be found in a standard
algebra text such as the one by Hungerford [7] or Jacobson [8].
1
i = (1, 0, 0), j = (0, 1, 0), k = (0, 0, 1). A quaternion q is defined as the sum of a scalar q0 and a
vector q = (q1 , q2 , q3 ); namely,
q = q0 + q = q0 + q1 i + q2 j + q3 k. (1)
pq = (p0 + p1 i + p2 j + p3 k)(q0 + q1 i + q2 j + q3 k)
= p0 q0 (p1 q1 + p2 q2 + p3 q3 ) + p0 (q1 i + q2 j + q3 k) + q0 (p1 i + p2 j + p3 k)
+(p2 q3 p3 q2 )i + (p3 q1 p1 q3 )j + (p1 q2 p2 q1 )k.
Whew! It is too long to remember or even to understand what is going on. Fortunately, we can
utilize the inner product and cross product of two vectors in R3 to write the above quaternion
product in a more concise form:
pq = p0 q0 p q + p0 q + q0 p + p q. (3)
In the above, p = (p1 , p2 , p3 ) and q = (q1 , q2 , q3 ) are the vector parts of p and q, respectively.
p = 3 + i 2j + k,
q = 2 i + 2j + 3k.
We single out their vector parts p = (1, 2, 1) and q = (1, 2, 3) and calculate their inner and cross products:
pq = 2,
i j k
pq = 1 2 1
1 2 3
= 8i 4j.
2
By (3) the quaternion product is then
We see that the product of two quaternions is still a quaternion with scalar part p0 q0 p q and
vector part p0 q + q0 p + p q. The set of quaternions is closed under multiplication and addition.
It is not difficult to verify that multiplication of quaternions is distributive over addition. The
identity quaternion has real part 1 and vector part 0.
q = q0 q = q0 q1 i q2 j q3 k.
(q ) = q0 (q) = q,
q + q = 2q0 ,
q q = (q0 q)(q0 + q)
= q0 q0 (q) q + q0 q + (q)q0 + (q) q by (3)
= q02 +qq
= q02 + q12 + q22 + q32
= qq .
(pq) = q p . (4)
The norm of a quaternion q, denoted by |q|, is the scalar |q| = q q. A quaternion is called a
unit quaternion if its norm is 1. The norm of the product of two quaternions p and q is the product
of the individual norms, for we have
|pq|2 = (pq)(pq)
= pqq p
= p|q|2 p
= pp |q|2
= |p|2 |q|2 .
We can easily verify that q 1 q = qq 1 = 1. In the case q is a unit quaternion, the inverse is its
conjugate q .
3
3 Quaternion Rotation Operator
How can a quaternion, which lives in R4 , operate on a vector, which lives in R3 ? First, we note
that a vector v R3 is a pure quaternion whose real part is zero.
Pure Quaternions
3
R
v =0+v R4
v
Quaternions
Lq (v) = qvq
= (q02 kqk2 )v + 2(q v)q + 2q0 (q v). (5)
Here we make two observations. First, the quaternion operator (5) does not change the length of
the vector v for
Second, the direction of v, if along q, is left unchanged by the operator Lq . To verify this, we let
v = kq and have
qvq = q(kq)q
= (q02 kqk2 )(kq) + 2(q kq)q + 2q0 (q kq)
= k(q02 + kqk2 )q
= kq.
Essentially, any vector along q is thus not changed under Lq . This makes us guess that the operator
Lq acts like a rotation about q, which will be made precise by the next theorem.
Before proceeding with the theorem, we remark that the operator Lq is linear over R3 . For any
two vectors v1 , v 2 R3 and any a1 , a2 R we can show that
Lq (a1 v 1 + a2 v 2 ) = a1 Lq (v 1 ) + a2 Lq (v 2 ).
4
and for any vector v R3 the action of the operator
Lq (v) = qvq
on v is equivalent to a rotation of the vector through an angle about u as the axis of rotation.
where in the last step above we introduced u = q/kqk. Denote n = u n. So the last equation
becomes
Lq (n) = (q02 kqk2 )n + 2q0 kqkn . (7)
Note that n and n have the same length:
kn k = kn uk = knk kuk sin = knk.
2
Finally, we rewrite (7) into the form
2 2
Lq (n) = cos sin n + 2 cos sin n
2 2 2 2
= cos n + sin n .
Namely, the resulting vector is a rotation of n through an angle in the plane defined by n and
n . See the figure below. This vector is clearly orthogonal to the rotation axis.
Let us rewrite the right hand side of equation (5) as a matrix product:
Lq (v) = q02 kqk2 I3 + 2qqT + 2q0 q v,
5
n
Lq (n)
q n
Conversely, given a rotation matrix R, we can use the method described in the notes Rotations in
the Space to recover the axis and angle of the rotation, and subsequently construct the quaternion.
Example 2. Consider a rotation about an axis defined by (1, 1, 1) through an angle of 2/3. About this
axis, the basis vectors i, j, and k generate the same cone when rotated through 2. We define a unit vector
1
u = (1, 1, 1).
3
Let the rotation angle = 2/3. The quaternion q defining the rotation is then given as
q = cos + u sin
2 2
1 1 1 1
= + i + j + k.
2 2 2 2
Let us compute the effect of rotation on the basis vector i = (1, 0, 0). We obtain the resulting vector
using (8):
1 1 1 1
1 1 1 1 3 1
v = 0 + 1+ 1 + 1 0
2 2 3 3 2 3
0 1 1 0
1
1
2 2 0
1 1
= 0 + 2 + 2
0 1
1
2 2
= j.
6
The rotation of v under the operator Lq can also be interpreted from the perspective of an
observer attached to the vector v. What he sees happening is that the coordinate frame rotates
through the angle about the same axis defined by the quaternion.
Lq (v) = q v(q ) = q vq
is a rotation of the coordinate frame about the axis u through an angle while v is not rotated.
Equivalently, the operator Lq rotates the vector v with respect to the coordinate frame through
an angle about q.
The quaternion operator Lq (v) = qvq may be interpreted as a point or vector rotation with
respect to the (fixed) coordinate frame. The quaternion operator Lq (v) = q vq may be interpreted
as a coordinate frame rotation with respect to the (fixed) space of points.
w = Lq (v)
= qvq
= q(pup )q
= (qp)u(qp)
= Lqp (u).
Because p and q are unit quaternions, so is the product qp. Hence the above equation describes a
rotation operator whose defining quaternion is the product of the two quaternions p and q. The
axis and angle of the composite rotation is given by the product qp.
Similarly, consider the quaternion operators Lp (u) = p up and Lq (v) = q vq which carry
out rotations of the coordinate system determined by quaternions p and q, respectively. Then the
quaternion product pq defines an operator L(pq) , which represents a sequence of operators Lp
followed by Lq . The axis and angle of rotation of L(pq) are those represented by the quaternion
product pq.
Example 3. We now use the quaternion method to find the axis and angle of the composite rotation in
the Satellite tracking example from the notes titled Rotations in the Space. Recall that the tracking
application takes a rotation about the z-axis through a bearing angle followed by a rotation about the new
7
y-axis through an elevation angle . After these two rotations, the new x-axis points toward the satellite.
The two rotations are respectively described by the two quaternions below:
p = cos + sin k,
2 2
q = cos + sin j.
2 2
Since we are rotating the coordinate frame, the two operators Lp and Lq are applied sequentially. The
composite rotation operator is L(pq) , which transforms coordinates in the station frame to those in the
tracking frame. And the quaternion describing the composition rotation is the product pq which is as
follows.
pq = cos + sin k cos + sin j
2 2 2 2
= cos cos + cos sin j + sin cos k + sin sin (k j)
2 2 2 2 2 2 2 2
= cos cos sin sin i + cos sin j + sin cos k.
2 2 2 2 2 2 2 2
The axis of the composite rotation is defined by the vector
v = sin sin , cos sin , sin cos . (9)
2 2 2 2 2 2
8
q1
q5
rotation
p1 p5 q7
translation q3
q4
p3
q2
p7 q6
p4 p2
p6
Model
Data
described as the total squared distance from the data points to the model. When multiple shape
models are possible, the one that results in the least total distance is then recognized as the shape
of the object.
Quaternions are very effective in solving the above least-squares-based registration problem. Let
us begin with a formulation of the problem in 3D. Let {p1 , p2 , . . . , pn } be a set of data points. We
assume that p1 , . . . , pn are to be matched against the points q 1 , . . . , q n on a shape model. Namely,
the correspondences between the data points and those on the model have been predetermined.
Then the problem is to find a rotation, represented by an orthogonal matrix R with det(R) = 1,
and a translation b as the solution to the following minimization:
n
X
min kRpi + b q i k2 . (10)
R,b i=1
The relative coordinates of all the points to their centroids are obtained as, for 1 i n,
pi = pi p;
qi = q i q.
9
Clearly, we have
n n n n
X X X 1X
pi = pi np = pi n pi = 0; (11)
n
i=1 i=1 i=1 i=1
n n n n
X X X 1 X
q i = qi nq = qi n q i = 0. (12)
n
i=1 i=1 i=1 i=1
The minimizing translation b should make the second term in the last equation above zero, yielding:
b = q Rp. (13)
Thus we have decomposed the problem of data registration into two phases: the first of which
determines its optimal translation, as given by equation (13), and the second of which determines
the optimal rotation of the set {pi }. Note that every point pi is transformed into R(pi p) + q
before matching against q i . Equivalently, to find the best match of the two point sets {pi } and
{q i }, we first translate {pi } to let their centroid coincide with that of {q i }, and then rotate about
the common centroid.
By the reasoning so far, the optimal rotation can be solved from the formulation below:
n
X
min kRpi q i k2 . (14)
R
i=1
Here we present an exact solution to (14) as described in [6] using quaternions. An equivalent
quaternion-based solution is given in [4]. The version of matching two curves (or surfaces), also
assuming pointwise correspondences, is solved exactly in [12] in a somewhat similar manner without
the use of quaternions.
First, we rewrite the summation in (14) as follows:
n
X n
X n
X n
X
kRpi q i k2 =
(Rpi Rpi ) 2
(Rpi q i ) + q i q i
i=1 i=1 i=1 i=1
n
X n
X
kpi k2 + kq i k2 2 Rpi q i .
=
i=1 i=1
10
The first summand in the last equation above does not depend on the rotation, so we need only
minimize the second summand. Equivalently, this can be done through a maximization:
n
X
max Rpi q i . (15)
R
i=1
The rotation matrix R has nine entries, only four of which are independent due to the or-
thogonality and unit determinant of R. Instead, we represent rotations using unit quaternions.
Essentially, we find the unit quaternion q that maximizes
n
X
(qpi q ) q i . (16)
i=1
Next, we intend to rewrite the summands in (16) as matrix products. For this purpose, we define
matrices
0 pi1 pi2 pi3
0 qi1 qi2 qi3
p 0 pi3 pi2
and Qi = qi1 0 qi3 qi2
Pi = i1 ,
p p 0 p q q 0 q
i2 i3 i1 i2 i3 i1
pi3 pi2 pi1 0
qi3 qi2 qi1 0
for 1 i n. Then the quaternion products qpi and q i q are equivalent to the matrix products
Pi q and Qi q. We thus have
n
X n
X
(qpi q ) qi = (qpi ) (q i q) (by (17))
i=1 i=1
Xn
= (Pi q) (Qi q)
i=1
Xn
= q T PiT Qi q
i=1
n
!
X
T
= q PiT Qi q.
i=1
11
Thus M has real eigenvalues only, say, 1 , 2 , 3 , 4 with 1 2 3 4 .2 Let v1 , v 2 , v 3 , v 4
be the corresponding orthogonal unit eigenvectors. Eigenvectors corresponding to different eigenval-
ues must be orthogonal to each other. Multiple eigenvectors corresponding to the same eigenvalue
are chosen to be orthogonal to each other. The quaternion q is a linear combination of these
eigenvectors:
q = 1 v 1 + 2 v 2 + 3 v 3 + 4 v 4 .
Therefore we have
q T M q = (1 v 1 + 2 v 2 + 3 v 3 + 4 v 4 )T M (1 v 1 + 2 v 2 + 3 v 3 + 4 v 4 )
= (1 v 1 + 2 v 2 + 3 v 3 + 4 v 4 ) (1 1 v 1 + 2 2 v2 + 3 3 v 3 + 4 4 v4 )
= 1 21 + 2 22 + 3 23 + 4 24 .
6 Discussion
In physics, quaternions are correlated to the nature of the universe at the level of quantum me-
chanics. They lead to elegant expressions of the Lorentz transformations, which form the basis of
the modern theory of relativity. In signal processing, Quaternion Fourier Transform (QFT) is a
powerful tool. The QFT restores the lost commutative property at the cost of no longer being a
division algebra. It can be used, for instance, to embed a watermark in a color image. Other ap-
plications of QFT include face recognition (jointly with Quaternion Wavelet Transform) and voice
recognition [10].
Homogeneous coordinates are introduced to make translation multiplicative, along with scaling
and rotation. They are convenient in representing points, lines, and planes, and fundamental for
studying projections. Like quaternions, homogeneous coordinates are 4-tuples. This suggests that
there might be a way of doing scaling and translation using some sort of quaternion operator. As
of now, no such way has been found as quaternions and their rotation operators are algebraically
incompatible with homogeneous coordinates.
In 1873, quaternions were extended to dual quaternions by Clifford [2] to represent both rota-
tions and translations. Dual quaternions have found applications in kinematics, robotics, motion
estimation, and computer graphics.
2
Multiplicities of the eigenvalues are counted.
12
A Power, Exponential, and Logarithm
Let us first look at a unit quaternion q = q0 + q. That q02 + kqk2 = 1 implies that there exists a
unique [0, ] such that cos = q0 and sin = kqk. The quaternion can thus be rewritten in
terms of and the unit vector u = q/kqk:
q = cos + u sin .
A general quaternion q = q0 + q can be represented as a unit quaternion scaled by the norm |q|:
where u = q/kqk and = arccos(q0 /|q|). Eulers identity for a complex number
p
a + bi = a2 + b2 ei ,
where i2 = 1 and = atan2(b, a), generalizes to the quaternion q in a way that (18) can be
rewritten as
q = |q|eu .
This allows us to define the power of q as
q = |q| eu = |q| (cos() + u sin()), R. (19)
Intuitively, the power is taken over the norm of the quaternion while a scaling is performed on its
phase angle.
An exponential of q makes use of the Taylor expansion that treats q just as an ordinary variable:
i
X q
eq = .
i!
i=0
The sum on the right hand side has a closed form that transforms the above into
eq = exp(q0 + ukqk)
= eq0 (cos kqk + u sin kqk) . (20)
13
B Quaternion Differentiation and Integration
Suppose the quaternion q given in (1) is a function of some variable, say, time t. We can write the
derivative of q(t) as
q = q0 + q
= q0 + q1 i + q2 j + q3 k.
Let p given in (2) be another function of t. It is easy to verify from (3) that the product rule over
differentiation carries over, namely,
d
(pq) = pq + pq.
dt
Integration is carried over the four components of a quaternion.
Differentiation gets more complicated when q(t) is a unit quaternion that requires the devotion
of the rest of this section. In this case, the quaternion function q(t) describes how the orientation of
some moving object, represented by its body frame, varies relative to a fixed (world) frame. Let (t)
be the angular velocity of the body frame with respect to the world frame. The angular velocity
can be determined from Newtons equations for dynamics. How to characterize the changing rate
of q(t), that is, its derivative q(t)?
Theorem 3 Let q(t) be a unit quaternion function, and (t) the angular velocity determined by
q(t). The derivative of q(t) is
1
q = q. (22)
2
Proof At t + t, the rotation is described by q(t + t). This is after some extra rotation during
t performed on the frame that has already undergone a rotation described by q(t). This extra
rotation is about the instantaneous axis = /kk through the angle = kkt. It can be
described by a quaternion:
q = cos + sin
2 2
kkt kkt
= cos + sin . (23)
2 2
The rotation at t + t is thus described by the quaternion sequence q(t), q, implying
We are now ready to derive q(t). First, let us obtain the difference
kkt kkt
q(t + t) q(t) = cos + sin q(t) q(t) (by (23) and (24))
2 2
kkt kkt
= 2 sin2 q(t) + sin q(t).
4 2
The first term in the last equation above is of higher order than t, thus its ratio to t goes to
zero as the latter does. Hence
q(t + t) q(t)
q(t) = lim
t0 t
14
sin(kkt/2)
= lim q(t)
t0
t
d kkt
= sin q(t) (25)
dt 2 t=0
kk
= q(t)
2
1
= (t)q(t). (26)
2
In mechanics, the angular velocity is often in terms of the rotated frame (which is the body
frame of a moving object). Denote this angular velocity by . Thus, = q q. Substituting the
expression = q q into (22), we obtain
1
q = q (27)
2
If q is known , we can recover the angular velocity from (22) by right multiplying its both sides
with q :
= 2qq . (28)
The second derivative of the quaternion follows from differentiating (22):
1
q = (q + q) (29)
2
1 1
= q + q (by (22))
2
4
1 2 1
= kk + q.
4 2
We can also recover the angular acceleration if the first and second derivatives of q are both known.
This is done by right multiplying (29) with q :
= 2qq qq
= 2qq 2qq qq (by (28))
2
= 2(qq (qq ) ).
Let be the angular velocity of the rotating frame with respect to a fixed frame that instanta-
neously coincides with it. It is obtained from by rotating the world frame to coincide with the
rotating frame according to q. This establishes
= q q.
Combining (22) with the above, we have another expression of the quaternion derivative:
1
q = q .
2
15
The differential equation (22) can be solved via numerical integration. Let h be the time step
size, and denote by qk and k the quaternion and angular velocity at the time kh. Eulers method
approximates the quaternion at the next time step by
1
qk+1 = qk + h k qk .
2
Due to the increment, the length of qk+1 will be different from unity. It is then normalized:
qk+1
qk+1 .
kqk+1 k
Eulers method is of first order and known to be inaccurate due to the truncation error, which
will propagate to the subsequent normalization. Standard integration methods of higher order
such as Adams-Bashforth and Runge-Kutta [11] can be employed. Special integration methods for
quaternions have also been developed, and shown to be more effective. We refer to [14] for a survey
of these methods with performance comparisons.
C Quaternion Interpolation
In computer graphics and animation, there is often a need to interpolate between an objects initial
orientation (i.e., a rotation of the body frame with respect to the world frame) and final orientation
to generate a smooth rotating motion. Let the the two rotations be represented respectively by the
following two unit quaternions:
1 1
r1 = cos + u1 sin ,
2 2
2 2
r2 = cos + u2 sin ,
2 2
where for i = 1, 2, ui is a unit vector represents the axis of the ith rotation, and i the corresponding
rotation angle. For interpolation to be meaningful, r1 6= r2 must hold.
( ) = (1 )1 + 2 , (30)
where [0, 1]. However, linear interpolation between the unit vectors u1 and u2 would yield the
vector v = (1 )u1 + u2 that is not unit. If we simply normalize it as w = v/kvk, the resulting
curve w( ) is not constant speed in terms of . This is often not desired or visually appealing as
the object may seem to be rotating unstably from u1 to u2 .
Since u1 and u2 lie on the unit sphere, it is natural to interpolate them using their shortest path
on the sphere. This is the shorter one of the two great arcs connecting u1 and u2 , as illustrated in
the figure below.
16
n
O u2
u( )
u1
Picture a point u( ) moving at constant speed on this great arc from u1 to u2 as increases
from 0 to 1. Essentially, u( ) is a constant speed parametrization of the arc over [0, 1]. To derive
it, we first construct the normal to the plane:
u1 u2
n = . (31)
ku1 u2 k
In the case u1 = u2 , we may simply pick the vertical plane containing them. Denoting u1 =
(ux , uy , uz ), the vertical plane has the normal
(uy , ux , 0)
n = q
u2x + u2y
sin((1 )) sin( )
u( ) = u1 + u2 . (33)
sin sin
The correctness of the above expression can be first established for the case that u1 and u2 lie
in the xy-plane, and n is along the z-direction. Let u1 = (cos 1 , sin 1 ). Then u2 = (cos(1 +
), sin(1 + )). We have
sin((1 )) sin( )
u1 + u2
sin sin
17
sin((1 )) cos 1 + sin( ) cos(1 + ) sin((1 )) sin 1 + sin( ) sin(1 + )
= ,
sin sin
sin (cos( ) cos 1 sin( ) sin 1 ) sin (cos( ) sin 1 + sin( ) cos 1 )
= ,
sin sin
= (cos(1 + ), sin(1 + ))
= u( ).
If u1 and u2 do not lie in the xy-plane, we rotate n to coincide with the z-axis. Let R be the
corresponding rotation matrix. Then
u( ) = R1 (Ru)
1 sin((1 )) sin( )
= R (Ru1 ) + (Ru2 )
sin sin
sin((1 )) sin( )
= u1 + u2 .
sin sin
Finally, we can interpolate between r1 and r2 over [0, 1]:
( ) ( )
r( ) = cos + u( ) sin
2 2
(1 )1 + 2 sin((1 )) sin( ) (1 )1 + 2
= cos + u1 + u2 sin , (34)
2 sin sin 2
by (30) and (33), where is given in (32). The interpolation has constant change rates in both the
rotation angle and the axis.
18
It easily follows that
(u v)
= u,
v
(u v) (v u)
=
u u
= v
We start with the product of two quaternions p = p0 + p and q = q0 + q, given in (3). These
quaternions are now viewed as column vectors (p0 , p1 , p2 , p3 )T and (q0 , q1 , q2 , q3 )T , respectively. The
derivative of pq with respect to p is a 4 4 matrix:
(pq) p0 q 0 p q
=
p p p0 q + q0 p + p q
q T
q0
= , (36)
q q0 I3 q
where I3 is the 3 3 identity matrix. The partial derivative of pq with respect to p is derived from
replacing q with q in the above:
(pq ) qT
q0
= . (37)
p q q0 I3 + q
Similarly, the partial derivative of the product pq with respect to q is given below:
pT
(pq) p0
= (38)
q p p0 I3 + p
Also, the partial derivative of the product pq with respect to q is
(pq )
p0 q 0 + p q
=
q q p0 q + q0 p p q
pT
p0
= . (39)
p p0 I3 p
In each of the derivatives (36) and (38), let the non-differentiated quaternion be a pure quater-
nion v, that is, a vector, and name the other quaternion q always. Then the derivatives reduce to
the following:
0 vT
(qv)
= , (40)
q v v
0 vT
(vq)
= . (41)
q v v
Alternatively, in (36) and (38), we let the differentiated quaternion be a vector. The derivatives
becomes two 4 3 matrices:
qT
(vq)
= , (42)
v q0 I3 q
qT
(qv)
= . (43)
v q0 I3 + q
19
At last, we look at the derivatives of the product qvq respectively with respect to the unit
quaternion q and the vector v. The product gives the vector that results from performing a rotation
represented by q on v. The form is given in (5). Differentiation with respect to v is straightforward
since the product is linear in v:
(qvq )
= q02 kqk2 I3 + 2qq T + 2q0 q,
(44)
v
and
(q vq) (q v(q ) )
= (45)
v v
= q0 kqk2 I3 + 2qqT 2q0 q .
2
(46)
Meanwhile, the product is quadratic in q. Let us first obtain the following derivatives:
vq T q
(kqk2 v)
=
q q
= 2vqT ,
(v T q)q
((q v)q)
=
q q
= v qI3 + qv T .
T
Now, differentiate (5) and substitute the above derivatives in. After some cleanup, the derivative
of the rotated vector with respect to the rotation is as below:
(qvq )
= 2 q0 v + q v, vq T + (v q)I3 + qv T q0 v .
(47)
q
References
[1] P. J. Besl and N. D. McKay. A method for registration of 3-D shapes. IEEE Transactions on
pattern analysis and machine intelligence, 14(2):239256, 1992.
[4] O. D. Faugeras and M. Hebert. The representation, recognition, and locating of 3-D objects.
International Journal of Robotics Research, 5(3):2752, 1986.
[6] B. K. P. Horn. Closed-form solution of absolute orientation using unit quaternions. Journal
of Optical Society of America A, 4(4):629642, 1987.
20
[8] N. Jacobson. Basic Algebra. W. H. Freeman & Co.,1985.
[9] J. B. Kuipers. Quaternions and Rotation Sequences. Princeton University Press, 1999.
[10] S. Oldenburger. Applications of Quaternions. Written project of the course Problem Solving
Techniques in Applied Computer Science (Com S 477/577), Department of Computer Science,
Iowa State University, 2005.
[12] J. T. Schwartz and M. Sharir. Identification of partially obscured objects in two and three di-
mensions by matching noisy characteristic curves. International Journal of Robotics Research,
6(2):2944, 1987.
[13] K. Shoemake. Animating rotation with quaternion curves. Computer Graphics, 19(3):245254,
1985.
[14] F. Zhao and B. G. M. van Wachem. A novel quaternion integration approach for describing
the behaviour of non-spherical particles. Acta Mechanica, 224:30913109, 2013.
21