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^x∂x∂r+e^y∂y∂r+e^z∂z∂r=e^xsin⁡θcos⁡φ+e^ysin⁡θsin⁡φ+e^zcos⁡θhθe^θ=e^x∂x∂θ+e^y∂y∂θ+e^z∂z∂θ=e^x rcos⁡θcos⁡φ+e^y rcos⁡θsin⁡φ−e^z rsin⁡θhφe^φ=e^x∂x∂φ+e^y∂y∂φ+e^z∂z∂φ=−e^x rsin⁡θsin⁡φ+e^y rsin⁡θ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^r r2sin⁡θ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^r∂f∂r+e^θ1r∂f∂θ+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=∂Vr∂r+2Vrr+1r∂Vθ∂θ+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(1r∂Vφ∂θ+Vφrtan⁡θ−1rsin⁡θ∂Vθ∂φ) +e^θ(1rsin⁡θ∂Vr∂φ−∂Vφ∂r−Vφr) +e^φ(∂Vθ∂r+Vθr−1r∂Vr∂θ)\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=∂2f∂r2+2r∂f∂r+1r2∂2f∂θ2+1r2tan⁡θ∂f∂θ+1r2sin⁡2θ∂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(∂2Vr∂r2+1r∂2Vθ∂r∂θ+1rsin⁡θ∂2Vφ∂φ∂r+2r∂Vr∂r−1r2∂Vθ∂θ−1r2sin⁡θ∂Vφ∂φ+1rtan⁡θ∂Vθ∂r−2Vrr2−Vθr2tan⁡θ) +e^θ(1r∂2Vr∂θ∂r+1r2∂2Vθ∂θ2+1r2sin⁡θ∂2Vφ∂θ∂φ+2r2∂Vr∂θ+1r2tan⁡θ∂Vθ∂θ−cos⁡θr2sin⁡2θ∂Vφ∂φ−Vθr2sin⁡2θ) +e^φ(1rsin⁡θ∂2Vr∂φ∂r+1r2sin⁡θ∂2Vθ∂φ∂θ+1r2sin⁡2θ∂2Vφ∂φ2+2r2sin⁡θ∂Vr∂φ+cos⁡θr2sin⁡2θ∂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^r∂Vr∂r+e^re^θ∂Vθ∂r+e^re^φ∂Vφ∂r +e^θe^r(1r∂Vr∂θ−Vθr)+e^θe^θ(1r∂Vθ∂θ+Vrr)+e^θe^φ1r∂Vφ∂θ +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(Ur∂Vr∂r+Uθr∂Vr∂θ+Uφrsin⁡θ∂Vr∂φ−UθVθr−UφVφr) +e^θ(Ur∂Vθ∂r+Uθr∂Vθ∂θ+Uφrsin⁡θ∂Vθ∂φ+UθVrr−UφVφrtan⁡θ) +e^φ(Ur∂Vφ∂r+Uθr∂Vφ∂θ+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(∂2Vr∂r2+1r2∂2Vr∂θ2+1r2sin⁡2θ∂2Vr∂φ2+2r∂Vr∂r+1r2tan⁡θ∂Vr∂θ−2r2∂Vθ∂θ−2r2sin⁡θ∂Vφ∂φ−2Vrr2−2Vθr2tan⁡θ) +e^θ(∂2Vθ∂r2+1r2∂2Vθ∂θ2+1r2sin⁡2θ∂2Vθ∂φ2+2r2∂Vr∂θ+2r∂Vθ∂r+1r2tan⁡θ∂Vθ∂θ−2cos⁡θr2sin⁡2θ∂Vφ∂φ−Vθr2sin⁡2θ) +e^φ(∂2Vφ∂r2+1r2∂2Vφ∂θ2+1r2sin⁡2θ∂2Vφ∂φ2+2r2sin⁡θ∂Vr∂φ+2cos⁡θr2sin⁡2θ∂Vθ∂φ+2r∂Vφ∂r+1r2tan⁡θ∂Vφ∂θ−Vφr2sin⁡2θ)\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(∂Trr∂r+1r∂Tθr∂θ+1rsin⁡θ∂Tφr∂φ+2Trrr+Tθrrtan⁡θ−Tθθr−Tφφr) +e^θ(∂Trθ∂r+1r∂Tθθ∂θ+1rsin⁡θ∂Tφθ∂φ+2Trθr+Tθrr+Tθθrtan⁡θ−Tφφrtan⁡θ) +e^φ(∂Trφ∂r+1r∂Tθφ∂θ+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.