4.4 Spherical Coordinates

The spherical coordinate system is defined with respect to the Cartesian system in Figure 4.16. The spherical system uses \(r\), the distance measured from the origin;[1] \(\theta\), the angle measured from the \(+z\) axis toward the \(z=0\) plane; and \(\phi\), the angle measured in a plane of constant \(z\), identical to \(\phi\) in the cylindrical system.

Cartesian coordinate system with a point arbitrarily plotted in the positive x, y, and z axes. A dashed line forms an acute triangle with one point at the origin of the Cartesian coordinate system and the top point connected to the arbitrary point with hypotenuse labeled r. The angle from the x-axis to the bottom side of the triangle is labeled phi. The angle from the z-axis to the hypotenuse is labeled theta. From the arbitrary point, vectors labeled phi-hat, r-hat, and theta-hat extend. The phi-hat vector extends parallel to the z-axis. Theta-hat extends parallel to the x-axis. R-hat is perpendicular to phi-hat and theta-hat.
Figure 4.16. Spherical coordinate system and associated basis vectors. © K. Kikkeri CC BY SA 4.0

Spherical coordinates are preferred over Cartesian and cylindrical coordinates when the geometry of the problem exhibits spherical symmetry. For example, in the Cartesian coordinate system, the surface of a sphere concentric with the origin requires all three coordinates (\(x\), \(y\), and \(z\)) to describe. However, this surface can be described using a single constant parameter – the radius \(r\) – in the spherical coordinate system. This leads to a dramatic simplification in the mathematics in certain applications.

The basis vectors in the spherical system are \(\hat{\bf r}\), \(\hat{\bf \theta}\), and \(\hat{\bf \phi}\). As always, the dot product of like basis vectors is equal to one, and the dot product of unlike basis vectors is equal to zero. For the cross-products, we find:

\begin{equation} \hat{\bf r} \times \hat{\bf \theta} = \hat{\bf \phi} \tag{4.69}\end{equation}
\begin{equation} \hat{\bf \theta} \times \hat{\bf \phi} = \hat{\bf r} \tag{4.70}\end{equation}
\begin{equation} \hat{\bf \phi} \times \hat{\bf r} = \hat{\bf \theta} \tag{4.71}\end{equation}

A useful diagram that summarizes these relationships is shown in Figure 4.17.

The symbols for r-hat, theta-hat, and phi-hat are arranged in a circle, connected by arrows pointing in a counter-clockwise direction. A cross product symbol appears in the center of the circle.
Figure 4.17. Cross products among basis vectors in the spherical system. (See Figure 4.10 for instructions on the use of this diagram.)

Like the cylindrical system, the spherical system is often less useful than the Cartesian system for identifying absolute and relative positions. The reason is the same: Basis directions in the spherical system depend on position. For example, \(\hat{\bf r}\) is directed radially outward from the origin, so \(\hat{\bf r}=\hat{\bf x}\) for locations along the \(x\)-axis but \(\hat{\bf r}=\hat{\bf y}\) for locations along the \(y\) axis and \(\hat{\bf r}=\hat{\bf z}\) for locations along the \(z\) axis. Similarly, the directions of \(\hat{\bf \theta}\) and \(\hat{\bf \phi}\) vary as a function of position. To overcome this awkwardness, it is common to begin a problem in spherical coordinates, and then to convert to Cartesian coordinates at some later point in the analysis. Here are the conversions:

\begin{align} x &= r \cos\phi \sin\theta \tag{4.72} \\ y &= r \sin\phi \sin\theta \tag{4.73} \\ z &= r \cos\theta \tag{4.74}\end{align}

The conversion from Cartesian to spherical coordinates is as follows:

\begin{align} r &= \sqrt{x^2+y^2+z^2} \tag{4.75} \\ \theta &= \arccos\left(z/r\right) \tag{4.76} \\ \phi &= \arctan\left(y,x\right) \tag{4.77}\end{align}

where \(\arctan\) is the four-quadrant inverse tangent function.[2]

