Search Continuum Mechanics Website

Rotation Matrices

 home > deformation & strain > rotation matrices
Prev Up Next

Introduction

A rotation matrix, RR, describes the rotation of an object in 3-D space. It was introduced on the previous two pages covering deformation gradients and polar decompositions.

The rotation matrix is closely related to, though different from, coordinate system transformation matrices, QQ, discussed on this coordinate transformation page and on this transformation matrix page.

A transformation matrix describes the rotation of a coordinate system while an object remains fixed. In contrast, a rotation matrix describes the rotation of an object in a fixed coordinate system. The amazing fact, and often a confusing one, is that each matrix is the transpose of the other.

This entire page is essentially the transpose of the transformation matrix page. The two pages together border on being redundant. However, there are subtle differences between the two and they are stressed on this page.


Summary

The rotation matrix, RR, is used in the rotation of vectors and tensors while the coordinate system remains fixed. The vector or tensor is usually related to some object that is actually undergoing the rotation, and the vector and/or tensor is along for the ride.

Rotated Potato
The general rules for applying the rotation matrix are the same as for the coordinate transformation matrix.

Vectors   vv==RvRv
2nd Rank Tensors   σ=RσRT
4th Rank Tensors   C=RRCRTRT

and in tensor notation...

Vectors   vi=Rijvj
2nd Rank Tensors   σmn=RmiRnjσij
4th Rank Tensors   Cmnop=RmiRnjRokRplCijkl


In two dimensions, R is

R=[cosθsinθsinθcosθ]
where θ is the rotation angle. Note that R is just the transpose of Q, i.e., R=QT and Q=RT.

Rotation Matrix Properties

Rotation matrices have several special properties that, while easily seen in this discussion of 2-D vectors, are equally applicable to 3-D applications as well. This list is useful for checking the accuracy of a rotation matrix if questions arise. While a matrix still could be wrong even if it passes all these checks, it is definitely wrong if it fails even one!

Multiplication of Rotation Matrices

Recall from above that the dot product of any two different rows or columns of a rotation matrix is zero, while the dot product of any row or column with itself is one. This can be written in matrix and tensor notation as

RRT=IandRikRjk=δij
This shows that the transpose of a rotation matrix is also its inverse.

Rotating the Potato...

Recall that the vector on the potato was

v=2ˆi+9ˆj
and the 50° counter-clockwise rotation of the coordinate system yielded

v=8.18ˆi+4.25ˆj
In contrast, rotating the potato itself 50° counter clockwise gives

{vxvy}=[cos50sin50sin50cos50]{29}{5.6097.317}
So the rotated vector is

v=5.609ˆi+7.317ˆj
Note that the apostrophe is on v to signify that it is somehow different from the reference v vector (rotated in this case), but it is not on i and j because they are still in the reference coordinate system.

Comparing Rotations to Transformations

The previous example rotated the potato and vector 50° counter-clockwise. This example will instead rotate the coordinate system 50° clockwise, so θ will be -50° this time.

{vxvy}=[cos(-50)sin(-50)sin(-50)cos(-50)]{29}{5.6097.317}
So the vector can be written as

v=5.609ˆi+7.317ˆj
in the rotated coordinate system. The important point to be made here is that the numerical values of the rotated vector in the 1st example and the vector in the oppositely-rotated coordinate system of this example, are the same.

The general definition of R, in 3-D, is

R=[cos(x,x)cos(y,x)cos(z,x)cos(x,y)cos(y,y)cos(z,y)cos(x,z)cos(y,z)cos(z,z)]
where (x,x) represents the angle between the x and x axes, (x,y) is the angle between the x and y axes, etc. Yes, this is indeed the transpose of Q.

3-D Reduction to 2-D

So a rotation about the z-axis means that cos(z,z)=1 because the angle between z and z remains 0°. Meanwhile, cos(x,z)=cos(y,z)=cos(z,x)=cos(z,y)=0 because the angles between these axes remains 90°.

The angle between y and x is (90+θ), and cos(y,x)=cos(90+θ)=sinθ.

Likewise, the angle between x and y is (90θ), and cos(x,y)=cos(90θ)=sinθ.

All of this leads to

