# The 3 × 3 rotation matrix The cross product and its associated matrix

p. 1

**The cross product a × b is only deﬁned for vectors in IR3.
**

a1 b1 a2 b3 − a3 b2 a , b = b , then a × b = a b − a b If a = 2 1 3 2 3 1 a3 b3 a1b2 − a2b1

The cross product has the following properties: • aT (a × b) = 0 and bT (a × b) = 0. The cross product is therefore a vector that is perpendicular to both a and b. • ||a × b|| = ||a|| · ||b|| sin θ, where θ is the angle between a and b. From this it follows that a × a = 0. The cross product can however also be associated with matrix multiplication: a × b = A b, where 0 −a3 a2 a A= 3 0 −a1 −a2 a1 0

• a × b = −b × a.

but when enough independent vectors x can be found.
• A3 = −||a||2 A. 2./ A[x1. . and if ||a|| = 1. . . x2. . 2
The cross product matrix A has the following properties: • It is anti-symmetrical: AT = −A. . Proof: or AX = BX. x2. xn] = B[x1. . xn]. When n linearly independent vectors xk . x2. where X = [x1. . . then A3 = −A. k = 1. therefore A = B. xn]
. . . .
Equality of matrices Generally Ax = Bx does not imply that A = B. . . • It does not have an inverse: det(A) = 0. therefore X −1 exists and AXX −1 = BXX −1. equality can be proved: Theorem: Let A and B be n × n matrices. but the columns of X are linearly independent. • A2 is symmetrical. • Tr(A2) = −2||a||2. . then A = B. . .The 3 × 3 rotation matrix
p. n can be found so that Axk = Bxk . .

We want to ﬁnd the rotation matrix Q. b and c. ﬁnd the 3 × 3 rotation matrix that will rotate all vectors in IR3 about a through the angle θ. that rotates b and c through an angle of θ. 3
We now want to solve the following problem: Given a certain normalized vector a. a.
a
Qc
c
θ
b
θ
Qb
Qb
θ
c
Qc
θ
b
Then Qa = a Qb = b cos θ + c sin θ Qc = c cos θ − b sin θ (1) (2) (3)
. but leaves a unchanged.The 3 × 3 rotation matrix Derivation of the 3 × 3 rotation matrix
p. and an angle θ. and let them be constructed in such a way that c = a × b = A b. Consider three orthogonal normalized vectors in IR3.

θ: ∂Q c = ∂θ = = = −c sin θ − b cos θ
−Qb −Q[−Ac] QAc
(8)
. This implies that Ac = −b and b = −Ac. θ: ∂Q b = [−I sin θ + A cos θ]b ∂θ and from (5) follows that ∂Q b = QAb ∂θ
p. Now diﬀerentiate (3) w.t.t. 4
(4) (5)
(6)
(7)
Note that a × c = −b (right hand rule for cross product).The 3 × 3 rotation matrix Substitute c = A b into (2) and (3): Qb = (I cos θ + A sin θ)b QAb = (−I sin θ + A cos θ)b Now diﬀerentiate (4) w.r.r.

verify on your own that the above is the solution of (10). θ: ∂Q a=0 ∂θ and QAa = 0 (since Aa = 0). and the theorem in the previous paragraph. and therefore ∂Q a = QAa ∂θ
p.r.t. b and c are linearly independent vectors. that ∂Q = QA ∂θ (10)
This is a matrix diﬀerential equation with initial condition Q(0) = I The solution is Q = eθA By expanding eθA into a Taylor series. it follows from (7). (9).
. 5
(9)
Since a. (8).The 3 × 3 rotation matrix Also diﬀerentiate (1) w.