Dot products between basis vectors in the spherical and Cartesian systems are summarized in Table 4.2. This information can be used to convert between basis vectors in the spherical and Cartesian systems, in the same manner described in Section 4.3; e.g.

\begin{equation} \hat{\bf x} = \hat{\bf r }\left(\hat{\bf r }\cdot\hat{\bf x}\right) +\hat{\bf \theta}\left(\hat{\bf \theta}\cdot\hat{\bf x}\right) +\hat{\bf \phi }\left(\hat{\bf \phi }\cdot\hat{\bf x}\right) \tag{4.78}\end{equation}
\begin{equation} \hat{\bf r} = \hat{\bf x}\left(\hat{\bf x}\cdot\hat{\bf r}\right) +\hat{\bf y}\left(\hat{\bf y}\cdot\hat{\bf r}\right) +\hat{\bf z}\left(\hat{\bf z}\cdot\hat{\bf r}\right) \tag{4.79}\end{equation}

and so on.

Table 4.2. Dot products between basis vectors in the spherical and Cartesian coordinate systems.
\(\cdot\)\(\hat{\bf r}\)\(\hat{\bf \theta}\)\(\hat{\bf \phi}\)
\(\hat{\bf x}\)\(\sin\theta\cos\phi\)\(~\cos\theta\cos\phi\)\(-\sin\phi\)
\(\hat{\bf y}\)\(\sin\theta\sin\phi\)\(~\cos\theta\sin\phi\)\(~\cos\phi\)
\(\hat{\bf z}\)\(\cos\theta\)\(-\sin\theta\)0

 

Example 4.3

Cartesian to spherical conversion.
 
A vector field \({\bf G} = \hat{\bf x}~xz/y\). Develop an expression for \({\bf G}\) in spherical coordinates.

Solution: Simply substitute expressions in terms of spherical coordinates for expressions in terms of Cartesian coordinates. Use Table 4.2 and Equations 4.724.74. Making these substitutions and applying a bit of mathematical clean-up afterward, one obtains

\begin{align} {\bf G} =& \left( \hat{\bf r}\sin\theta\cot\phi + \hat{\bf\phi}\cos\theta\cot\phi - \hat{\bf \phi} \right) \\ & \cdot r\cos\theta\cos\phi \tag{4.80}\end{align}

Integration Over Length. A differential-length segment of a curve in the spherical system is

\begin{equation} d{\bf l} = \hat{\bf r}~dr + \hat{\bf \theta}~r~d\theta + \hat{\bf \phi}~r\sin\theta~d\phi \tag{4.81}\end{equation}

Note that \(\theta\) is an angle, as opposed to a distance. The associated distance is \(r~d\theta\) in the \(\theta\) direction. Note also that in the \(\phi\) direction, distance is \(r~d\phi\) in the \(z=0\) plane and less by the factor \(\sin\theta\) for \(z<>0\).

As always, the integral of a vector field \({\bf A}({\bf r})\) over a curve \({\mathcal C}\) is

\begin{equation} \int_{\mathcal C}{ {\bf A}\cdot d{\bf l} } \tag{4.82}\end{equation}

To demonstrate line integration in the spherical system, imagine a sphere of radius \(a\) centered at the origin with “poles” at \(z=+a\) and \(z=-a\). Let us calculate the integral of \({\bf A}({\bf r})=\hat{\bf \theta}\), where \(\mathcal{C}\) is the arc drawn directly from pole to pole along the surface of the sphere, as shown in Figure 4.18. In this example, \(d{\bf l} = \hat{\bf \theta}~a~d\theta\) since \(r=a\) and \(\phi\) (which could be any value) are both constant along \({\mathcal C}\). Subsequently, \({\bf A}\cdot d{\bf l}=a~d\theta\) and the above integral is

\begin{equation} \int_{0}^{\pi}{ a~d\theta } = \pi a \tag{4.83}\end{equation}

i.e., half the circumference of the sphere, as expected.

