Dynamics

Spherical coordinates

The spherical coordinate system extends polar coordinates into 3D by using an angle $\phi$ for the third coordinate. This gives coordinates $(r, \theta, \phi)$ consisting of:

coordinate name range definition
$r$ radius $0 \le r \lt \infty$ distance from the origin
$\theta$ azimuth $-\pi \lt \theta \le \pi$ angle from the $x$-axis in the $x$–$y$ plane
$\phi$ inclination $0 \le \phi \le \pi$ angle from the positive $z$ axis

The diagram below shows the spherical coordinates of a point $P$. By changing the display options, we can see that the basis vectors are tangent to the corresponding coordinate lines. Changing $\theta$ moves $P$ along the $\theta$ coordinate line in the direction $\hat{e}_\theta$, and similarly for the other coordinates.

Show:
Coordinate lines:
Radius: $r = $
Azimuth: $\theta = $ °
Inclination: $\phi = $ °

Spherical coordinates are defined with respect to a set of Cartesian coordinates, and can be converted to and from these coordinates using the atan2 function as follows.

Conversion between spherical and Cartesian coordinates

\[\begin{aligned} x &= r \cos\theta \sin\phi & r &= \sqrt{x^2 + y^2 + z^2} \\ y &= r \sin\theta \sin\phi & \theta &= \operatorname{atan2}(y, x) \\ z &= r \cos\phi & \phi &= \operatorname{arccos}(z / r) \end{aligned}\]

To find the conversion to Cartesian coordinates, we consider the projection of $\vec{r}$ down onto the $x$–$y$ plane, as shown. Then $z = r \cos\phi$ and $\ell = r \sin\phi$, from which we obtain $x = \ell \cos\theta$ and $y = \ell \sin\theta$.

To convert from Cartesian coordinates, we use the same projection and read off the expressions for the spherical coordinates. This uses the atan2 function to handle the different quadrants for $\theta$.

The basis vectors are tangent to the coordinate lines and form an orthonormal basis $\hat{e}_r, \hat{e}_\theta, \hat{e}_\phi$ that depends on the current position $P$ as follows.

Spherical basis vectors

\[\begin{aligned} \hat{e}_r &= \cos\theta \sin\phi \,\hat{\imath} + \sin\theta \sin\phi \,\hat{\jmath} + \cos\phi \,\hat{k} \\ \hat{e}_{\theta} &= - \sin\theta \,\hat{\imath} + \cos\theta \,\hat{\jmath} \\ \hat{e}_{\phi} &= \cos\theta \cos\phi \,\hat{\imath} + \sin\theta \cos\phi \,\hat{\jmath} - \sin\phi \,\hat{k} \\[1em] \hat{\imath} &= \cos\theta \sin\phi \, \hat{e}_r - \sin\theta \, \hat{e}_\theta + \cos\theta \cos\phi \, \hat{e}_\phi \\ \hat{\jmath} &= \sin\theta \sin\phi \, \hat{e}_r + \cos\theta \, \hat{e}_\theta + \sin\theta \cos\phi \, \hat{e}_\phi \\ \hat{k} &= \cos\phi \, \hat{e}_r - \sin\phi \, \hat{e}_\phi \end{aligned}\]

We write the position vector $\vec{r} = r \cos\theta \sin\phi \, \hat{\imath} + r \sin\theta \sin\phi \, \hat{\jmath} + r \cos\phi \, \hat{k}$ and then use the definition of coordinate basis vectors to find the non-normalized spherical basis vectors:

\[\begin{aligned} \vec{e}_r &= \frac{\partial\vec{r}}{\partial r} = \cos\theta \sin\phi \, \hat{\imath} + \sin\theta \sin\phi \, \hat{\jmath} + \cos\phi \, \hat{k} \\ \vec{e}_\theta &= \frac{\partial\vec{r}}{\partial\theta} = -r \sin\theta \sin\phi \, \hat{\imath} + r \cos\theta \sin\phi \, \hat{\jmath} \\ \vec{e}_\phi &= \frac{\partial\vec{r}}{\partial\phi} = r \cos\theta \cos\phi \, \hat{\imath} + r \sin\theta \cos\phi \, \hat{\jmath} - r \sin\phi \, \hat{k} \end{aligned}\]

