[Math] Distance between two points in spherical coordinates

spherical coordinatesspherical-geometry

I want to find the distance between two points in spherical coordinates, so I want to express $||x-x'||$ where $x=(r,\theta, \phi)$ and $x' = (r', \theta',\phi')$ by the respective components. Is this possible? I just know that this is $\sqrt{r^2+r'^2-2rr'\cos(\theta- \theta')}$ if $\phi,\phi'$ is the same, but what is the most general distance?

Best Answer

The expression of the distance between two vectors in spherical coordinates provided in the other response is usually expressed in a more compact form that is not only easier to remember but is also ideal for capitalizing on certain symmetries when solving problems.

$$\begin{align} \|\mathbf{r}-\mathbf{r}^\prime\| &=\sqrt{(x-x')^2+(y-y')^2+(z-z')^2}\\ &=\sqrt{r^2+r'^2-2rr'\left[\color{red}{\sin(\theta)\sin(\theta')}\color{blue}{\cos(\phi)\cos(\phi')}+\color{red}{\sin(\theta)\sin(\theta')}\color{blue}{\sin(\phi)\sin(\phi')}+\cos(\theta)\cos(\theta')\right]}\\ &=\sqrt{r^2+r'^2-2rr'\left[\color{red}{\sin(\theta)\sin(\theta')}\color{blue}{\left(\cos(\phi)\cos(\phi')+\sin(\phi)\sin(\phi')\right)}+\cos(\theta)\cos(\theta')\right]}\\ &=\sqrt{r^2+r'^2-2rr'\left[\color{red}{\sin(\theta)\sin(\theta')}\color{blue}{\cos(\phi-\phi')}+\cos(\theta)\cos(\theta')\right]}.\\ \end{align}$$

This form makes it fairly transparent how azimuthal symmetry allows you to automatically eliminate some of the angular dependencies in certain integration problems. Another advantage of this form is that you now have at least two variables, namely $\phi$ and $\phi'$, that appear in the equation only once, which can make finding series expansions w.r.t. these variables a little less of a pain than the others.