A three dimensional sphere centered at the intersection of the rho and z axes. The radius (a) shown at unspecified angle in the first quadrant of the sphere. The north and south poles of the sphere are labeled, and the circumference between them is bolded. From the north pole to the radius (a) is a vector labeled dl. The angle from the z-axis to the radius (a) is labeled theta.
Figure 4.18. Example in spherical coordinates: Pole-to-pole distance on a sphere. © K. Kikkeri CC BY SA 4.0

Note that the spherical system is an appropriate choice for this example because the problem can be expressed with the minimum number of varying coordinates in the spherical system. If we had attempted this problem in the Cartesian system, we would find that both \(z\) and either \(x\) or \(y\) (or all three) vary over \({\mathcal C}\) and in a relatively complex way.

Integration Over Area. Now we ask the question, what is the integral of some vector field \({\bf A}\) over the surface \({\mathcal S}\) of a sphere of radius \(a\) centered on the origin? This is shown in Figure 4.19. The differential surface vector in this case is

\begin{equation} d{\bf s} = \hat{\bf r}~\left( r~d\theta \right) \left( r\sin\theta~d\phi \right) = \hat{\bf r}~r^2\sin\theta~d\theta~d\phi \tag{4.84}\end{equation}

As always, the direction is normal to the surface and in the direction associated with positive flux. The quantities in parentheses are the distances associated with varying \(\theta\) and \(\phi\), respectively. In general, the integral over a surface is

\begin{equation} \int_{\mathcal S} {\bf A}\cdot d{\bf s} \tag{4.85}\end{equation}

In this case, let’s consider \({\bf A}=\hat{\bf r}\); in this case \({\bf A}\cdot d{\bf s} = a^2~\sin\theta~d\theta~d\phi\) and the integral becomes

\begin{equation} \begin{split} \int_{0}^{\pi}\int_{0}^{2\pi} a^2~\sin\theta~d\theta~d\phi &= a^2 \left( \int_{0}^{\pi} \sin\theta d\theta \right) \left( \int_{0}^{2\pi} d\phi \right) \\ &= a^2 \left( 2 \right) \left( 2\pi \right) \\ &= 4\pi a^2 \end{split} \tag{4.86}\end{equation}

which we recognize as the area of the sphere, as expected. The corresponding calculation in the Cartesian or cylindrical systems is quite difficult in comparison.

A three dimensional sphere lies on a x, y, z axis, with its center at the origin. The radius is labeled a. A square is projected on the surface from the origin, with dashed lines indicating the projection. The width of the box is labeled r * sin(theta) * d phi, and the height of the box is labeled r * d theta.
Figure 4.19. Example in spherical coordinates: The area of a sphere. © K. Kikkeri CC BY SA 4.0

Integration Over Volume. The differential volume element in the spherical system is

\begin{equation} dv ~=~ dr \left(r d\theta \right) \left( r \sin\theta d\phi \right) ~=~ r^2 dr~\sin\theta~d\theta~d\phi \tag{4.87}\end{equation}

For example, if \(A({\bf r})=1\) and the volume \(\mathcal{V}\) is a sphere of radius \(a\) centered on the origin, then

\begin{equation} \begin{split} \int_{\mathcal V} A({\bf r})~dv &= \int_0^a \int_0^{\pi} \int_0^{2\pi} r^2 dr~\sin\theta~d\theta~d\phi \\ &= \left(\int_0^a r^2 dr \right) \left( \int_0^{\pi} \sin\theta~d\theta \right) \left( \int_0^{2\pi} d\phi \right) \\ &= \left( \frac{1}{3} a^3 \right) \left( 2 \right) \left( 2\pi \right) \\ &= \frac{4}{3}\pi a^3 \end{split} \tag{4.88}\end{equation}

which is the volume of a sphere.

Additional Reading:


  1. Note that some textbooks use “\(R\)” in lieu of \(r\) for this coordinate.
  2. Note that this function is available in MATLAB and Octave as atan2(y,x).