Solution (source code)

= Solution

Applying the rightmost <rotation matrix> first gives
$$
R_1\mathbf e_z=(\sin\theta\cos\phi,\sin\theta\sin\phi,\cos\theta)^T.
$$
Equality with $\mathbf e_y$ requires $\cos\theta=0$, so $\theta=\pi/2$ in the specified range. Then $\sin\phi=1$ and $\cos\phi=0$ give
$$
\boxed{\theta=\frac\pi2,\qquad\phi=\frac\pi2.}
$$
In the reverse order, $R_z$ first fixes $\mathbf e_z$, so $R_2\mathbf e_z=R_y(\pi/2)\mathbf e_z=\mathbf e_x$. Therefore $\boxed{R_2\mathbf v\ne\mathbf v'}$. This explicitly demonstrates that <rotations> about different axes do not generally commute.