Skip to main content
Physics LibreTexts

4.4: Spherical Coordinates

  • Page ID
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    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.

    m0097_fSphericalCoordinates.png 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} \nonumber \] \[\hat{\bf \theta} \times \hat{\bf \phi} = \hat{\bf r} \nonumber \] \[\hat{\bf \phi} \times \hat{\bf r} = \hat{\bf \theta} \nonumber \]

    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} \nonumber \]

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

    m0097_fSphericalBasisCrossProducts.png 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) \nonumber \]

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

    and so on.

    Table \(\PageIndex{1}\): 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 \(\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.


    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} \nonumber \]

    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 \nonumber \] 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} } \nonumber \]

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

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

    m0097_fArc.png 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 \nonumber \]

    m0097_fSphereArea.png 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} \nonumber \] 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} \nonumber \]

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

    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} \nonumber \]

    which is the volume of a sphere.

    This page titled 4.4: Spherical Coordinates is shared under a CC BY-SA 4.0 license and was authored, remixed, and/or curated by Steven W. Ellingson (Virginia Tech Libraries' Open Education Initiative) .