Categories: Mathematics, Physics.

Spherical coordinates

Spherical coordinates are an extension of polar coordinates (r,φ)(r, \varphi) to 3D. The position of a given point in space is described by three variables (r,θ,φ)(r, \theta, \varphi), defined as:

Note that this is the standard notation among physicists, but mathematicians often switch the definitions of θ\theta and φ\varphi, while still writing (r,θ,φ)(r, \theta, \varphi).

Cartesian coordinates (x,y,z)(x, y, z) and the spherical system (r,θ,φ)(r, \theta, \varphi) are related by:

x=rsinθcosφy=rsinθsinφz=rcosθ\begin{aligned} \boxed{ \begin{aligned} x &= r \sin\theta \cos\varphi \\ y &= r \sin\theta \sin\varphi \\ z &= r \cos\theta \end{aligned} } \end{aligned}

Conversely, a point given in (x,y,z)(x, y, z) can be converted to (r,θ,φ)(r, \theta, \varphi) using these formulae, where atan2\mathtt{atan2} is the 2-argument arctangent, which is needed to handle the signs correctly:

r=x2+y2+z2θ=arccos(z/r)φ=atan2(y,x)\begin{aligned} \boxed{ \begin{aligned} r &= \sqrt{x^2 + y^2 + z^2} \\ \theta &= \arccos(z / r) \\ \varphi &= \mathtt{atan2}(y, x) \end{aligned} } \end{aligned}

Spherical coordinates form an orthogonal curvilinear system, whose scale factors hrh_r, hθh_\theta and hφh_\varphi we need. To get those, we calculate the unnormalized local basis:

hre^r=e^xxr+e^yyr+e^zzr=e^xsinθcosφ+e^ysinθsinφ+e^zcosθhθe^θ=e^xxθ+e^yyθ+e^zzθ=e^xrcosθcosφ+e^yrcosθsinφe^zrsinθhφe^φ=e^xxφ+e^yyφ+e^zzφ=e^xrsinθsinφ+e^yrsinθcosφ\begin{aligned} h_r \vu{e}_r &= \vu{e}_x \pdv{x}{r} + \vu{e}_y \pdv{y}{r} + \vu{e}_z \pdv{z}{r} \\ &= \vu{e}_x \sin{\theta} \cos{\varphi} + \vu{e}_y \sin{\theta} \sin{\varphi} + \vu{e}_z \cos{\theta} \\ h_\theta \vu{e}_\theta &= \vu{e}_x \pdv{x}{\theta} + \vu{e}_y \pdv{y}{\theta} + \vu{e}_z \pdv{z}{\theta} \\ &= \vu{e}_x \: r \cos{\theta} \cos{\varphi} + \vu{e}_y \: r \cos{\theta} \sin{\varphi} - \vu{e}_z \: r \sin{\theta} \\ h_\varphi \vu{e}_\varphi &= \vu{e}_x \pdv{x}{\varphi} + \vu{e}_y \pdv{y}{\varphi} + \vu{e}_z \pdv{z}{\varphi} \\ &= - \vu{e}_x \: r \sin{\theta} \sin{\varphi} + \vu{e}_y \: r \sin{\theta} \cos{\varphi} \end{aligned}

By normalizing the local basis vectors e^r\vu{e}_r, e^θ\vu{e}_\theta and e^φ\vu{e}_\varphi, we arrive at these expressions:

hr=1hθ=rhφ=rsinθe^r=e^xsinθcosφ+e^ysinθsinφ+e^zcosθe^θ=e^xcosθcosφ+e^ycosθsinφe^zsinθe^φ=e^xsinφ+e^ycosφ\begin{aligned} \boxed{ \begin{aligned} h_r &= 1 \\ h_\theta &= r \\ h_\varphi &= r \sin{\theta} \end{aligned} } \qquad\qquad \boxed{ \begin{aligned} \vu{e}_r &= \vu{e}_x \sin{\theta} \cos{\varphi} + \vu{e}_y \sin{\theta} \sin{\varphi} + \vu{e}_z \cos{\theta} \\ \vu{e}_\theta &= \vu{e}_x \cos{\theta} \cos{\varphi} + \vu{e}_y \cos{\theta} \sin{\varphi} - \vu{e}_z \sin{\theta} \\ \vu{e}_\varphi &= - \vu{e}_x \sin{\varphi} + \vu{e}_y \cos{\varphi} \end{aligned} } \end{aligned}

