Transformation of $(x,y,z)$ to $(x',y',z')$ after spherical coordinate rotation If I have a a vector $\vec{v}=(x,y,z)$ in cartesian coordinates and I want to rotate my coordinate system by spherical angles $\theta$ and $\phi$ how would I find the resulting vector $\vec{v'}=(x',y',z')$ in cartesian coordinates?
This website seems to contain the answer under the "sum-of-matrices" header, but fails to give any sort of derivation as to how they arrived there.
If anyone can give any insight into how this was derived, that would be greatly appreciated.
 A: In the link you gave it gives the generic form of a rotation matrix of angle $\theta$ around an axis $r$. There are two alternative ways to arrive to that relation: i) composing rotation matrices, ii) constructing the rotated vector geometrically.
i) From: Siciliano, Sciavicco, Villani, Oriolo - Robotics, Modelling, Planning and Control, Sec.2.5:
"


*

*Align $r$ with $z$, which is obtained as the sequence of a rotation by $−\alpha$ about $z$ and a rotation by $−\beta$ about $y$.

*Rotate by $\theta$ about $z$.

*Realign with the initial direction of $r$, which is obtained as the sequence of a rotation by $\beta$ about $y$ and a rotation by $\alpha$ about $z$.


In sum, the resulting rotation matrix is $R(\theta,r) = R_z(\alpha)R_y(\beta)R_z(\theta)R_y(−\beta)R_z(−\alpha)$.
"
where $R_y(\beta) = \begin{bmatrix} \cos \beta & 0 & \sin \beta \\ 0 & 1 & 0 \\ -\sin \beta & 0 & \cos \beta\end{bmatrix}$ and $R_z(\alpha) = \begin{bmatrix} \cos \alpha & -\sin \alpha & 0 \\ \sin \alpha & \cos \alpha & 0 \\ 0 & 0 & 1  \end{bmatrix}$.
2) Is weel explained here https://en.wikipedia.org/wiki/Rodrigues%27_rotation_formula.
To help you directly with your specific example, you should say about which axes the rotations you want to do are, and in which order you want to perform them.
A: First express the axes of the rotated coordinate system in terms of the original one.  The rotation is equivalent to two consecutive rotations: rotation about the $z$ axis by an angle $\phi$ followed by a rotation about the $y'$ axis by $\theta$, hence the rotation matrix representing the final $(x',y',z')$ is
given by
$ R =  \begin{bmatrix} \cos \phi && -\sin \phi && 0 \\ \sin \phi && \cos \phi && 0 \\ 0 && 0 && 1 \end{bmatrix} \begin{bmatrix} \cos \theta && 0 && \sin \theta \\ 0 && 1 && 0 \\ -\sin \theta && 0 && \cos \theta \end{bmatrix} $
This evaluates to
$ R = \begin{bmatrix}\cos \theta \cos \phi && -\sin \phi && \sin \theta \cos \phi \\ \cos \theta \sin \phi && \cos \phi && \sin \theta \sin \phi \\ -\sin \theta && 0 && \cos \theta \end{bmatrix}$
The coordinates in this rotated frame of a vector $\vec{v} = (x,y,z)$ is the vector $\vec{u} = (x',y', z') $ given by
$ \vec{u} = (x',y', z') = R^T (x, y, z) $
That is,
$ \begin{bmatrix} x' \\ y' \\ z' \end{bmatrix} = \begin{bmatrix} \cos \theta \cos \phi && \cos \theta \sin \phi && - \sin \theta \\ - \sin \phi && \cos \phi && 0 \\ \sin \theta \cos \phi && \sin \theta \sin \phi && \cos \theta \end{bmatrix} \begin{bmatrix} x \\ y \\ z \end{bmatrix}$