A4 = −A2. . .The 3 × 3 rotation matrix Other formulas for the rotation matrix
p. For a given Q. a and θ can be found as follows: Tr(Q) = Tr(I) + sin θ Tr(A) + (1 − cos θ)Tr(A2) = 3 + 0 + (1 − cos θ)(−2) = 1 + 2 cos θ
. . 2! 3! 4! 3 5 θ θ2 θ4 θ 2 = I + A (θ − + − . . 2! 3!
but A3 = −A..) + A2 3! 5! 2! 4!
and then Q = I + A sin θ + A2(1 − cos θ) For a given a and θ..) + A (−1 + − + . .. etc. 6
The rotation matrix Q can also be written in terms of sin θ and cos θ: Q = I + θA + 1 2 2 1 3 3 θ A + θ A + . . A5 = A. Q can be obtained from the above formula. therefore
Q = I + θA + 1 2 2 1 3 1 θ A − θ A − θ4A2 + .

The 3 × 3 rotation matrix We therefore obtain cos θ = 1 (Tr(Q) − 1) 2 From Q − QT = [ I + A sin θ + A2(1 − cos θ) ] − [ I − A sin θ + A2(1 − cos θ) ] = 2A sin θ we can easily ﬁnd A and therefore also a: 1 (Q − QT ) A= 2 sin θ
p. The x axis is spanned by the unit vector a = [1 0 0]T The cross product matrix A is therefore given by 0 −a3 a2 0 0 0 a = 0 A= 3 0 −1 0 −a1 0 1 0 −a2 a1 0
. 7
Example 1: Calculate the rotation matrix Q that rotates all vectors in IR3 10◦ about the x axis.

2 1.9848 Verify that det(Q) = 1
p.5 0 -1
y-axis
x-axis
y-axis
x-axis
X
QX
.5 1 0 -0. The rotation axis is shown each time. 8
Let X be a 3 × 8 matrix of which the columns constitute the coordinates of the vertices of the box below left. The rotation matrix Q (above) is then applied once. The new coordinates are then plotted.5 1 0.5 1 2 1.5 -2 0.The 3 × 3 rotation matrix The rotation matrix Q is therefore given by Q = I + A sin θ + A2(1 − cos θ) = I + A sin 10◦ + A2(1 − cos 10◦) 0 0 1 0 0.1736 0.5
z-axis
0 -0. twice and three times to the coordinates of the original box.5 -2 0.5
z-axis
1 0 -0.9848 −0.5
0 -0.5 0 -1
0.5 -1 -1.5 -1 -1.1736 = 0 0.

5 1 0.1736 0 1 0 Q= −0.5
z-axis
0 -0.5 -1 -1.5 1 1.5 -2 1 0 1 -1 0 -1
0 -0. 9
z-axis
z-axis
0.9848 0 0.5 2 1.5 1 0 -0.5 -2 1 1 0 -0.5
y-axis
x-axis
y-axis
x-axis
X
QX
.5 0 -1
z-axis
0 -0.5 1 0.5 -1 -1.5 -2 1 0.5 -1 -1.1736 0 0.9848
2 1.The 3 × 3 rotation matrix
2 1.5 -1 -1.5 1 0. is given by 0.5
p.5 0 -0.5 0 -1
0.5
1 0 -1 0 -1 1
y-axis
x-axis
y-axis
x-axis
QQX
QQQX
Example 2: Show on your own that the rotation matrix Q that rotates all vectors in IR3 10◦ about the y axis.

5 0 -1
y-axis
x-axis
y-axis
x-axis
X
QX
.5 -2 0.5 -1
1
y-axis
x-axis
y-axis
x-axis
QQX
QQQX
Example 3: Show on your own that the rotation matrix Q that rotates all vectors in IR3 10◦ about the z axis.9848 Q = 0. 10
2 1
2 1
z-axis
0 -1 -2 1 0.5 2 1.5
z-axis
z-axis
1 0 -0.5 1 0.1736 0.5 1 0 -0.The 3 × 3 rotation matrix
p.5 0 -1
0 -0.5 0 0 -0.5 -2 0.1736 0 0.5 0 -1
z-axis
0 -1 -2 1 0. is given by −0.5
0 -0.5 -1 -1.5 -1 -1.5 1 0 -0.5 1 0.9848 0 0 0 1
2 1.

11
z-axis
z-axis
1 0 -0.5 -2 0.5 1 0.5 -2 0.5
0 -0.5 1 0.5 1 0 -0.5 -1 -1.5 0 -1
0 -0.5
p. a = 5 0 4
.5 2 1.The 3 × 3 rotation matrix
2 1.5 -1 -1.5 0 -1
y-axis
x-axis
y-axis
x-axis
QQX
QQQX
Problem: Find the rotation angle θ and the rotation axis a when the rotation matrix Q is given by
Q=
17 25 √ 2 3 5 6 25
√ 2 3 − 5 1 2 √ 3 3 10
6 25 √ 3 3 − 10 41 50
3 1 ◦ Answer: θ = 60 .