Categories: Mathematics, Physics.

# Spherical coordinates

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

• $r$: the radius or radial distance: distance to the origin.
• $\theta$: the elevation, polar angle or colatitude: angle to the positive $z$-axis, or zenith, i.e. the “north pole”.
• $\varphi$: the azimuth, azimuthal angle or longitude: angle from the positive $x$-axis, typically in the counter-clockwise sense.

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

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

\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)$ can be converted to $(r, \theta, \varphi)$ using these formulae, where $\mathtt{atan2}$ is the 2-argument arctangent, which is needed to handle the signs correctly:

\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 $h_r$, $h_\theta$ and $h_\varphi$ we need. To get those, we calculate the unnormalized local basis:

\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 $\vu{e}_r$, $\vu{e}_\theta$ and $\vu{e}_\varphi$, we arrive at these expressions:

\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 $\dd{\vb{\ell}}$ for a curve is as follows:

\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 $\dd{\vb{S}}$ for a surface is given by:

\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 $\dd{V}$ takes the following form:

\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:

\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} \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} \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} \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 $\nabla (\nabla \cdot \vb{V})$, the gradient of a vector $\nabla \vb{V}$, the advection of a vector $(\vb{U} \cdot \nabla) \vb{V}$ with respect to $\vb{U}$, the Laplacian of a vector $\nabla^2 \vb{V}$, and the divergence of a 2nd-order tensor $\nabla \cdot \overline{\overline{\vb{T}}}$:

\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} \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} \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} \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} \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.