I have a point $P_0 = [x_0, y_0, z_0]'$. I want to rotate the axes so that the new coordinates will be $P_1 = [x_1, y_1, z_1]'$. Define the following rotation matrices:
$R_x = \left[\matrix{ 1 & 0 & 0\\ 0 & \cos\alpha & - \sin\alpha\\ 0 & \sin\alpha & \cos\alpha} \right]$, $R_y = \left[\matrix{ \cos\beta & 0 & \sin\beta\\ 0 & 1 & 0\\ -\sin\beta & 0 & \cos\beta} \right]$, $R_z = \left[\matrix{ \cos\gamma & -\sin\gamma & 0\\ \sin\gamma & \cos\gamma & 0\\ 0 & 0 & 1} \right]$ and $R_{xyz} = R_x R_y R_z$.
I want $P_1 = R_{xyz} P_0$ and $\left[\alpha, \beta, \gamma\right]$ be such that $\alpha, \beta, \gamma = 0$ if $P_1 = P_0$; $\alpha, \beta = 0$ if the rotation can be obtained by setting only $\gamma$; $\alpha = 0$ if the rotation can be obtained by setting only $\beta$ and $\gamma$. Any hint?
EDIT: Following JordiC's answer: yes, the distance to the origin is the same for $P_0$ and $P_1$; I can set $\alpha = 0$ and the rotation matrix will be simplified:
$R = \left[\matrix{ \cos\beta \cos\gamma & -\cos\beta \sin\gamma & \sin\beta\\ \sin\gamma & \cos\gamma & 0\\ -\cos\gamma \sin\beta & \sin\beta \sin\gamma & \cos\beta} \right]$.
I have found this: Find rotation that maps a point to its target which seems to be the same question.
If you use only rotations to convert the coordinates from P0 to P1, you will need only 2 rotations for the conversion. Also the distance to the origin of P0 and P1 must be the same. In this case you can always consider that:
α = 0.
So you have only to think in β and γ.
And β will be always 0 if z0 = z1.