Rotation matrix about an arbitrary axis

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
2 replies · 3K views
Happiness
Messages
686
Reaction score
30
Suppose a position vector v is rotated anticlockwise at an angle ##\theta## about an arbitrary axis pointing in the direction of a position vector p, what is the rotation matrix R such that Rv gives the position vector after the rotation?

Suppose p = ##\begin{pmatrix}1\\1\\1\end{pmatrix}## and ##\theta## = -120##^\circ##.

My approach is as follows.

First, perform transformation ##T_1##: rotate the xy plane 45##^\circ## anticlockwise about the z axis. (I treat this as keeping v fixed but expressing v in terms of the new coordinate system CS1.)

Next, perform transformation ##T_2##: rotate the xz plane ##\tan^{-1}\frac{1}{\sqrt2}## clockwise about the y-axis (clockwise when the y-axis points into your eye) so that the x-axis is now pointing in the direction of p. (Again, I treat this as keeping v fixed but expressing v in terms of the new coordinate system CS2.)

Then, perform transformation ##T_3##: rotate the yz plane 120##^\circ## anticlockwise about the x axis, since rotating v by -120##^\circ## has the same effect as rotating the yz plane 120##^\circ## (turning the coordinate system about the rotation axis by 120##^\circ## while keeping v fixed).

We have ##T_1=\begin{pmatrix}\frac{1}{\sqrt2}&\frac{1}{\sqrt2}&0\\-\frac{1}{\sqrt2}&\frac{1}{\sqrt2}&0\\0&0&1\end{pmatrix}## , ##T_2=\begin{pmatrix}\frac{\sqrt2}{\sqrt3}&0&-\frac{1}{\sqrt3}\\0&1&0\\\frac{1}{\sqrt3}&0&\frac{\sqrt2}{\sqrt3}\end{pmatrix}## , ##T_3=\begin{pmatrix}1&0&0\\0&-\frac{1}{2}&\frac{\sqrt3}{2}\\0&-\frac{\sqrt3}{2}&-\frac{1}{2}\end{pmatrix}##

Next, perform the inverse of transformation ##T_2##. (Changing the expression of v from coordinate system CS2 back to CS1.)

Lastly, perform the inverse of transformation ##T_1##. (Changing the expression of v from coordinate system CS1 back to CS0, the original coordinate system.)

Thus, R = ##T_1^{-1}T_2^{-1}T_3T_2T_1 = \begin{pmatrix}0&0&-1\\1&0&0\\0&-1&0\end{pmatrix}##

But R should be ##\begin{pmatrix}0&1&0\\0&0&1\\1&0&0\end{pmatrix}## since rotating v about p by -120##^\circ## has the effect of turning the x-axis to the y axis, and the y-axis to the z axis, and the z axis to the x-axis (turning the coordinate system about the rotation axis p by 120##^\circ## while keeping v fixed).

Why do I get different answers? What's wrong with my approach?
 
Last edited:
on Phys.org
Thanks for reading! The mistake has been found. ##T_2##'s entries are wrong.
 
Here is how I would do this, in general, to find the matrix that rotates a vector through angle [itex]\theta[/itex] about axis <a, b, c>. (I will assume that <a, b, c> has length 1: [itex]\sqrt{a^2+ b^2+ c^2}= 1[/itex].)

First, find the matrix that rotates < a, b, c> into < 0, 0, 1>. To do that, first find the matrix, A, that rotates, around the z-axis, mapping <a, b c> to <0, r, c> where [itex]r= \sqrt{a^2+ b^2}[/itex]. I presume you know that, in two dimensions, the matrix rotating thorough angle [itex]\theta[/itex] is given by
[tex]\begin{bmatrix}cos(\theta) & - sin(\theta) \\ sin(\theta) & cos(\theta) \end{bmatrix}[/tex].

So we can write a rotating about the z-axis, as
[tex]\begin{bmatrix}\alpha & \ -beta & 0 \\ \beta & \alpha & 0 \\ 0 & 0 & 1\end{bmatrix}[/tex]
so that such a matrix mapping <a, b, c> to < 0, r, c> must give
[tex]\begin{bmatrix}\alpha & \ -beta & 0 \\ \beta & \alpha & 0 \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}a \\ b \\ c\end{bmatrix}= \begin{bmatrix}a\alpha- b\beta \\ a\beta+ b\alpha \\ c\end{bmatrix}= \begin{bmatrix} 0 // r // z\end{bmatrix}[/tex]
That gives the two equations [itex]a\alpha- b\beta= 0[/itex], [itex]a\beta+ b\alpha= r[/itex].

If we multiply the first of those equations by a, to get [itex]a^2\alpha- ab\beta= 0[/itex], multiply the second equation by b, to get [itex]b^2\alpha+ ab\beta= br[/itex], then add the two equations, we eliminate b getting [itex](a^2+ b^2)\alpha= br[/itex] so that [itex]\alpha= \frac{br}{a^2+ b^2}= \frac{b}{r}[/itex] since [itex]r= \sqrt{a^2+ b^2}[/itex]. Putting that into [itex]a^2\alpha- ab\beta= 0[/itex] we get [itex]ab\beta= a^2\alpha= \frac{a^2}{r}[/itex] so that [itex]\beta= \frac{a}{r}[/itex].

That is, this matrix is
[tex]A= \begin{bmatrix}\frac{b}{r} & -\frac{a}{r} & 0 \\ \frac{a}{r} & \frac{b}{r} & 0 \\ 0 & 0 & 1\end{bmatrix}[/tex].

Now we want to find the matrix, B, that rotates, around the x-axis, mapping < 0, r, c> to < 0, 0 , 1>. We can write that as
[tex]\begin{bmatrix}1 & 0 & 0 \\ 0 & \alpha & -beta \\ 0 & \beta & \alpha \end{bmatrix}\begin{bmatrix} 0 & r & c \end{bmatrix}= \begin{bmatrix} 0 \\ r\alpha- c\beta \\ r\beta+ c\alpha \end{bmatrix}= \begin{bmatrix} 0 \\ 0 \\ 1 \end{bmatrix}[/tex].

So we have the two equations [itex]r\alpha- c \beta= 0[/itex] and [itex]c\alpha+ r\beta= 1[/itex]. Multiply the first equation by r, to get [itex]r^2\alpha- rc\beta= 0[/itex], multiply the second equation by c to get [itex]c^2\alpha + rc\beta= c[/itex], then add, eliminating [itex]\beta[/itex] and getting [itex](r^2+ c^2)\alpha= c[/itex] so that [itex]\alpha= \frac{c}{r^2+ c^2}= c[/itex] since [itex]\sqrt{r ^2+ c^2}= \sqrt{a^2+ b^2+ c^2}= 1[/itex]. Putting that into [itex]r\alpha- c\beta= 0[/itex] we have [tex]\beta= \frac{r}{c}(c)= r[/tex].

That is, this is the matrix
[tex]B= \begin{bmatrix}1 & 0 & 0 \\ 0 & c & -r \\ 0 & r & 1\end {bmatrix}[/tex]

Now, to rotate a vector through angle [itex]\theta[/itex] about the vector <a, b, c>, multiply by A and B to rotate <a, b, c> into <0, 0, 1> then rotate through angle [itex]\theta[/itex] around the z-axis, then multiply by [itex]B^{-1}[/itex] and [itex]A^{-1}[/itex] to return to the original axis of rotation.
 
Last edited by a moderator: