# Computing a rotation matrix given an angle

Problem:

Consider an axis $$\mathcal{A}$$ lying along the vector $$\begin{bmatrix} 0 \\1 \\ \sqrt{3} \end{bmatrix}$$. Rotating around the $$x$$-axis by an appropriate amount can allow one to place this axis on top of the $$z$$-axis. Use this fact to find the rotation matrix which will rotate by angle of $$\pi/3$$ around $$\mathcal{A}$$.

My attempt:

I calculated the unit vector by dividing by the vector norm, and then computed the arccosine of $$y$$ to get an angle $$\theta = 60$$. I don't really know if this is helpful, but I drew a picture, and I found that the angle between the line and the $$y$$-axis is $$\pi/2 - \theta$$, where $$\theta$$ is the degree in radians. This gives me $$\pi/6$$. I don't really know what to do next, or even if I'm doing the right thing.

• You might first consider how to write the rotation matrix so that the given vector aligns with the $z$-axis. From there, you can find a matrix to rotate about $z$-axis. Lastly, you'll need a matrix to invert the initial rotation. For each matrix there is a formula but in general you should think about how each operation acts on the three standard basis vectors – Casey Sep 24 '18 at 5:16
• Does your new axis remain on the $yy' ,zz'$ plane? – dmtri Sep 24 '18 at 5:25
• yes, it should @dmtri – user400359 Sep 24 '18 at 5:25
• @Casey Could you check what I have updated my post with, please? – user400359 Sep 24 '18 at 5:49
• Never mind, I removed it because it was wrong. – user400359 Sep 24 '18 at 6:05

Okay how this might work is the following:

There is a general formula for that but I will try to derive it here:

The key is a change of the basis.

First. Find a Basis with the given vector being "equal" to the x axis. e.g.;

$$v1 = \begin{bmatrix} 0 \\1 \\ \sqrt{3} \end{bmatrix}$$ $$v2 = \begin{bmatrix} 1 \\0 \\ 0 \end{bmatrix}$$ $$v3 = \begin{bmatrix} 0 \\\sqrt3 \\ -1 \end{bmatrix}$$

Normalize these and write them into the matrix A:

$$A=\begin{bmatrix} 0 & 1 & 0\\ 1/2 & 0 & \sqrt3 /2\\ \sqrt3 /2 & 0 & -1/2 \end{bmatrix}$$

Now the idea is to compute the matrix:

$$M = A^{-1}RA$$ with R being the rotation matrix around the x-axis. $$A^{-1}$$ is the inverse of A.

The idea is that you have given any vector in the given space. With the matrix A, you can transform it into default space. Then you rotate it and then you transform it back into the given vector-space by using $$A^{-1}$$ Note: I am not 100% sure if it is $$ARA^{-1}$$ or $$A^{-1}RA$$

• I've learned this last year in the uni. Can't guarantee the correctness :) – Finn Eggers Sep 24 '18 at 12:18

The angle between the given vector $$v$$ and the $$y$$-axis is $$\pi/3$$. The angle between $$v$$ and the $$z$$-axis is $$\pi/6$$.

Find a matrix $$M$$ that rotates vectors around the $$x$$-axis by $$\pi/6$$ in the positive direction. Now $$v$$ lines up with the $$z$$-axis.

Then find a matrix $$R$$ that rotates around the $$z$$-axis by $$\pi/3$$.

If we want to rotate some arbitrary vector $$w$$ around $$v$$ by $$\pi/3$$, rotate it by $$M$$, so that $$v$$ aligns with the $$z$$-axis. Then we rotate it by $$R$$. Then we rotate the resulting vector back, by $$M^{-1}$$.

So you sought matrix is given by $$M^{-1}RM$$. There are formulas for these matrices available more or less everywhere.