The problem is essentially as follows:

In $\displaystyle \mathbb{R}^3$, a rotated coordinate system's axes are at angles $\displaystyle \phi_1$, $\displaystyle \phi_2$ and $\displaystyle \phi_3$ to the x-axis in standard Cartesian coordinates. Find the rotation matrix between the two coordinate systems.

I've tried to attack this both algebraically, using the 3 given direction cosines and orthonormality properties of the rotation matrix, as well as geometrically, trying to use trigonometric relationships between the two coordinate systems, but just can't seem to make it work. Algebraically it gets really messy really quickly and I can't solve for the unknowns and geometrically I can't work out enough useful relationships.

Any help would be much appreciated. Cheers!