# Thread: Finding rotation matrix

1. ## Finding rotation matrix

Determine the matrix that represents the following rotation of $\displaystyle \mathbb{R}^{3}$: angle $\displaystyle \frac{2\pi}{3}$, axis contains the vector $\displaystyle (1,1,1)^{t}$.

I am pretty sure I have to use Euler's Theorem somehow, but I'm just drawing a blank on how to find this matrix. Any help would be appreciated.

2. Check this link out. You may not need everything in there, but it should get you started.

3. the way I (and perhaps no one else in the world!) would do this is to think of rotating (1, 1, 1) about the z axis to put it above the y-axis, then rotate about the x-axis to align it with the z-axis, rotate around the z-axis through the angle 2pi/3, the reverse the first to rotations.

That is, we want a matrix of the form
$\displaystyle \begin{bmatrix}c & -s & 0 \\ s & c & 0 \\ 0 & 0 & 1\end{bmatrix}$
where c and s are the cosine and sine of the unknown unknown angle, to get (0, r, 1) where $\displaystyle r= \sqrt{1+ 1}= \sqrt{2}$

That is
$\displaystyle \begin{bmatrix}c & -s & 0 \\ s & c & 0 \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}1 \\ 1 \\ 1 \end{bmatrix}= \begin{bmatrix}c- s & s+ c & 1\end{bmatrix}= \begin{bmatrix}0 \\ \sqrt{2} \\ 1\end{bmatrix}$
so we must have $\displaystyle c- s= 0$ and $\displaystyle s+ c= \sqrt{2}$ which gives $\displaystyle c= s= \frac{\sqrt{2}}{2}$

$\displaystyle R_1= \begin{bmatrix}\frac{\sqrt{2}}{2} & -\frac{\sqrt{2}}{2} & 0 \\ \frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} & 0 \\ 0 & 0 & 1\end{bmatrix}$

The second rotation, about the x-axis, must be a matrix of the form,
$\displaystyle \begin{bmatrix}1 & 0 & 0 \\0 & c & -s \\ 0 & s & c\end{bmatrix}$
where, again, c and s are the cosine and sine of the angle of rotation and must rotate $\displaystyle \begin{bmatrix}0 \\ \sqrt{2} \\ 1\end{bmatrix}$ into $\displaystyle \begin{bmatrix}0 \\ 0 \\ \sqrt{3}\end{bmatrix}$
since $\displaystyle \sqrt{3}$ is the length of the original vector.

That is, we must have
$\displaystyle \begin{bmatrix}1 & 0 & 0 \\ 0 & c & -s \\ 0 & s & c\end{bmatrix}\begin{bmatrix}0 \\ \sqrt{2} \\ 1\end{bmatrix}= \begin{bmatrix}0 \\ c\sqrt{2}- s \\ s\sqrt{2}+ c \end{bmatrix}\begin{bmatrix} 0 \\ 0 \\ \sqrt{3}\end{bmatrix}$

So we must have $\displaystyle c\sqrt{2}- s= 0$ and $\displaystyle s\sqrt{2}+ c= \sqrt{3}$. From the first equation, $\displaystyle s= c\sqrt{2}$ so the second becomes $\displaystyle 2c+ c= 3c= \sqrt{3}$. $\displaystyle c= \frac{\sqrt{3}}{3}$ and then $\displaystyle s= \frac{\sqrt{6}}{3}$.

That is, our second rotation matrix is
$\displaystyle R_2= \begin{bmatrix}1 & 0 & 0 \\ 0 & \frac{\sqrt{3}}{3} & -\frac{\sqrt{6}}{2} \\ 0 & \frac{\sqrt{6}}{3} & \frac{\sqrt{3}}{3}\end{bmatrix}$.

Of course, since $\displaystyle cos(2\pi/3)= -\frac{1}{2}$ and $\displaystyle sin(2\pi/3)= \frac{\sqrt{3}}{2}$, the rotation through that angle,around the z-axis, is given by
$\displaystyle R= \begin{bmatrix}-\frac{1}{2} & -\frac{\sqrt{3}}{2} & 0 \\ \frac{\sqrt{3}}{2} & -\frac{1}{2} & 0 \\ 0 & 0 & 1\end{bmatrix}$

And then, rotation of any vector, about axis <1, 1, 1>, through angle $\displaystyle 2\pi/3$ is given by
$\displaystyle R_1^{-1}R_2^{-1}RR_2R_1$

And those inverse matrices are easy- the inverse of rotating through a given angle around a given axis is rotating around that same axis through the negative angle. And that will just change the sign in the "s" in the above matrices.

Putting that all together, rotating a vector through an angle of $\displaystyle 2\pi/3$, about the axis <1, 1, 1,> can be accomplished by the matrix multiplication
$\displaystyle \begin{bmatrix}\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} & 0 \\ -\frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} & 0 \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}1 & 0 & 0 \\ 0 & \frac{\sqrt{3}}{3} & \frac{\sqrt{6}}{2} \\ 0 & -\frac{\sqrt{6}}{3} & \frac{\sqrt{3}}{3}\end{bmatrix}\begin{bmatrix}-\frac{1}{2} & -\frac{\sqrt{3}}{2} & 0 \\ \frac{\sqrt{3}}{2} & -\frac{1}{2} & 0 \\ 0 & 0 & 1\end{bmatrix}\begin{bmatrix}1 & 0 & 0 \\ 0 & \frac{\sqrt{3}}{3} & -\frac{\sqrt{6}}{2} \\ 0 & \frac{\sqrt{6}}{3} & \frac{\sqrt{3}}{3}\end{bmatrix}\begin{bmatrix}\fra c{\sqrt{2}}{2} & -\frac{\sqrt{2}}{2} & 0 \\ \frac{\sqrt{2}}{2} & \frac{\sqrt{2}}{2} & 0 \\ 0 & 0 & 1\end{bmatrix}$

That's rather complicated but I hope you can see how you can use those ideas to find the matrix corresponding to a rotation by any angle around any axis.

(So, I'm not the only one who does this! The link Ackbeet gives shows essentially the same thing.)

4. Thanks guys, that made things alot easier!

5. You're welcome for my (small) contribution.