Three-Dimensional Rotation Matrices: 1 T T T T 2
Three-Dimensional Rotation Matrices: 1 T T T T 2
Three-Dimensional Rotation Matrices: 1 T T T T 2
1. Rotation matrices
A real orthogonal matrix R is a matrix whose elements are real numbers and satisfies
1
R = RT (or equivalently, RRT = I, where I is the n n identity matrix). Taking
the determinant of the equation RRT = I and using the fact that det(RT ) = det R,
it follows that (det R)2 = 1, which implies that either det R = 1 or det R = 1. A
real orthogonal n n matrix with det R = 1 is called a special orthogonal matrix and
provides a matrix representation of a n-dimensional proper rotation1 (i.e. no mirrors
required!).
The most general three-dimensional rotation matrix represents a counterclockwise
rotation by an angle about a fixed axis that lies along the unit vector n. The rotation
matrix operates on vectors to produce rotated vectors, while the coordinate axes are
held fixed. This is called an active transformation. In these notes, we shall explore the
general form for the matrix representation of a three-dimensional (proper) rotations,
and examine some of its properties.
1
the axis of rotation, where your fingers point in the direction. Then, your thumb
points perpendicular to the plane of rotation in the direction of n. In general, rotation
matrices do not commute under multiplication. However, if both rotations are taken
with respect to the same fixed axis, then
Simple geometric considerations will convince you that the following relations are
satisfied:
which means that for the special case of = , R(n, ) and R(n, ) represent the
same rotation. In particular, note that
Indeed for any choice of n, the R(n, ) are the only non-trivial rotation matrices whose
square is equal to the identity operator. Finally, if = 0 then R(n, 0) = I is the identity
operator (sometimes called the trivial rotation), independently of the direction of n.
To learn more about the properties of a general three-dimensional rotation, consider
the matrix representation R(n, ) with respect to the standard basis Bs = {x , y , z}.
We can define a new coordinate system in which the unit vector n points in the
direction of the new z-axis; the corresponding new basis will be denoted by B . The
matrix representation of the rotation with respect to B is then given by R(z, ). Thus,
there exists a real 3 3 special orthogonal matrix P such that3
and R(z, ) is given by eq. (1). The existence of the matrix P in eq. (8) [even without
knowing its explicit form] is sufficient to provide a simple algorithm for determining
the rotation axis n (up to an overall sign) and the rotation angle that characterize a
general three-dimensional rotation matrix.4
3
Eq. (8) is a special case of a more general result given by eq. (72), which is proved in Appendix B.
4
An explicit form for the matrix P is obtained in eq. (80) in Appendix B.
2
To determine the rotation angle , we note that the properties of the trace imply
that Tr(P RP 1) = Tr(P 1 P R) = Tr R. Hence, it immediately follows from eq. (8)
that
Tr R(n, ) = Tr R(z, ) = 2 cos + 1 , (9)
after taking the trace of eq. (1). By convention, 0 , which implies that sin 0.
Hence, the rotation angle is uniquely determined by eq. (9) To identify n, we observe
that any vector that is parallel to the axis of rotation is unaffected by the rotation
itself. This last statement can be expressed as an eigenvalue equation,
R(n, )n = n . (10)
(1 ) (cos )2 + sin2 = 0 ,
1 = 1 , 2 = ei , 3 = ei , for 0 .
3
plane perpendicular to n) are inverted by the 180 rotation and hence must satisfy
R(n, )~
v = ~ v.
Since n is a real vector of unit length, it is determined only up to an overall sign
by eq. (10) when its corresponding eigenvalue 1 is unique. This sign ambiguity is
immaterial in Case 2 in light of eq. (6). The sign ambiguity in Case 3 cannot be
resolved without further analysis. To make further progress, in Section 3 we shall
obtain the general expression for the three dimensional rotation matrix R(n, ).
In this section, the matrix elements of R(n, ) will be denoted by Rij . Since R(n, )
describes a rotation by an angle about an axis n, the formula for Rij that we seek
will depend on and on the coordinates of n = (n1 , n2 , n3 ) with respect to a fixed
Cartesian coordinate system. Note that since n is a unit vector, it follows that:
Using the techniques of tensor algebra, we can derive the formula for Rij in the
following way. We can regard Rij as the components of a second-rank Cartesian tensor.5
Likewise, the ni are components of a vector (equivalently, a first-rank tensor). Two
other important quantities for the analysis are the invariant tensors ij (the Kronecker
delta) and ijk (the Levi-Civita tensor). If we invoke the covariance of tensor equations,
then one must be able to express Rij in terms of a second-rank tensor composed of ni ,
ij and ijk , as there are no other tensors in the problem that could provide a source
of indices. Thus, the form of the formula for Rij must be:
where there is an implicit sum over the index k in the third term of eq. (13).6 The
numbers a, b and c are real scalar quantities. As such, a, b and c are functions of ,
since the rotation angle is the only non-trivial scalar quantity in this problem. If
we also allow for transformations between right-handed and left-handed orthonormal
coordinate systems, then Rij and ij are true second-rank tensors and ijk is a third-rank
pseudotensor. Thus, to ensure that eq. (13) is covariant with respect to transformations
between two bases that are related by either a proper or an improper rotation, we
conclude that a and b are true scalars, and the product cn is a pseudovector.7
5
This statement is justified in Appendix C to these notes.
6
We follow the Einstein summation convention in these notes. That is, there is an implicit sum
over any pair of repeated indices in the present and all subsequent formulae.
7
Under inversion of the coordinate system, and n n. Since 0 , one must then
use eq. (4) to flip the signs of both and n to represent the rotation R(n, ) in the new coordinate
system. Hence, the signs of and n effectively do not change under the inversion of the coordinate
system. That is, any scalar function of is a true scalar and n is a pseudovector. It follows that the
product cn is a pseudovector as asserted in the text above.
4
The quantities a, b and c can be determined as follows. First, we rewrite eq. (10)
in terms of components,
Rij nj = ni . (14)
To determine the consequence of this equation, we insert eq. (13) into eq. (14) and
make use of eq. (12). Noting that
ij nj = ni , nj nj = 1 ijk nj nk = 0 , (15)
a+b = 1. (16)
Since the formula for Rij given by eq. (13) must be completely general, it must hold
for any special case. In particular, consider the case where n = z. In this case, eqs. (1)
and (13) yields:
Inserting these results into eq. (13) yields the Rodrigues formula,
5
In Section 5, we show that it is possible to express a general rotation matrix R(n, )
as a product of simpler rotations. This will provide further geometrical insights into
the properties of rotations.
it follows that
2nm sin = Rij ijm . (25)
If R is a symmetric matrix (i.e. Rij = Rji ), then Rij ijm = 0 automatically since
ijk is antisymmetric under the interchange of the indices i and j. In this case sin = 0
and we must seek other means to determine n. If sin 6= 0, then one can divide both
sides of eq. (25) by sin . Using eq. (23), we obtain:
More explicitly,
1
n = p R32 R23 , R13 R31 , R21 R12 , Tr R 6= 1 , 3 .
(3 Tr R)(1 + Tr R)
(27)
If we multiply eq. (25) by nm and sum over m, then
6
after using eq. (19) for Rjk . Hence,
Sjk
nj nk = , Tr R 6= 3 . (30)
3 Tr R
To determine n up to an overall sign, we simply set j = k (no sum) in eq. (30), which
fixes the value of
Sjj
n2j = , Tr R 6= 3 , (no sum over j) . (31)
3 Tr R
If sin 6= 0, the overall sign of n is fixed by eq. (26). Note that eq. (29) implies that
Tr S = 3 Tr R. Summing over j in eq. (31) then yields
Tr S
n n = = 1,
3 Tr R
as required for a unit vector.
As noted above, if R is a symmetric matrix (i.e. Rij = Rji ), then sin = 0 and
n cannot be determined from eq. (26). In this case, eq. (22) determines whether
cos = +1 or cos = 1. For cos = 1, eq. (29) yields nj nk = 41 Sjk , which
determines n up to an overall sign. Equivalently, one can use eq. (20) to derive
q q q
1 1 1
n = 1 2 (1 + R11 ) , 2 2 (1 + R22 ) , 3 2 (1 + R33 ) , if Tr R = 1 , (32)
7
Multiplying out the three matrices on the right-hand side of eq. (34), we obtain the
Euler angle parameterization of the three-dimensional rotation matrix,
cos cos cos sin sin cos cos sin sin cos cos sin
R(n, ) = sin cos cos + cos sin sin cos sin + cos cos sin sin .
sin cos sin sin cos
(36)
One can now make use of the results of Section 4 to obtain and n in terms of the
Euler angles , and . For example, cos is obtained from eq. (23). Simple algebra
yields:
cos = cos2 (/2) cos( + ) sin2 (/2) , (37)
where I have used cos2 (/2) = 21 (1 + cos ) and sin2 (/2) = 12 (1 cos ). Thus, we
have determined mod , consistent with our convention that 0 [cf. eq. (23)
and the text preceding this equation]. One can also rewrite eq. (37) in a slightly more
convenient form,
cos = 1 + 2 cos2 (/2) cos2 21 ( + ) . (38)
We examine separately the cases for which sin = 0. First, cos = cos( + ) = 1
implies that = 0 and R(n, ) = I. In this case, the axis of rotation, n, is undefined.
Second, if = then cos = 1 and n is determined up to an overall sign (which is
not physical). Eq. (38) then implies that cos2 (/2) cos2 12 ( + ) = 0, or equivalently
(1 + cos ) [1 + cos( + )] = 0, which yields two possible subcases,
where
n = sin 21 ( ) , cos 21 ( ) , 0 .
In subcase (ii), if cos( + ) = 1, then
where
n = sin(/2) cos , sin(/2) sin , cos(/2) .
8
Finally, we consider the generic case where sin 6= 0. Using eqs. (27) and (36),
R32 R23 = 2 sin sin 12 ( ) cos 21 ( + ) ,
R13 R31 = 2 sin cos 12 ( ) cos 12 ( + ) ,
R21 R12 = 2 cos2 (/2) sin( + ) .
In normalizing the unit vector n, it is convenient to write sin = 2 sin(/2) cos(/2)
and sin( + ) = 2 sin 21 ( + ) cos 21 ( + ). Then, we compute:
q 2
= 4 cos 2 ( + ) cos(/2) sin (/2) + cos2 (/2) sin2 21 ( + ) . (39)
1
Hence,8
n = q
sin2 (/2) + cos2 (/2) sin2 21 ( + )
1 1 1
sin(/2) sin 2 ( ) , sin(/2) cos 2 ( ) , cos(/2) sin 2 ( + ) ,
(40)
where = 1 according to the following sign,
sgn cos 12 ( + ) cos(/2) , sin 6= 0 . (41)
Remarkably, eq. (40) reduces to the correct results obtained above in the two subcases
corresponding to = , where cos(/2) = 0 and/or cos 21 ( + ) = 0, respectively.
Note that in the latter two subcases, as defined in eq. (41) is indeterminate. This
is consistent with the fact that the sign of n is indeterminate when = . Finally,
one can easily verify that when = 0 [corresponding to cos = cos( + ) = 1], the
direction of n is indeterminate and hence arbitrary.
One can rewrite the above results as follows. First, use eq. (38) to obtain:
q
sin(/2) = sin2 (/2) + cos2 (/2) cos2 21 ( + ) ,
8
One can can also determine n up to an overall sign starting from eq. (36) by employing the
relation R(n, )n = n. The sign of n sin can then be determined from eq. (27).
9
where the components of n sin(/2) comprise the last three components of the quater-
nion q and
where we have noted that (n21 + n22 )1/2 = sin(/2) 0, since 0 , and the sign
= 1 is defined by eq. (41). Similarly,
n1
cos n = = sin 21 ( ) = cos 21 ( + ) , (46)
(n21 + n22 )
n2
sin n = = cos 21 ( ) = sin 12 ( + ) , (47)
(n21 + n22 )
or equivalently
n = 12 ( + ) mod 2 . (48)
Indeed, given that 0 , < 2 and 0 , we see that n is determined mod
and n is determine mod 2 as expected for a polar and azimuthal angle, respectively.
One can also solve for the Euler angles in terms of , n and n . First, we rewrite
eq. (38) as:
cos2 (/2) = cos2 (/2) cos2 12 ( + ) . (49)
Then, using eqs. (45) and (49), it follows that:
Plugging this result back into eqs. (45) and (49) yields
cos n sin(/2)
sin 21 ( + ) = p , (51)
1 sin2 n sin2 (/2)
cos(/2)
cos 21 ( + ) = p . (52)
1 sin2 n sin2 (/2)
9
In comparing with other treatments in the mathematics literature, one should be careful to note
that the convention of sin 0 (which implies that q0 0) is not universally adopted. Often, the
quaternion q in eq. (43) will be re-defined as q in order to remove the factors of from eq. (44), in
which case q0 0.
10
Note that if = then eq. (50) yields = and n = /2, in which case +
is indeterminate. This is consistent with the observation that is indeterminate if
cos(/2) = 0 [cf. eq. (41)].
We shall also make use of eqs. (46) and (47),
cos(/2)
sin n p = cos 12 ( ) cos 12 ( + ) = 2 sin(/2) sin(/2) .
1 sin2 n sin2 (/2)
If either = 0 or = 0, then the argument of sgn in eq. (55) will vanish. In this
case, sin 12 ( + ) 0, and we may use eq. (51) to conclude that = sgn {cos n }, if
n 6= /2. The case of n = n = /2 must be separately considered and corresponds
simply to = and = = 0, which yields = 1. The sign of is indeterminate
if sin = 0 as noted below eq. (41).10 The latter includes the case of = , which
implies that = and n = /2, where + is indeterminate [cf. eq. (52)].
There is an alternative strategy for determining the Euler angles in terms of , n
and n . Simply set the two matrix forms for R(n, ), eqs. (20) and (36), equal to each
other, where n is given by eq. (35). For example,
where the matrix elements of R(n, ) are denoted by Rij . It follows that
q
sin = 2 sin(/2) sin n 1 sin2 n sin2 (/2) , (57)
which also can be derived from eq. (50). Next, we note that if sin 6= 0, then
11
Using eq. (20) yields (for sin 6= 0):
cos n sin n sin(/2) cos n cos(/2)
sin = p , (58)
1 sin2 n sin2 (/2)
cos n cos n sin(/2) + sin n cos(/2)
cos = p , (59)
1 sin2 n sin2 (/2)
cos n sin n sin(/2) + cos n cos(/2)
sin = p , (60)
1 sin2 n sin2 (/2)
cos n cos n sin(/2) + sin n cos(/2)
cos = p . (61)
1 sin2 n sin2 (/2)
The cases for which sin = 0 must be considered separately. Since 0 ,
sin = 0 implies that = 0 or = . If = 0 then eq. (56) yields either (i) = 0,
in which case R(n, ) = I and cos = cos( + ) = 1, or (ii) sin n = 0, in which case
cos = 1 and + = mod , with indeterminate. If = then eq. (56)
yields n = /2 and = , in which case cos = 1 and = 2 mod 2, with
+ indeterminate.
One can use eqs. (58)(61) to rederive eqs. (51)(54). For example, if 6= 0, 6= 0
and sin 6= 0, then we can employ a number of trigonometric identities to derive11
12
We now use eqs. (58)(61) to evaluate the above expressions. To evaluate the denom-
inators of eqs. (62) and (63), we compute:
Hence,
!
cos(/2)
(1 cos )1/2 (1 cos )1/2 = sin n p ,
1 sin2 n sin2 (/2)
where = 1 is the sign defined by eq. (55). Likewise we can employ eqs. (58)(61)
to evaluate:
" #
2 cos(/2) cos(/2)
sin sin (1 cos )(1 cos ) = p sin n p ,
1 sin2 n sin2 (/2) 1 sin2 n sin2 (/2)
" #
cos(/2)
sin sin + (1 cos )(1 cos ) = 2 sin n sin n p ,
1 sin2 n sin2 (/2)
" #
2 cos n sin(/2) cos(/2)
sin (1 cos ) + sin (1 cos ) = p sin n p ,
1 sin2 n sin2 (/2) 1 sin2 n sin2 (/2)
" #
cos(/2)
sin (1 cos ) + sin (1 cos ) = 2 cos n sin n p .
1 sin2 n sin2 (/2)
Inserting the above results into eqs. (62) and (63), it immediately follows that
cos(/2)
cos 21 ( + ) = p , cos 12 ( ) = sin n , (64)
1 sin2 n sin2 (/2)
cos n sin(/2)
sin 21 ( + ) = p , sin 12 ( ) = cos n , (65)
1 sin2 n sin2 (/2)
where is given by eq. (55). We have derived eqs. (64) and (65) assuming that 6= 0,
6= 0 and sin 6= 0. Since cos(/2) is then strictly positive, eq. (41) implies that
is equal to the sign of cos 21 ( + ), which is consistent with the expression for
cos 12 ( + ) obtained above. Thus, we have confirmed the results of eqs. (51)(54).
If = 0 and/or = 0, then the derivation of eqs. (62) and (63) is not valid.
Nevertheless, eqs. (64) and (65) are still true if sin 6= 0, as noted below eq. (55), with
13
= sgn(cos n ) for n 6= /2 and = +1 for n = n = /2. If = 0, then as noted
below eq. (61), either = 0 in which case n is undefined, or 6= 0 and sin n = 0
in which case the azimuthal angle n is undefined. Hence, = 0 implies that
is indeterminate. Finally, as indicated below eq. (52), + is indeterminate in the
exceptional case of = (i.e., = and n = /2).
EXAMPLE: Suppose = = 150 and = 90 . Then cos 21 ( + ) = 21 3,
which implies that = 1. Eqs. (38) and (40) then yield:
1
cos = 41 , n = (0 , 2 , 1) . (66)
5
The polar and azimuthal angles of n [cf. eq. (35)] are then given by n = 90 (mod 2)
and tan n = 2. The latter can also be deduced from eqs. (45) and (48).
Likewise, given eq. (66), one obtains cos = 0 (i.e. = 90 ) from eq. (56), = 1
from eq. (55), = from eqs. (53) and (54), and = = 150 from eqs. (51) and
(52). One can verify these results explicitly by inserting the values of the corresponding
parameters into eqs. (20) and (36) and checking that the two matrix forms for R(n, )
coincide.
Given any matrix A, the eigenvalues are the solutions to the characteristic equation,
det (A I) = 0 . (67)
Suppose that A is an n n real orthogonal matrix. The eigenvalue equation for A and
its complex conjugate transpose are given by:
Av = v , vTA = vT .
Hence multiplying these two equations together yields
vT v = v T AT Av = v T v , (68)
since an orthogonal matrix satisfies AT A = I. Since eigenvectors must be nonzero, it
follows that v T v 6= 0. Hence, eq. (68) yields || = 1. Thus, the eigenvalues of a real
orthogonal matrix must be complex numbers of unit modulus. That is, = ei for
some in the interval 0 < 2.
Consider the following product of matrices, where A satisfies AT A = I,
AT (I A) = AT I = (I A)T .
Taking the determinant of both sides of this equation, it follows that13
det A det(I A) = (1)n det(I A) , (69)
12
A nice reference to the results of this appendix can be found in L. Mirsky, An Introduction to
Linear Algebra (Dover Publications, Inc., New York, 1982).
13
Here, we make use of the well known properties of the determinant, namely det(AB) = detA detB
and det(AT ) = det A.
14
since for the n n identity matrix, det(I) = (1)n . For a proper odd-dimensional
orthogonal matrix, we have det A = 1 and (1)n = 1. Hence, eq. (69) yields14
Comparing with eq. (67), we conclude that = 1 is an eigenvalue of A.15 Since det A
is the product of its three eigenvalues and each eigenvalue is a complex number of unit
modulus, it follows that the eigenvalues of any proper 3 3 orthogonal matrix must
be 1, ei and ei for some value of that lies in the interval 0 .16
Next, we consider the following product of matrices, where A satisfies AT A = I,
AT (I + A) = AT + I = (I + A)T .
For any improper orthogonal matrix, we have det A = 1. Hence, eq. (71) yields
In this appendix, we derive the following relation between the matrix representa-
tions of two rotations by an angle with respect to two different rotation axes,
To prove eq. (72), we first compute the angle of the rotation P R(n , )P 1 using
eq. (23). Since Tr[P R(n , )P 1 ] = TrR(n , ) using the cyclicity of the trace, it follows
that the angles of rotation corresponding to P R(n , )P 1 and R(n , ) coincide and
are both equal to . To compute the corresponding axis of rotation n, we employ
eq. (25),
2nm sin = (P R P 1 )ij ijm , (73)
14
Eq. (70) is also valid for any improper even-dimensional orthogonal matrix A since in this case
det A = 1 and (1)n = 1.
15
Of course, this is consistent with the result that the eigenvalues of a real orthogonal matrix are
of the form ei for 0 < 2, since the eigenvalue 1 corresponds to = 0.
16
There is no loss of generality in restricting the interval of the angle to satisfy 0 . In
particular, under 2 , the two eigenvalues ei and ei are simply interchanged.
15
where R R(n , ). Since P is a rotation matrix, we have P 1 = P T , or equivalently
(P 1 )j = Pj . Hence, we can rewrite eq. (73) as:
2nm sin = Pik Rk Pj ijm . (74)
Multiplying both sides of eq. (74) by Pmn and using the definition of the determinant
of a 3 3 matrix,
Pik Pj Pmn ijm = (det P )kn ,
it then follows that:
2Pmn nm sin = Rk kn . (75)
after noting that det P = 1 (since P is a proper rotation matrix). Finally, we again
use eq. (25) which yields
2nn sin = Rk
kn . (76)
Assuming that sin 6= 0, we can subtract eqs. (75) and (76) and divide out by 2 sin .
Using (P T )nm = Pmn , the end result is:
n P T n = 0 .
This is easily checked by noting that R(y, n )z is a unit vector with polar angle n
that lies in the xz plane. Multiplying the resulting vector by R(z, n ) then produces
16
a unit vector with polar angle n and azimuthal angle n as required. Multiplying out
the two rotation matrices in eq. (79) yields,
nn n2
p 3 1 p n1
n21 + n22 n21 + n22
P = p n3 n2 n1 . (80)
n2 + n2 p
2 2
n 2
1 2 n1 + n2
p
n21 + n22 0 n3
Consider the matrix elements of a linear operator with respect to two different
orthonormal bases, B = {e1 , e2 , e3 } and B = {e1 , e2 , e3 } . Then, the two sets of
basis vectors are related by
ej = Pij ei ,
where P is an orthogonal matrix. Given any linear operator A with matrix elements
aij with respect to the basis B, the matrix elements aij with respect to the basis B are
related by a similarity transformation,
where we have used the fact that P 1 = P T in the second step above. Finally, identi-
fying P = R1 , where R is also an orthogonal matrix, it follows that
ak = Rki Rj aij ,
which we recognize as the transformation law for the components of a second rank
Cartesian tensor.
17
where S~ = (S1 , S2 , S3 ) is a vector whose components are the three real 3 3
antisymmetric matrices Sk , whose ij matrix elements are given by
(Sk )ij = iijk .
Thus, the matrix elements of the matrix that appears in the argument of the exponen-
tial in eq. (81) are given by
~ )ij iijk nk ,
(n S (82)
where the implicit sum over k is assumed. To prove this result, we perform an explicit
computation of eq. (81) and show that the end result is eq. (19), which we rewrite as
follows:
Rij (n, ) = ni nj + (ij ni nj ) cos ijk nk sin . (83)
The exponential in eq. (81) is defined via its power series,
~
i n S
X 1 ~ k.
R(n, ) = e = (in S) (84)
k=0
k!
Using eq. (82),
~ )2ij = ik nk jm nm = (ij km im jk )nk nm = ij ni nj ,
(n S
after employing the well-known -tensor identity and noting that km nk nm = 1 for the
unit vector n. Next, we compute:
~ )3ij = i(i ni n )jk nk = iijk nk = (n S)
(n S ~ ij .
Thus, for any positive integer k,
~ )2k1 = n S
(n S ~, ~ )2k = (n S)
(n S ~ 2.
Inserting these results in eq. (84), we obtain:
~
X 1 2k+1 ~ 2
X 1
Rij (n, ) = ij (n S)ij (i) + (n S)ij (i)2k
(2k + 1)! (2k)!
k=0 k=1
~ ij sin + (n S)
= ij i(n S) ~ 2ij (cos 1)
References
1. W.-K. Tung, Group Theory in Physics (World Scientific, Singapore, 1985).
2. K.N. Srinivasa Rao, The Rotation and Lorentz Groups and their Representations
for Physicists (Wiley Eastern Limited, New Delhi, 1988).
3. S.L. Altmann, Rotations, Quaternions, and Double Groups (Dover Publications,
Inc., New York, NY, 2005).
18