Associated Topics || Dr. Math Home || Search Dr. Math

### Rotating Matrices

```
Date: Mon, 28 Aug 1995 13:17:04 -0700
From: Anonymous
Subject: Re: where is information on rotating matrices?

What if there's a spinning thing, and it has an axis,
and you have to line up the axis of the real thing with the math
of a model? Where's information on rotating matrices to do this???
```

```
Date: Mon, 28 Aug 1995 15:46:21 -0400 (EDT)
From: Dr. Ken
Subject: Re: where is information on rotating matrices?

Hello!

Well, I don't know where you can find other information for this, but I'd
imagine that computer programming books have very explicit ways to do this.
Rotation matrices are used all the time in visualization for exactly this
purpose.

The general method is this: first you make sure that the vector of your axis
of rotation has length 1.  If it doesn't, divide it by its length to make it
have length 1.  Call that vector v1.  Let's say it has components
(1,2,2)/Sqrt{9} = (1/3, 2/3, 2/3).  Then find an orthonormal basis for
3-space that has v1 as its first basis element: call the basis v1, v2, v3.
To find v2 and v3, we know they have to satisfy the equation x + 2y + 2z = 0,

Since they lie in the plane perpendicular to v1, we can make v2 satisfy
the equation and choose it to be (2,-1,0)/Sqrt{3} = (2/Sqrt{5}, -1/Sqrt{5},0)
and take the cross product of the two vectors to get the third:
v3 = (2/(3 Sqrt{5}), 4/(3 Sqrt{5}), -Sqrt{5}/3).  So now we have our
basis v1, v2, v3.

So now the rest is easy.  The matrix that rotates with angle t around v1 is

( 1    0        0    )
(                    )
R=( 0  Cos[t]  -Sin[t] )
(                    )
( 0  Sin[t]   Cos[t] ), with respect to the basis v1, v2, v3.  To change
bases, we multiply on each side by the change of basis matrix S, and its
inverse S^-1, to get S^-1 R S, which is the rotation matrix you want.  S is
just the matrix whose columns are v1, v2, and v3.  And since S is an
orthogonal matrix, the inverse of S is just the transpose of S.

In our example, we have the final answer:

1 + 8 Cos[t]   2 (1 - Cos[t] - 3 Sin[t])    2 (1 - Cos[t] + 3 Sin[t])
------------   -------------------------    -------------------------
9                    9                               9

2 (1 - Cos[t] + 3 Sin[t])   4 + 5 Cos[t]      4 - 4 Cos[t] - 3 Sin[t]
-------------------------   ------------      -----------------------
9                    9                       9

2 (1 - Cos[t] - 3 Sin[t])   4 - 4 Cos[t] + 3 Sin[t]      4 + 5 Cos[t]
-------------------------   -----------------------      ------------
9                          9                       9

That's a mouthful.

-K
```
Associated Topics:
High School Basic Algebra

Search the Dr. Math Library:

 Find items containing (put spaces between keywords):   Click only once for faster results: [ Choose "whole words" when searching for a word like age.] all keywords, in any order at least one, that exact phrase parts of words whole words

Submit your own question to Dr. Math
Math Forum Home || Math Library || Quick Reference || Math Forum Search