• entries
146
435
• views
198845

# Derivations of Rotation Matrices for R

213 views

I thought it might be interesting to discuss how one can derive the standard rotation matrices in R3. For most people, hopefully, this is a review of knowledge that you should already have. For others it should help to expand your understanding of what these tools of yours do. The more one knows about the tools they use, the better they can apply those tools to problems. It should be noted that I'll probably use some terms that those who haven't had at least linear algebra will find unfamiliar. If so, please feel free to ask for clarification on those points. Assuming the clarification is something simple, I'll gladly provide the definition and an explanation. Note that I will only be dealing with counter-clockwise rotation matrices.

The dimensions of the standard rotation matrices for R3 are 3x3. That is, they have 3 rows and 3 columns. The reason for this is to allow for the multiplication of vectors from R3 with the rotation matrices to obtain their final orientation.
A simple example of this would be

The first matrix is the rotation matrix around the z-axis of q radians (or degrees, but I'll be using radians). The second matrix is the vector consisting of the components (x, y, z). This vector represents the point that we wish to rotate around the z-axis by ? radians. Finally this results in another vector consisting of (x', y', z'), which is the result of the rotation of the old vector around the z-axis. Shown in the following image:

Obviously this will not change the z component at all, thus z = z'. However it does change the x and y coordinates. But how did they come up with this matrix? The answer is quite simple actually. Assuming we have a linear transformation function, T, which takes in a vector, we'll be using v=(x, y, z), and spits out a new vector u=(x', y', z'), what would this function look like?

Applying what we know about radian coordinate systems (or in this case, cylindrical coordinate systems), we quickly remember that: x = rcos?, y = rsin?, and z = z. We can then say that given some vector v we can represent the components of it as: (rcosa, rsina, z). Knowing that we want to rotate that even further, we get that x = rcos(? + ?), y = rsin(? + ?), and z = z. Thus our function T should look something like:
T((x, y, z)) = (rcos(? + ?), rsin(? + ?), z)

Using our trigonometric angle addition identities, this becomes
T((x, y, z)) = (rcos? cos? - rsin? sin?, rcos? sin? + rcos? sin? , z)

Seems pretty simple, at least to me. Now the next step would be to convert this to a matrix equation. We can do this simply by pluging in the standard basis of R3 and using the resulting vectors as the columns of our matrix:
T((1, 0, 0)) = (cos0 cos? - sin0 sin?, cos0 sin? + cos? sin0, 0)
= (cos?, sin?, 0)
T((0, 1, 0)) = (cos(?/2) cos? - sin(?/2) sin?, cos(?/2) sin? + cos? sin(?/2), 0)
= (-sin?, cos?, 0)
T((0, 0, 1)) = (0, 0, 1)

Plugging these vectors into a matrix we get the same matrix as seen in the first equation. The derivation of the rotation matrices around the x-axis and y-axis are equally as simple. Obviously the only real knowledge required to derive these formulas is a basic knowledge of linear algebra (specifically how linear transformations work and how to represent them in a matrix form), and some knowledge of trigonometric identities.

Note that there is a more comprehensive derivation at http://members.gamedev.net/washu/derive.pdf

## 1 Comment

Heh, haven't seen that for ~3 years, nice refresher. Keep up the great journal.

## Create an account

Register a new account