Thanks to these scale factors, we can easily convert calculus from the Cartesian system using the standard formulae for orthogonal curvilinear coordinates.

Differential elements

For line integrals, the tangent vector element d\dd{\vb{\ell}} for a curve is as follows:

d=e^rdr+e^θrdθ+e^φrsinθdφ\begin{aligned} \boxed{ \dd{\vb{\ell}} = \vu{e}_r \dd{r} + \: \vu{e}_\theta \: r \dd{\theta} + \: \vu{e}_\varphi \: r \sin{\theta} \dd{\varphi} } \end{aligned}

For surface integrals, the normal vector element dS\dd{\vb{S}} for a surface is given by:

dS=e^rr2sinθdθdφ+e^θrsinθdrdφ+e^φrdrdθ\begin{aligned} \boxed{ \dd{\vb{S}} = \vu{e}_r \: r^2 \sin{\theta} \dd{\theta} \dd{\varphi} + \: \vu{e}_\theta \: r \sin{\theta} \dd{r} \dd{\varphi} + \: \vu{e}_\varphi \: r \dd{r} \dd{\theta} } \end{aligned}

And for volume integrals, the infinitesimal volume dV\dd{V} takes the following form:

dV=r2sinθdrdθdφ\begin{aligned} \boxed{ \dd{V} = r^2 \sin{\theta} \dd{r} \dd{\theta} \dd{\varphi} } \end{aligned}

Common operations

The basic vector operations (gradient, divergence, curl and Laplacian) are given by:

f=e^rfr+e^θ1rfθ+eφ1rsinθfφ\begin{aligned} \boxed{ \nabla f = \vu{e}_r \pdv{f}{r} + \vu{e}_\theta \frac{1}{r} \pdv{f}{\theta} + \mathbf{e}_\varphi \frac{1}{r \sin{\theta}} \pdv{f}{\varphi} } \end{aligned} V=Vrr+2Vrr+1rVθθ+Vθrtanθ+1rsinθVφφ\begin{aligned} \boxed{ \nabla \cdot \vb{V} = \pdv{V_r}{r} + \frac{2 V_r}{r} + \frac{1}{r} \pdv{V_\theta}{\theta} + \frac{V_\theta}{r \tan{\theta}} + \frac{1}{r \sin\theta} \pdv{V_\varphi}{\varphi} } \end{aligned} ×V=e^r(1rVφθ+Vφrtanθ1rsinθVθφ)+e^θ(1rsinθVrφVφrVφr)+e^φ(Vθr+Vθr1rVrθ)\begin{aligned} \boxed{ \begin{aligned} \nabla \times \vb{V} &= \quad \vu{e}_r \bigg( \frac{1}{r} \pdv{V_\varphi}{\theta} + \frac{V_\varphi}{r \tan{\theta}} - \frac{1}{r \sin{\theta}} \pdv{V_\theta}{\varphi} \bigg) \\ &\quad\: + \vu{e}_\theta \bigg( \frac{1}{r \sin{\theta}} \pdv{V_r}{\varphi} - \pdv{V_\varphi}{r} - \frac{V_\varphi}{r} \bigg) \\ &\quad\: + \vu{e}_\varphi \bigg( \pdv{V_\theta}{r} + \frac{V_\theta}{r} - \frac{1}{r} \pdv{V_r}{\theta} \bigg) \end{aligned} } \end{aligned} 2f=2fr2+2rfr+1r22fθ2+1r2tanθfθ+1r2sin2θ2fφ2\begin{aligned} \boxed{ \nabla^2 f = \pdvn{2}{f}{r} + \frac{2}{r} \pdv{f}{r} + \frac{1}{r^2} \pdvn{2}{f}{\theta} + \frac{1}{r^2 \tan{\theta}} \pdv{f}{\theta} + \frac{1}{r^2 \sin^2{\theta}} \pdvn{2}{f}{\varphi} } \end{aligned}

