[Math] Distance between 2 points in 3D space (in spherical polar coordinates)

calculusgeometry

In 3D Euclidean space, we know that distance between 2 points: $a=(x_1,y_1,z_1)$ and $b=(x_2,y_2,z_2)$ is $s^2=(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2)$from metric $ds^2=dx^2+dy^2+dz^2$. But I was thinking if we have the misfortune of working in spherical coordinates, i.e. only given $a=(r_1,\theta_1,\phi_1)$ and $b=(r_2,\theta_2,\phi_2)$, how can I work out $s^2$?

I suppose I need to do the integration $$\int_a^b (dr)^2+r^2(d\theta)^2+r^2\sin^2\theta(d\phi)^2$$which I tried and got $$\left(\int_a^b dr\right)^2+\left(\int_a^b rd\theta\right)^2+\left(\int_a^b r\sin\theta d\phi\right)^2=(r_2-r_1)^2+(r_2\theta_2-r_1\theta_1)^2+(r_2\sin\theta_2\phi_2-r_1\sin\theta_1\phi_1)^2$$

Is this correct??

Best Answer

Assuming that $\theta$ is the latitude and $\phi$ is the longitude we have that the cartesian coordinates of the first point are: $$ (r_1 \cos\theta_1 \cos\phi_1, r_1 \cos\theta_1 \sin\phi_1, r_1\sin\theta_1),$$ so the distance between the two points is given by: $$ \sqrt{r_1^2+r_2^2-2r_1r_2\left(\cos\theta_1\cos\theta_2\cos(\phi_1-\phi_2)+\sin\theta_1\sin\theta_2\right)}.$$

Related Question