R=[cosθsinθ0sinθcosθ0001]
which reveals the 2-D rotation matrix within the 3-D matrix.

An alternative way of interpreting and generating the rotation matrix is as follows.

R=[(x-compof i)(x-compof j)(x-compof k)(y-compof i)(y-compof j)(y-compof k)(z-compof i)(z-compof j)(z-compof k)]
where "x-comp of i" means the x-component of the i unit vector. Pay close attention here to which terms have primes on them and which don't. Don't confuse this with "the x'-component" because "the x'-comp of i" is simply 1. Yet another way to say this is, "the first component of the i unit vector in the non-primed reference x,y,z coordinate system." Once again, this is just the transpose of the Q matrix.


Successive Rotations - Roe Convention

The 3-D rotation matrix can be viewed as a series of three successive rotations about coordinate axes. There must be dozens of variations of this since any combination of axes can be chosen in any order to rotate about. One popular choice is the so-called Roe convention.

As shown in the figure, it consists of (i) a rotation through angle ψ about the z-axis, then (ii) a rotation of angle θ about the new y-axis (which has already rotated itself due to the first rotation about z), and finally, (iii) a second rotation of ϕ about the now-tilted z-axis.

The Roe convention is very popular despite one key challenge it contains. That is... if θ=0, then ψ and ϕ become indistinguishable and only the sum of the two is what matters.

Roe Coordinate Transform


R=[cosψsinψ0sinψcosψ0001][cosθ0sinθ010sinθ0cosθ][cosϕsinϕ0sinϕcosϕ0001]=[cosψcosθcosϕsinψsinϕcosψcosθsinϕsinψcosϕcosψsinθsinψcosθcosϕ+cosψsinϕsinψcosθsinϕ+cosψcosϕsinψsinθsinθcosϕsinθsinϕcosθ]
This time, the rotation matrices are indeed written in the same order: ψ,θ,ϕ.

Roe Angles Example

In the figure above, ψ=60,θ=30, and ϕ=45. These Roe angles give a coordinate transformation matrix equal to

R=[cos60cos30cos45sin60sin45cos60cos30sin45sin60cos45cos60sin30sin60cos30cos45+cos60sin45sin60cos30sin45+cos60cos45sin60sin30sin30cos45sin30sin45cos30]=[0.30620.91860.25000.88390.17680.43300.35360.35360.8660]

Going In Reverse - Determining Roe Angles from a Rotation Matrix

Suppose you have a rotation matrix populated with values as shown here and would like to know what Roe transformation angles were responsible for producing the matrix.

R=[R11R12R13R21R22R23R31R32R33]
The first and easiest step is to look at the R33 component. It is simply the cosine of θ, so θ=Cos1(R33).

The second step is to determine ψ as follows

R23R13=sinψsinθcosψsinθ=sinψcosψ=tanψ So
ψ=Tan1(R23R13) The same process leads to
ϕ=Tan1(R32R31) So in summary
ψ=Tan1(R23R13)θ=Cos1(R33)ϕ=Tan1(R32R31)
UNLESS!!!....... θ proves to be very small! In this case, sinθ will be very small and therefore, so will R31,R32,R13, and R23 because all these terms contain sinθ. This can lead to major round-off errors in any such calculations.

Fortunately, the solution for this (θ0) is to recall that ψ and ϕ become indistinguishable from each other. This permits ϕ to be set to zero, and ψ to be computed according to ψ=Sin1(R21).

Example: Roe Angles from Matrix

Let's start with the matrix in the previous example and work backwards.

R=[0.30620.91860.25000.88390.17680.43300.35360.35360.8660]
Start with the R33 term to determine θ.

θ=Cos1(R33)=Cos1(0.8660)=30
Since θ is not near zero, ψ and ϕ can be computed as follows.

ψ=Tan1(R23R13)=Tan1(0.43300.2500)=60
ϕ=Tan1(R32R31)=Tan1(0.35360.3536)=45
So as expected, the original values are recovered: ψ=60,θ=30, and ϕ=45.


Rotation About An Axis

Axis-Angle Transform
Yet another way of specifying the rotation matrix is through a rotation axis vector, p, and a rotation angle, α, about the p axis.

