# How to find Euler's angles?

I have read about Euler's angles and matrices, including $zxz,zyz$, etc . I am not obliged to use a specific rotation but rather I want to figure out what angles I need to use for alpha,theta, gamma in the specific matrix. For example, I have a vector from the centre with vertex $x,y,z$ of $(0,0,15)$, I want to rotate it to $(3,-12,15)$, what angles should I use or how can I obtain these angles ?

If let's say I choose $zyz$, I am finding difficulties finding the corresponding angles after the first $x-y$ plane rotation.

Please disregard the scaling factor and just consider the orientation.

Look forward to hearing from you

• Is it imperative that you use Euler angles, or is it ok with a method which gives you the composed rotation immediately? – Mårten W Feb 6 '13 at 13:51
• No it doesn't matter what I use. I am new to the area and Euler was the thing widely used. If there is an easier method then I am fully fine. Thank you.. – Louis Feb 6 '13 at 13:53
• Wow, the previous duplicate questions have some pretty terrible answers. – Rahul Feb 6 '13 at 16:57
• This is great, question though, the angle alpha would be in radians yes? I am using this formula to compute something in matlab. – Olivia Irving Mar 29 '13 at 2:05

In case it is the composed rotation matrix that is of interest, the method of Euler angles is not the easiest.

### Step 1: extract axis and angle

A rotation which turns $u=(0,0,15)$ in the direction of $v=(3,-12,15)$ is a rotation in the plane spanned by those vectors. This is the same as a rotation about the normal of this plane, which parallel to the cross product of the two vectors, so a normalised normal vector is $n=\frac{1}{17}(4,1,0)$.

The angle you want to rotate is the same as the angle $\alpha$ between $u$ and $v$, which can be extracted from the scalar product: $$\alpha=\arccos\left({\frac{u\cdot v}{|u|\,|v|}}\right).$$

### Step 2: construct your matrix

When you have the axis-angle representation, there are several ways to proceed to get your rotation matrix $R$. A simple one is to use the so called Rodrigues rotation formula, $$R=I+\sin{\alpha}\;[n]_\times+(1-\cos{\alpha})[n]_\times^2,$$ where $I$ is the identity matrix and $[n]_\times$ is the cross-product matrix associated with $n$, that is $$[n]_\times=\begin{bmatrix}0 & -n_3 & n_2 \\ n_3 & 0 & -n_1 \\ -n_2 & n_1 & 0\end{bmatrix}.$$ It is very important that $n$ is normalised.

Another elegant formula for $R$ uses the matrix exponential: $$R=e^{\alpha\left[n\right]_\times},$$ again with $[n]_\times$ as above.

A more elementary way would use the eigendecomposition.

• Many thanks, Marten. – Louis Feb 6 '13 at 15:55
• It's worth pointing out that the rotation that transforms $u$ to $v$ is not unique; for example, you can follow it by any rotation about $v$ (thus keeping $v$ fixed) and get another rotation that transforms $u$ to $v$. The one you have described is the "smallest" such rotation, though, which is almost always the one that is desired. – Rahul Feb 6 '13 at 16:55