Yes! It is possible to derive formulae for both the two-dimensional and three-dimensional cases in polar coordinates. The following are the formulae:
2-D Polar Coordinates : #\vec{r_A}=(r_A,\theta_A); \qquad \vec{r}_B=(r_B, \theta_B)#
#S=\sqrt{|\vec{r}_B-\vec{r}_A|^2} = \sqrt{r_A^2+r_B^2-2r_Ar_B\cos(\theta_B-\theta_A)}#
3-D Spherical Polar Coordinates :
#\vec{r_A}=(r_A,\theta_A,\phi_A); \qquad
\vec{r}_B=(r_B, \theta_B, \phi_B)#
#S=\sqrt{|\vec{r}_B-\vec{r}_A|^2}#
#= \sqrt{r_A^2+r_B^2-2r_Ar_B[\sin\theta_A\sin\theta_B\cos(\phi_B-\phi_A)+\cos\theta_A\cos\theta_B]}#
Deriving these formulae requires writing the position vectors in their cartesian forms and apply the Pythagorous Theorem to find the distance between two points in space. The following trigonometric identities might be useful for this problem :
- #\cos(A-B)=\cos(A)\cos(B)+\sin(A)\sin(B)#
- #\sin^2A+\cos^2A=1#
Derivation of 2-D Formula :
#\vec{r}_A=(r_A, \theta_A) = (X_A, Y_A); \qquad \vec{r}_B=(r_B, \theta_B) = (X_B, Y_B);#
#X_A=r_A\cos\theta_A, \quad Y_A=r_A\sin\theta_A; #
#X_B=r_B\cos\theta_B, \quad Y_B=r_B\sin\theta_B; #
The distance between the two points is:
#S=\sqrt{|\vec{r}_B-\vec{r}_A|^2} = \sqrt{(X_B-X_A)^2+(Y_B-Y_A)^2}#
#S=\sqrt{(r_B\cos\theta_B-r_A\cos\theta_A)^2+(r_B\sin\theta_B-r_A\sin\theta_A)^2}#
Upon expanding the squares and further simplification,
#S=\sqrt{r_A^2(\cos^2\theta_A+\sin^2\theta_A)+r_B^2(\cos^2\theta_B+\sin^2\theta_B)-2r_Ar_B(\cos\theta_A\cos\theta_B+\sin\theta_A\sin\theta_B)}#
#S=\sqrt{r_A^2+r_B^2-2r_Ar_B\cos(\theta_B-\theta_A)}#
Derivation of 3-D Formula :
#\vec{r}_A=(r_A, \theta_A,\phi_A) = (X_A, Y_A,Z_A); #
#\vec{r}_B=(r_B, \theta_B,\phi_B) = (X_B, Y_B,Z_B);#
#X_A=r_A\sin\theta_A\cos\phi_A, \quad Y_A=r_A\sin\theta_A\sin\phi_A; Z_A=r_A\cos\theta_A#
#X_B=r_B\sin\theta_B\cos\phi_B, \quad Y_B=r_B\sin\theta_B\sin\phi_B; Z_B=r_B\cos\theta_B#
The distance between the two points is:
#S=\sqrt{|\vec{r}_B-\vec{r}_A|^2} = \sqrt{(X_B-X_A)^2+(Y_B-Y_A)^2+(Z_B-Z_A)^2}#
- #(X_B-X_A)^2 =(r_B\sin\theta_B\cos\phi_B-r_A\sin\theta_A\cos\phi_A)^2#
- #(Y_B-Y_A)^2 =(r_B\sin\theta_B\sin\phi_B-r_A\sin\theta_A\sin\phi_A)^2#
- #(Z_B-Z_A)^2=(r_B\cos\theta_B-r_A\cos\theta_A)^2#
Upon expanding the squares and further simplification,
#S=\sqrt{r_A^2(\cos^2\theta_A+\sin^2\theta_A)+r_B^2(\cos^2\theta_B+\sin^2\theta_B)-2r_Ar_B[\sin\theta_A\sin\theta_B (\cos\phi_A\cos\phi_B+\sin\phi_A\sin\phi_B)+\cos\theta_A\cos\theta_B]}#
#=\sqrt{r_A^2+r_B^2-2r_Ar_B[\sin\theta_A\sin\theta_B \cos(\phi_B-\phi_A)+\cos\theta_A\cos\theta_B]}#