Uncommon operations

Uncommon operations include: the gradient of a divergence (V)\nabla (\nabla \cdot \vb{V}), the gradient of a vector V\nabla \vb{V}, the advection of a vector (U)V(\vb{U} \cdot \nabla) \vb{V} with respect to U\vb{U}, the Laplacian of a vector 2V\nabla^2 \vb{V}, and the divergence of a 2nd-order tensor T\nabla \cdot \overline{\overline{\vb{T}}}:

(V)=e^r(2Vrr2+1r2Vθrθ+1rsinθ2Vφφr+2rVrr1r2Vθθ1r2sinθVφφ+1rtanθVθr2Vrr2Vθr2tanθ)+e^θ(1r2Vrθr+1r22Vθθ2+1r2sinθ2Vφθφ+2r2Vrθ+1r2tanθVθθcosθr2sin2θVφφVθr2sin2θ)+e^φ(1rsinθ2Vrφr+1r2sinθ2Vθφθ+1r2sin2θ2Vφφ2+2r2sinθVrφ+cosθr2sin2θVθφ)\begin{aligned} \boxed{ \begin{aligned} \nabla (\nabla \cdot \vb{V}) &= \quad \vu{e}_r \bigg( \pdvn{2}{V_r}{r} + \frac{1}{r} \mpdv{V_\theta}{r}{\theta} + \frac{1}{r \sin{\theta}} \mpdv{V_\varphi}{\varphi}{r} \\ &\qquad\qquad + \frac{2}{r} \pdv{V_r}{r} - \frac{1}{r^2} \pdv{V_\theta}{\theta} - \frac{1}{r^2 \sin{\theta}} \pdv{V_\varphi}{\varphi} + \frac{1}{r \tan{\theta}} \pdv{V_\theta}{r} - \frac{2 V_r}{r^2} - \frac{V_\theta}{r^2 \tan{\theta}} \bigg) \\ &\quad\: + \vu{e}_\theta \bigg( \frac{1}{r} \mpdv{V_r}{\theta}{r} + \frac{1}{r^2} \pdvn{2}{V_\theta}{\theta} + \frac{1}{r^2 \sin{\theta}} \mpdv{V_\varphi}{\theta}{\varphi} \\ &\qquad\qquad + \frac{2}{r^2} \pdv{V_r}{\theta} + \frac{1}{r^2 \tan{\theta}} \pdv{V_\theta}{\theta} - \frac{\cos{\theta}}{r^2 \sin^2{\theta}} \pdv{V_\varphi}{\varphi} - \frac{V_\theta}{r^2 \sin^2{\theta}} \bigg) \\ &\quad\: + \vu{e}_\varphi \bigg( \frac{1}{r \sin{\theta}} \mpdv{V_r}{\varphi}{r} + \frac{1}{r^2 \sin{\theta}} \mpdv{V_\theta}{\varphi}{\theta} + \frac{1}{r^2 \sin^2{\theta}} \pdvn{2}{V_\varphi}{\varphi} \\ &\qquad\qquad + \frac{2}{r^2 \sin{\theta}} \pdv{V_r}{\varphi} + \frac{\cos{\theta}}{r^2 \sin^2{\theta}} \pdv{V_\theta}{\varphi} \bigg) \end{aligned} } \end{aligned} V=e^re^rVrr+e^re^θVθr+e^re^φVφr+e^θe^r(1rVrθVθr)+e^θe^θ(1rVθθ+Vrr)+e^θe^φ1rVφθ+e^φe^r(1rsinθVrφVφr)+e^φe^θ(1rsinθVθφVφrtanθ)+e^φe^φ(1rsinθVφφ+Vrr+Vθrtanθ)\begin{aligned} \boxed{ \begin{aligned} \nabla \vb{V} &= \quad \vu{e}_r \vu{e}_r \pdv{V_r}{r} + \vu{e}_r \vu{e}_\theta \pdv{V_\theta}{r} + \vu{e}_r \vu{e}_\varphi \pdv{V_\varphi}{r} \\ &\quad\: + \vu{e}_\theta \vu{e}_r \bigg( \frac{1}{r} \pdv{V_r}{\theta} - \frac{V_\theta}{r} \bigg) + \vu{e}_\theta \vu{e}_\theta \bigg( \frac{1}{r} \pdv{V_\theta}{\theta} + \frac{V_r}{r} \bigg) + \vu{e}_\theta \vu{e}_\varphi \frac{1}{r} \pdv{V_\varphi}{\theta} \\ &\quad\: + \vu{e}_\varphi \vu{e}_r \bigg( \frac{1}{r \sin{\theta}} \pdv{V_r}{\varphi} - \frac{V_\varphi}{r} \bigg) + \vu{e}_\varphi \vu{e}_\theta \bigg( \frac{1}{r \sin{\theta}} \pdv{V_\theta}{\varphi} - \frac{V_\varphi}{r \tan{\theta}} \bigg) \\ &\quad\: + \vu{e}_\varphi \vu{e}_\varphi \bigg( \frac{1}{r \sin{\theta}} \pdv{V_\varphi}{\varphi} + \frac{V_r}{r} + \frac{V_\theta}{r \tan{\theta}} \bigg) \end{aligned} } \end{aligned} (U)V=e^r(UrVrr+UθrVrθ+UφrsinθVrφUθVθrUφVφr)+e^θ(UrVθr+UθrVθθ+UφrsinθVθφ+UθVrrUφVφrtanθ)+e^φ(UrVφr+UθrVφθ+UφrsinθVφφ+UφVrr+UφVθrtanθ)\begin{aligned} \boxed{ \begin{aligned} (\vb{U} \cdot \nabla) \vb{V} &= \quad \vu{e}_r \bigg( U_r \pdv{V_r}{r} + \frac{U_\theta}{r} \pdv{V_r}{\theta} + \frac{U_\varphi}{r \sin{\theta}} \pdv{V_r}{\varphi} - \frac{U_\theta V_\theta}{r} - \frac{U_\varphi V_\varphi}{r} \bigg) \\ &\quad\: + \vu{e}_\theta \bigg( U_r \pdv{V_\theta}{r} + \frac{U_\theta}{r} \pdv{V_\theta}{\theta} + \frac{U_\varphi}{r \sin{\theta}} \pdv{V_\theta}{\varphi} + \frac{U_\theta V_r}{r} - \frac{U_\varphi V_\varphi}{r \tan{\theta}} \bigg) \\ &\quad\: + \vu{e}_\varphi \bigg( U_r \pdv{V_\varphi}{r} + \frac{U_\theta}{r} \pdv{V_\varphi}{\theta} + \frac{U_\varphi}{r \sin{\theta}} \pdv{V_\varphi}{\varphi} + \frac{U_\varphi V_r}{r} + \frac{U_\varphi V_\theta}{r \tan{\theta}} \bigg) \end{aligned} } \end{aligned} 2V=e^r(2Vrr2+1r22Vrθ2+1r2sin2θ2Vrφ2+2rVrr+1r2tanθVrθ2r2Vθθ2r2sinθVφφ2Vrr22Vθr2tanθ)+e^θ(2Vθr2+1r22Vθθ2+1r2sin2θ2Vθφ2+2r2Vrθ+2rVθr+1r2tanθVθθ2cosθr2sin2θVφφVθr2sin2θ)+e^φ(2Vφr2+1r22Vφθ2+1r2sin2θ2Vφφ2+2r2sinθVrφ+2cosθr2sin2θVθφ+2rVφr+1r2tanθVφθVφr2sin2θ)\begin{aligned} \boxed{ \begin{aligned} \nabla^2 \vb{V} &= \quad\: \vu{e}_r \bigg( \pdvn{2}{V_r}{r} + \frac{1}{r^2} \pdvn{2}{V_r}{\theta} + \frac{1}{r^2 \sin^2{\theta}} \pdvn{2}{V_r}{\varphi} \\ &\qquad\qquad + \frac{2}{r} \pdv{V_r}{r} + \frac{1}{r^2 \tan{\theta}} \pdv{V_r}{\theta} - \frac{2}{r^2} \pdv{V_\theta}{\theta} - \frac{2}{r^2 \sin{\theta}} \pdv{V_\varphi}{\varphi} - \frac{2 V_r}{r^2} - \frac{2 V_\theta}{r^2 \tan{\theta}} \bigg) \\ &\quad\: + \vu{e}_\theta \bigg( \pdvn{2}{V_\theta}{r} + \frac{1}{r^2} \pdvn{2}{V_\theta}{\theta} + \frac{1}{r^2 \sin^2{\theta}} \pdvn{2}{V_\theta}{\varphi} \\ &\qquad\qquad + \frac{2}{r^2} \pdv{V_r}{\theta} + \frac{2}{r} \pdv{V_\theta}{r} + \frac{1}{r^2 \tan{\theta}} \pdv{V_\theta}{\theta} - \frac{2 \cos{\theta}}{r^2 \sin^2{\theta}} \pdv{V_\varphi}{\varphi} - \frac{V_\theta}{r^2 \sin^2{\theta}} \bigg) \\ &\quad\: + \vu{e}_\varphi \bigg( \pdvn{2}{V_\varphi}{r} + \frac{1}{r^2} \pdvn{2}{V_\varphi}{\theta} + \frac{1}{r^2 \sin^2{\theta}} \pdvn{2}{V_\varphi}{\varphi} \\ &\qquad\qquad + \frac{2}{r^2 \sin{\theta}} \pdv{V_r}{\varphi} + \frac{2 \cos{\theta}}{r^2 \sin^2{\theta}} \pdv{V_\theta}{\varphi} + \frac{2}{r} \pdv{V_\varphi}{r} + \frac{1}{r^2 \tan{\theta}} \pdv{V_\varphi}{\theta} - \frac{V_\varphi}{r^2 \sin^2{\theta}} \bigg) \end{aligned} } \end{aligned} T=e^r(Trrr+1rTθrθ+1rsinθTφrφ+2Trrr+TθrrtanθTθθrTφφr)+e^θ(Trθr+1rTθθθ+1rsinθTφθφ+2Trθr+Tθrr+TθθrtanθTφφrtanθ)+e^φ(Trφr+1rTθφθ+1rsinθTφφφ+2Trφr+Tθφrtanθ+Tφrr+Tφθrtanθ)\begin{aligned} \boxed{ \begin{aligned} \nabla \cdot \overline{\overline{\mathbf{T}}} &= \quad \vu{e}_r \bigg( \pdv{T_{rr}}{r} + \frac{1}{r} \pdv{T_{\theta r}}{\theta} + \frac{1}{r \sin{\theta}} \pdv{T_{\varphi r}}{\varphi} \\ &\qquad\qquad + \frac{2 T_{rr}}{r} + \frac{T_{\theta r}}{r \tan{\theta}} - \frac{T_{\theta \theta}}{r} - \frac{T_{\varphi \varphi}}{r} \bigg) \\ &\quad\: + \vu{e}_\theta \bigg(\pdv{T_{r \theta}}{r} + \frac{1}{r} \pdv{T_{\theta \theta}}{\theta} + \frac{1}{r \sin{\theta}} \pdv{T_{\varphi \theta}}{\varphi} \\ &\qquad\qquad + \frac{2 T_{r \theta}}{r} + \frac{T_{\theta r}}{r} + \frac{T_{\theta \theta}}{r \tan{\theta}} - \frac{T_{\varphi \varphi}}{r \tan{\theta}} \bigg) \\ &\quad\: + \vu{e}_\varphi \bigg( \pdv{T_{r \varphi}}{r} + \frac{1}{r} \pdv{T_{\theta \varphi}}{\theta} + \frac{1}{r \sin{\theta}} \pdv{T_{\varphi \varphi}}{\varphi} \\ &\qquad\qquad + \frac{2 T_{r \varphi}}{r} + \frac{T_{\theta \varphi}}{r \tan{\theta}} + \frac{T_{\varphi r}}{r} + \frac{T_{\varphi \theta}}{r \tan{\theta}} \bigg) \end{aligned} } \end{aligned}

References

  1. M.L. Boas, Mathematical methods in the physical sciences, 2nd edition, Wiley.
  2. B. Lautrup, Physics of continuous matter: exotic and everyday phenomena in the macroscopic world, 2nd edition, CRC Press.