# 4.4: Spherical Coordinates

- Page ID
- 24240

The spherical coordinate system is defined with respect to the Cartesian system in Figure \(\PageIndex{1}\). The spherical system uses \(r\), the distance measured from the origin; \(\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.

Figure \(\PageIndex{1}\): Spherical coordinate system and associated basis vectors. (CC BY SA 4.0; K. Kikkeri).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:

\[\hat{\bf r} \times \hat{\bf \theta} = \hat{\bf \phi}\] \[\hat{\bf \theta} \times \hat{\bf \phi} = \hat{\bf r}\] \[\hat{\bf \phi} \times \hat{\bf r} = \hat{\bf \theta}\]

A useful diagram that summarizes these relationships is shown in Figure \(\PageIndex{2}\).

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 \label{m0097_es2cx} \\[4pt] y &= r \sin\phi \sin\theta \label{m0097_es2cy} \\[4pt] z &= r \cos\theta \label{m0097_es2cz}\end{align}\]

The conversion from Cartesian to spherical coordinates is as follows:

\[\begin{align} r &= \sqrt{x^2+y^2+z^2} \\[4pt] \theta &= \arccos\left(z/r\right) \\[4pt] \phi &= \arctan\left(y,x\right) \\[4pt]\end{align}\]

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

Figure \(\PageIndex{2}\) Cross products among basis vectors in the spherical system. (See Figure 4.1.10 for instructions on the use of this diagram.) (CC BY SA 4.0; K. Kikkeri).Dot products between basis vectors in the spherical and Cartesian systems are summarized in Table \(\PageIndex{1}\). 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.

\[\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)\]

\[\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)\]

and so on.

\(\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 \(\PageIndex{1}\): 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 \(\PageIndex{1}\) and Equations \ref{m0097_es2cx}- \ref{m0097_es2cz}. Making these substitutions and applying a bit of mathematical clean-up afterward, one obtains

\[\begin{aligned} {\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\end{aligned}\]

## Integration Over Length

A differential-length segment of a curve in the spherical system is \[d{\bf l} = \hat{\bf r}~dr + \hat{\bf \theta}~r~d\theta + \hat{\bf \phi}~r\sin\theta~d\phi\] 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

\[\int_{\mathcal C}{ {\bf A}\cdot d{\bf l} }\]

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 \(\PageIndex{3}\). 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

\[\int_{0}^{\pi}{ a~d\theta } = \pi a\]

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

Figure \(\PageIndex{3}\): Example in spherical coordinates: Poleto-pole distance on a sphere. (CC BY SA 4.0; K. Kikkeri).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 \(\PageIndex{4}\). The differential surface vector in this case is

\[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\]

Figure \(\PageIndex{4}\): Example in spherical coordinates: The area of a sphere. (CC BY SA 4.0; K. Kikkeri).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

\[\int_{\mathcal S} {\bf A}\cdot d{\bf s}\] 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{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) \\[4pt] &= a^2 \left( 2 \right) \left( 2\pi \right) \\[4pt] &= 4\pi a^2 \end{split}\]

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.

## Integration Over Volume

The differential volume element in the spherical system is \[dv ~=~ dr \left(r d\theta \right) \left( r \sin\theta d\phi \right) ~=~ r^2 dr~\sin\theta~d\theta~d\phi\]

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

\[\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 \\[4pt] &= \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) \\[4pt] &= \left( \frac{1}{3} a^3 \right) \left( 2 \right) \left( 2\pi \right) \\[4pt] &= \frac{4}{3}\pi a^3 \end{split}\]

which is the volume of a sphere.

## Contributors and Attributions

Ellingson, Steven W. (2018) Electromagnetics, Vol. 1. Blacksburg, VA: VT Publishing. https://doi.org/10.21061/electromagnetics-vol-1 Licensed with CC BY-SA 4.0 https://creativecommons.org/licenses/by-sa/4.0. Report adoption of this book here. If you are a professor reviewing, adopting, or adapting this textbook please help us understand a little more about your use by filling out this form.