In this case, the rotation matrix is written as

R=cosαI+(1cosα)ppsinαP
with
P=[0p3p2p30p1p2p10]
Writing the matrix out gives

R=[cosα+(1cosα)p21(1cosα)p1p2sinαp3(1cosα)p1p3+sinαp2(1cosα)p2p1+sinαp3cosα+(1cosα)p22(1cosα)p2p3sinαp1(1cosα)p3p1sinαp2(1cosα)p3p2+sinαp1cosα+(1cosα)p23]
As usual, this can be written quite concisely in tensor notation

Rij=cosαδij+(1cosα)pipjsinαϵijkpk
Note the similarity to the tensor equation of Q. The only difference is the + or - in front of sinα.

Qij=cosαδij+(1cosα)pipj+sinαϵijkpk

It is very important to recognize that p is a unit vector. Using any other length will lead to incorrect results.

Also, it's actually more common to use θ or ϕ as the rotation angle instead of α. But α is being used here to minimize confusion with ψ,θ, and ϕ used as the Roe convention angles.

It is easy to visualize the coordinate rotations in this method. For example, the 2-D case can be reproduced by noting that the rotation is about the z-axis, so the vector is p=(0,0,1). This leads to

R=[cosαsinα0sinαcosα0001]
As with the Roe angles, it is possible to back-out p and α given a rotation matrix, R. The first step is to determine α. This is done by taking the trace of the matrix.

α=Cos1{12[tr(R)1]}
Once α is determined, the components of p are computed by

p1=R32R232sinαp2=R13R312sinαp3=R21R122sinα
The three equations can be conveniently summarized in tensor notation as

pi=ϵijkRjk2sinα
Note that p becomes undefined when α=0. This means, "the axis you rotate about doesn't matter if you don't rotate in the first place."

Backing Out P and α

Determine the single rotation, p and α, that is equivalent to that produced by the Roe angles used earlier: ψ=60,θ=30, and ϕ=45.

Recall that the Roe angles ψ=60,θ=30, and ϕ=45 lead to

R=[0.30620.91860.25000.88390.17680.43300.35360.35360.8660]
Solving for α gives

α=Cos1{12[0.30620.1768+0.86601]}=108
Solving for p gives

p1=0.35360.43302sin108=0.0417
p2=0.2500(0.3536)2sin108=0.3173
p3=0.8839(0.9186)2sin108=0.9475
So the Roe angles ψ=60,θ=30, and ϕ=45 are equivalent to a single rotation of 108 about the axis given by p=(0.0417, 0.3173, 0.9475). Both sets lead to the same rotation of an object.
The above example closes the loop on converting rotations from one system, Roe, to a second system, about an axis. In this case, and any other, the transformation matrix R is the go-between permitting the conversion. The procedure is always to calculate the R matrix in the first system and then back-out the angles in the second system from R.


Inverses and Transposes

All rotation matrices possess a rather remarkable property - their transpose is their inverse. So it becomes trivial to compute the inverse of such a matrix.

RT=R1soRTR=I

Dot Product Example

The above R matrix is

R=[0.30620.91860.25000.88390.17680.43300.35360.35360.8660]
Multiply it by its transpose to demonstrate that the result is the identity matrix and therefore, its transpose must also be its inverse.

RTR=[0.30620.88390.35360.91860.17680.35360.25000.43300.8660][0.30620.91860.25000.88390.17680.43300.35360.35360.8660]=[100010001]



Thank You

Thank you for visiting this webpage. Feel free to email me if you have questions.

Also, please consider visiting an advertiser above. Doing so helps to cover website hosting fees.

Bob McGinty
bmcginty@gmail.com


Entire Website - $12.95

For $12.95, you receive two formatted PDFs (the first for 8.5" x 11" pages, the second for tablets) of the entire website.

Click here to see a sample page in each of the two formats.

Email address to receive PDFs

Strain Chapter - $4.99

For $4.99, you receive two formatted PDFs (the first for 8.5" x 11" pages, the second for tablets) of the complete strain chapter.

Click here to see a sample page in each of the two formats.

Email address to receive PDFs



   Copyright © 2012 by Bob McGinty