# Calculating rotation matrix given new axes' angles w.r.t old axes

I'm having trouble with the following problem:

Rotated x’ axes are chosen making angles with the x axes as shown in the following table:

$$\begin{array}{ccc}&x'&y'&z'\\x&90^{\circ}&45^{\circ}&135^{\circ}\\y&45^{\circ}&60^{\circ}&60^{\circ}\\z&45^{\circ}&120^{\circ}&120^{\circ}\end{array}$$

Calculate the rotation matrix.

I am new to rotation matrices, but have been reading the wiki and Wolfram pages. From what I understand, if I can obtain the yaw, pitch, and roll angles from the old axes to produce the new axes, then I can easily obtain the rotation matrix. However, I do not understand how to use the provided angles in order to get the yaw, pitch, and roll.

Is this understanding correct? And if so, how can I get those 3 angles? Thanks.

Let $e_x=(1,0,0),\,e_y=(0,1,0)$ and $e_z=(0,0,1)$ be unit vectors pointing along the $x$, $y$ and $z$ axes. Let $R$ be the desired rotation matrix and $u_x=Re_x,\,u_y=Re_y,\,u_z=Re_z$. These are vectors pointing along the $x'$, $y'$ and $z'$ axes, and they are unit vectors since $R$ is a rotation. Each angle you are given gives information about a dot product between these vectors; for example $$e_x\cdot u_x=\cos 90^\circ=0$$ (since $e_x$ and $u_x$ are unit vectors). Note that $e_x\cdot u_x$ is also the first component of $u_x$. Using this you can determine the vectors $u_x,\,u_y$ and $u_z$. But these vectors are also the columns of $R$, so you can then put them side by side to construct $R$.