To normalize these vectors we divide by their lengths, which we can compute to be $\| \vec{e}_r \| = 1$, $\| \vec{e}_\theta \| = r \sin\phi$, and $\| \vec{e}_\phi \| = r$.

To invert the basis change we first observe that we can take combinations of $\hat{e}_r$ and $\hat{e}_\phi$ to give:

\[\begin{aligned} \cos\phi \, \hat{e}_r - \sin\phi \, \hat{e}_\phi &= \hat{k} \\ \sin\phi \, \hat{e}_r + \cos\phi \, \hat{e}_\phi &= \cos\theta \, \hat{\imath} + \sin\theta \, \hat{\jmath} \end{aligned}\]

Then:

\[\begin{aligned} \cos\theta(\sin\phi \, \hat{e}_r + \cos\phi \, \hat{e}_\phi) - \sin\theta \, \hat{e}_\theta &= \cos^2\theta \, \hat{\imath} + \sin^2\theta \, \hat{\imath} = \hat{\imath} \\ \sin\theta(\sin\phi \, \hat{e}_r + \cos\phi \, \hat{e}_\phi) + \cos\theta \, \hat{e}_\theta &= \sin^2\theta \, \hat{\imath} + \cos^2\theta \, \hat{\jmath} = \hat{\jmath} \end{aligned}\]

Rearranging these gives the Cartesian basis vector expressions above.

Warning: $(\hat{e}_r,\hat{e}_\theta,\hat{e}_\phi)$ is not right-handed

Although it is common to write the spherical coordinates in the order $(r,\theta,\phi)$, this order gives a left-handed basis $(\hat{e}_r,\hat{e}_\theta,\hat{e}_\phi)$, which we can see graphically from the fact that $\hat{e}_r \times \hat{e}_\theta = -\hat{e}_\phi$. We can either work with this as a left-handed basis, or re-order the coordinates to give the right-handed basis $(\hat{e}_r,\hat{e}_\phi,\hat{e}_\theta)$.

If the spherical coordinates change with time then this causes the spherical basis vectors to rotate with the following angular velocity.

Angular velocity of the spherical basis

\[\begin{aligned} \vec{\omega} &= \dot\phi \, \hat{e}_\theta + \dot\theta \, \hat{k} \\ &= \dot\theta \cos\phi \,\hat{e}_r + \dot\phi \, \hat{e}_\theta - \dot\theta \sin\phi \,\hat{e}_{\phi} \end{aligned}\]

Changing $r$ does not cause a rotation of the basis, while changing $\theta$ rotates about the vertical axis $\hat{k}$ and changing $\phi$ rotates about $\hat{e}_\theta$. Combining these angular velocities gives the expression for $\vec{\omega}$.

The rotation of the basis vectors caused by changing coordinates can be directly computed, giving the time derivatives below.

Time derivatives of spherical basis vectors

\[\begin{aligned} \dot{\hat{e}}_r &= \dot\theta \sin\phi \,\hat{e}_{\theta} + \dot\phi \,\hat{e}_{\phi} \\ \dot{\hat{e}}_{\theta} &= - \dot\theta \sin\phi \,\hat{e}_r - \dot\theta \cos\phi \,\hat{e}_{\phi} \\ \dot{\hat{e}}_{\phi} &= - \dot\phi \,\hat{e}_r + \dot\theta \cos\phi \,\hat{e}_{\theta} \end{aligned}\]

We can either directly differentiate the basis vector expressions, or we can recall that $\dot{\hat{e}} = \vec{\omega} \times \hat{e}$ for any basis vector $\hat{e}$. This gives:

\[\begin{aligned} \dot{\hat{e}}_r &= \vec{\omega} \times \hat{e}_r = \dot\theta \cos\phi \, \hat{e}_r \times \hat{e}_r + \dot\phi \, \hat{e}_\theta \times \hat{e}_r - \dot\theta \sin\phi \, \hat{e}_{\phi} \times \hat{e}_r \\ \dot{\hat{e}}_{\theta} &= \vec{\omega} \times \hat{e}_{\theta} = \dot\theta \cos\phi \,\hat{e}_r \times \hat{e}_\theta + \dot\phi \, \hat{e}_\theta \times \hat{e}_\theta - \dot\theta \sin\phi \,\hat{e}_{\phi} \times \hat{e}_\theta \\ \dot{\hat{e}}_{\phi} &= \vec{\omega} \times \hat{e}_{\phi} = \dot\theta \cos\phi \,\hat{e}_r \times \hat{e}_\phi + \dot\phi \, \hat{e}_\theta \times \hat{e}_\phi - \dot\theta \sin\phi \,\hat{e}_{\phi} \times \hat{e}_\phi \end{aligned}\]

