# Expressing angle between two vectors in 3D in terms of spherical polar coordinates

I wanted to express angle between two 3D vectors pointing in arbitrary direction say $\vec{r}$ and $\vec{R}$. If I take the z axis along any other direction (other than the direction of $\vec{R}$ and $\vec{r}$). Both vectors will have polar coordinates. $$r,\theta,\phi$$ and $$R', \theta' , \phi'$$ respectively for both $\vec{r}$ and $\vec{R}$. Now how do I express the angle between the vectors in terms of theses polar angles. Can some one suggest some good references to understand better about these concepts ?

Using the dot product, the angle between $\vec{r}$ and $\vec{R}$ is
$\cos^{-1} \left( \frac{\vec{r}.\vec{R}}{|\vec{r}||\vec{R}|}\right) = \cos^{-1} \left( \frac{\vec{r}.\vec{R}}{rR'}\right)$
Calculting the dot product of $\vec{r}$ and $\vec{R}$ is simplest if you convert them to Cartesian co-ordinates first:
$\vec{r} = (r \sin \theta \cos \phi, r \sin \theta \sin \phi, r \cos \theta)$
$\vec{R} = (R' \sin \theta' \cos \phi', R' \sin \theta' \sin \phi', R' \cos \theta')$