Now we evaluate the cross products graphically to obtain the final expressions.

A point $P$ at a time-varying position $(r,\theta,\phi)$ has position vector $\vec{r}$, velocity $\vec{v} = \dot{\vec{r}}$, and acceleration $\vec{a} = \ddot{\vec{r}}$ given by the following expressions in spherical components.

Position, velocity, and acceleration in spherical components

\[\begin{aligned} \vec{r} &= r \,\hat{e}_r \\ \vec{v} &= \dot{r} \,\hat{e}_r + r \dot\theta \sin\phi \,\hat{e}_{\theta} + r \dot\phi \,\hat{e}_{\phi} \\ \vec{a} &= (\ddot{r} - r \dot{\theta}^2 \sin^2\phi - r \dot{\phi}^2) \,\hat{e}_r \\ &\quad + (r \ddot\theta \sin\phi + 2 \dot{r} \dot\theta \sin\phi + 2 r \dot\theta \dot\phi \cos\phi) \,\hat{e}_{\theta} \\ &\quad + (r \ddot\phi + 2 \dot{r} \dot\phi - r \dot{\theta}^2 \sin\phi \cos\phi) \,\hat{e}_{\phi} \end{aligned}\]

Because $\hat{e}_r$ is a unit vector in the direction of the position vector $\vec{r}$, we know that $\vec{r} = r \, \hat{e}_r$. Then we can differentiate this expression to obtain:

\[\begin{aligned} \vec{v} &= \dot{\vec{r}} = \frac{d}{dt}\Big(r \, \hat{e}_r \Big) = \dot{r} \, \hat{e}_r + r \, \dot{\hat{e}}_r \end{aligned}\]

and we substitute in the expression for $\dot{\hat{e}}_r$ from above. Taking another derivative gives:

\[\begin{aligned} \vec{a} = \dot{\vec{v}} &= \frac{d}{dt}\Big( \dot{r} \,\hat{e}_r + r \dot\theta \sin\phi \,\hat{e}_{\theta} + r \dot\phi \,\hat{e}_{\phi} \Big) \\ &= \ddot{r} \, \hat{e}_r + \dot{r} \, \dot{\hat{e}}_r + (\dot{r} \dot\theta \sin\phi + r \ddot\theta \sin\phi + r \dot\theta \cos\phi \, \dot\phi) \, \hat{e}_\theta \\ &\quad + r \dot\theta \sin\phi \, \dot{\hat{e}}_\theta + (\dot{r} \dot\phi + r \ddot\phi) \, \hat{e}_\phi + r \dot\phi \, \dot{\hat{e}}_\phi \end{aligned}\]

and again we can substitute the basis vector derivatives.

There are many different conventions for spherical coordinates notation, so it's important to check which variant is being used in any document. The convention used here is common in mathematics. In physics it is also common to use the same angles, but to reverse the symbol convention so that $\phi$ is the azimuth and $\theta$ is the inclination. Many different names for the coordinates are also used, with the inclination also being called the zenith angle, polar angle, or normal angle. Alternatively, the inclination may be replaced by the elevation measured up from the $x$-$y$ plane. In geographic coordinates the azimuth is the longitude $\lambda$ and the elevation is the latitude $\phi$, while in celestial coordinates the azimuth is the right ascension $\alpha$ and the elevation is the declination $\delta$.

The angles themselves may be given in radians or degrees, and are sometimes written in degrees (symbol °), arc-minutes (1/60 of a degree, symbol ′) and arc-seconds (1/60 of an arc-minute, symbol ″). Positive and negative angles are normally indicated by +/-, but sometimes use North/South (N/S) or East/West (E/W). Thus a longitude may be written as $\lambda$ = 88°12′15″ W = 88.2042° W = -88.2042° = -1.53945 rad.