Tutorials › Calculus III › Choosing Coordinates for Curl and Divergence

Curl and Divergence · Tutorial 923 of 999

Choosing Coordinates for Curl and Divergence

Match a vector field’s geometry to an efficient coordinate system, then compute and check its divergence and curl.

Advanced 10 min read

What You'll Learn

  • Identify when Cartesian, cylindrical, or spherical coordinates best match a field’s geometry.
  • Distinguish vector components in coordinate unit-vector bases.
  • Apply the divergence and curl formulas in all three systems.
  • Explain why divergence formulas include changing face areas.
  • Check coordinate calculations by expressing a field in another coordinate system.

Why Coordinate Choice Matters

A divergence or curl calculation is only as efficient as the coordinates used to describe the field. A field whose components are simple in Cartesian coordinates can become complicated in cylindrical or spherical coordinates. Conversely, a field with radial or rotational symmetry may require unnecessary trigonometric expressions if it is written in Cartesian components.

The aim is not to find one coordinate system that is always best. It is to recognize the geometry of a field and choose coordinates in which its components and their derivatives are simplest. A useful check is to compute in another system when the conversion is manageable.

Coordinate-choice principle: Look for the geometry preserved by the field. Cartesian coordinates suit independent variation in the \(x\), \(y\), and \(z\) directions; cylindrical coordinates suit rotation about an axis; spherical coordinates suit dependence on distance and direction from a point.

Coordinates and Components

In Cartesian coordinates, a vector field is written \(\mathbf F=F_x\mathbf e_x+F_y\mathbf e_y+F_z\mathbf e_z\), where the unit vectors are constant. Cylindrical coordinates \((\rho,\phi,z)\) use distance \(\rho\) from the \(z\)-axis, azimuthal angle \(\phi\), and height \(z\). Their unit vectors are \(\mathbf e_\rho,\mathbf e_\phi,\mathbf e_z\). Spherical coordinates \((r,\theta,\phi)\) use distance \(r\) from the origin, polar angle \(\theta\) measured from the positive \(z\)-axis, and azimuthal angle \(\phi\). Their unit vectors are \(\mathbf e_r,\mathbf e_\theta,\mathbf e_\phi\).

The components in these expressions are measured along the indicated unit vectors. In cylindrical and spherical coordinates, the unit vectors change with position. Therefore, differentiating a vector field is not generally the same as differentiating its components as if the basis vectors were constant.

For a field \(\mathbf F=(F_x,F_y,F_z)\) in Cartesian coordinates, the formulas are

$$ \nabla\cdot\mathbf F = \frac{\partial F_x}{\partial x} +\frac{\partial F_y}{\partial y} +\frac{\partial F_z}{\partial z}, \qquad \nabla\times\mathbf F = \left( \frac{\partial F_z}{\partial y}-\frac{\partial F_y}{\partial z}, \frac{\partial F_x}{\partial z}-\frac{\partial F_z}{\partial x}, \frac{\partial F_y}{\partial x}-\frac{\partial F_x}{\partial y} \right). $$

For cylindrical components \(\mathbf F=F_\rho\mathbf e_\rho+F_\phi\mathbf e_\phi+F_z\mathbf e_z\), the formulas are

$$ \nabla\cdot\mathbf F = \frac{1}{\rho}\frac{\partial}{\partial\rho}(\rho F_\rho) +\frac{1}{\rho}\frac{\partial F_\phi}{\partial\phi} +\frac{\partial F_z}{\partial z}, $$ $$ \nabla\times\mathbf F = \frac{1}{\rho} \left(\frac{\partial F_z}{\partial\phi} -\frac{\partial(\rho F_\phi)}{\partial z}\right)\mathbf e_\rho + \left(\frac{\partial F_\rho}{\partial z} -\frac{\partial F_z}{\partial\rho}\right)\mathbf e_\phi + \frac{1}{\rho} \left(\frac{\partial(\rho F_\phi)}{\partial\rho} -\frac{\partial F_\rho}{\partial\phi}\right)\mathbf e_z. $$

For spherical components \(\mathbf F=F_r\mathbf e_r+F_\theta\mathbf e_\theta+F_\phi\mathbf e_\phi\), the formulas are

$$ \nabla\cdot\mathbf F = \frac{1}{r^2}\frac{\partial}{\partial r}(r^2F_r) +\frac{1}{r\sin\theta}\frac{\partial}{\partial\theta}(\sin\theta F_\theta) +\frac{1}{r\sin\theta}\frac{\partial F_\phi}{\partial\phi}, $$ $$ \nabla\times\mathbf F = \frac{1}{r\sin\theta} \left( \frac{\partial}{\partial\theta}(\sin\theta F_\phi) -\frac{\partial F_\theta}{\partial\phi} \right)\mathbf e_r + \frac{1}{r} \left( \frac{1}{\sin\theta}\frac{\partial F_r}{\partial\phi} -\frac{\partial}{\partial r}(rF_\phi) \right)\mathbf e_\theta + \frac{1}{r} \left( \frac{\partial}{\partial r}(rF_\theta) -\frac{\partial F_r}{\partial\theta} \right)\mathbf e_\phi. $$

The cylindrical formulas are used where \(\rho>0\), and the spherical formulas where \(r>0\) and \(\sin\theta\ne0\). These restrictions reflect coordinate singularities, not necessarily singularities of the field itself. If a field is smooth on the axis or at the origin, Cartesian coordinates can be used to check its behavior there.

Why Divergence Includes Changing Face Areas

Divergence measures outward flux per unit volume in the limit of a shrinking region. In orthogonal coordinates \(q_1,q_2,q_3\), let the scale factors be \(h_1,h_2,h_3\), so a small coordinate box has side lengths \(h_i\,dq_i\). Write the field as \(\mathbf F=F_1\mathbf e_1+F_2\mathbf e_2+F_3\mathbf e_3\).

Consider the two faces perpendicular to \(\mathbf e_1\). Their area is \(h_2h_3\,dq_2dq_3\), evaluated at the face’s location. The outward flux from the pair is therefore the difference in the product of the face area factor and the normal field component—not merely the change in \(F_1\) multiplied by one fixed face area. To first order, this difference is

$$ \frac{\partial}{\partial q_1}(h_2h_3F_1)\,dq_1dq_2dq_3. $$

Adding the corresponding contributions from the other two pairs of faces, then dividing by the box volume \(h_1h_2h_3\,dq_1dq_2dq_3\), gives the general divergence formula in orthogonal coordinates:

$$ \nabla\cdot\mathbf F = \frac{1}{h_1h_2h_3} \left[ \frac{\partial}{\partial q_1}(h_2h_3F_1) +\frac{\partial}{\partial q_2}(h_1h_3F_2) +\frac{\partial}{\partial q_3}(h_1h_2F_3) \right]. $$

This explains why coordinate scale factors appear inside derivatives. In cylindrical coordinates the scale factors are \(1,\rho,1\); in spherical coordinates they are \(1,r,r\sin\theta\). Substitution gives the divergence formulas above. The same geometric dependence on scale factors also underlies the corresponding curl formulas.

Worked Example: A Cartesian Field

Worked Example: A Cartesian Field

Let \(\mathbf F=(xy,yz,zx)\). Since each component is a simple polynomial in \(x,y,z\), Cartesian coordinates are the natural choice.

For the divergence, differentiate each component with respect to its matching coordinate:

$$ \nabla\cdot\mathbf F = \frac{\partial(xy)}{\partial x} +\frac{\partial(yz)}{\partial y} +\frac{\partial(zx)}{\partial z} = y+z+x. $$

For the curl, compute each component from the Cartesian formula:

$$ \nabla\times\mathbf F = \left( \frac{\partial(zx)}{\partial y}-\frac{\partial(yz)}{\partial z}, \frac{\partial(xy)}{\partial z}-\frac{\partial(zx)}{\partial x}, \frac{\partial(yz)}{\partial x}-\frac{\partial(xy)}{\partial y} \right) = (-y,-z,-x). $$

As a check, the first curl component is \(0-y=-y\), the second is \(0-z=-z\), and the third is \(0-x=-x\). The divergence is the sum \(y+z+x\), as obtained by differentiating the three matching components.

Worked Example: Rotation About an Axis

Worked Example: A Cylindrical Rotational Field

Consider \(\mathbf F=\rho\mathbf e_\phi\). The field points around the \(z\)-axis and its magnitude depends only on distance from that axis, so cylindrical coordinates make the calculation short. Its components are \(F_\rho=0\), \(F_\phi=\rho\), and \(F_z=0\), with no dependence on \(\phi\) or \(z\).

The divergence is

$$ \nabla\cdot\mathbf F = \frac{1}{\rho}\frac{\partial}{\partial\rho}(0) +\frac{1}{\rho}\frac{\partial}{\partial\phi}(\rho) +\frac{\partial}{\partial z}(0) =0. $$

The curl components are

$$ (\nabla\times\mathbf F)_\rho=0,\qquad (\nabla\times\mathbf F)_\phi=0,\qquad (\nabla\times\mathbf F)_z = \frac{1}{\rho}\frac{\partial(\rho^2)}{\partial\rho} =2. $$

Thus \(\nabla\times\mathbf F=2\mathbf e_z\) for \(\rho>0\). Check by converting the field to Cartesian coordinates: since \(\rho\mathbf e_\phi=(-y,x,0)\), the field is \(\mathbf F=(-y,x,0)\). Its Cartesian divergence is \(\partial(-y)/\partial x+\partial x/\partial y+\partial0/\partial z=0\), and its curl is \((0,0,\partial x/\partial x-\partial(-y)/\partial y)=(0,0,2)\), in agreement.

Worked Example: A Spherically Symmetric Field

Worked Example: A Spherical Radial Field

Let \(\mathbf F=r^2\mathbf e_r\). The field is radial and its magnitude depends only on distance from the origin, so spherical coordinates are especially efficient. Here \(F_r=r^2\), \(F_\theta=0\), and \(F_\phi=0\).

Only the radial term contributes to the divergence:

$$ \nabla\cdot\mathbf F = \frac{1}{r^2}\frac{\partial}{\partial r}(r^2r^2) = \frac{1}{r^2}\frac{\partial(r^4)}{\partial r} = 4r. $$

Every curl component is zero: the radial component differentiates \(F_\phi=0\) and \(F_\theta=0\); the \(\mathbf e_\theta\) component differentiates \(F_r\) with respect to \(\phi\) and \(F_\phi\) with respect to \(r\), both giving zero; and the \(\mathbf e_\phi\) component differentiates \(F_\theta=0\) and \(F_r=r^2\) with respect to \(\theta\), also giving zero. Hence \(\nabla\times\mathbf F=\mathbf 0\) for \(r>0\).

For a Cartesian check, \(r\mathbf e_r=(x,y,z)\), so \(\mathbf F=(xr,yr,zr)\). Its divergence is

$$ \frac{\partial(xr)}{\partial x} +\frac{\partial(yr)}{\partial y} +\frac{\partial(zr)}{\partial z} = \left(r+\frac{x^2}{r}\right) +\left(r+\frac{y^2}{r}\right) +\left(r+\frac{z^2}{r}\right) = 3r+\frac{x^2+y^2+z^2}{r} = 4r. $$

The Cartesian curl vanishes because, for example, \(\partial(zr)/\partial y=zy/r=\partial(yr)/\partial z\); the other paired derivatives agree in the same way. This confirms both results away from the origin.

Comparing Coordinate Choices

The rotational field from the cylindrical example illustrates why a coordinate system should match the field’s geometry. In spherical coordinates it is still possible to calculate, but its components are \(F_r=0\), \(F_\theta=0\), and \(F_\phi=r\sin\theta\), because \(\rho=r\sin\theta\). Substituting these components into the spherical curl formula gives

$$ \nabla\times\mathbf F = 2\cos\theta\,\mathbf e_r -2\sin\theta\,\mathbf e_\theta. $$

This is the same vector \(2\mathbf e_z\): the identity \(\mathbf e_z=\cos\theta\,\mathbf e_r-\sin\theta\,\mathbf e_\theta\) confirms it. The answer is correct, but the cylindrical calculation was simpler because the field’s rotational symmetry is organized around the \(z\)-axis.

Use these questions when selecting coordinates:

  • Does the field depend on distance from a point? If so, test spherical coordinates.
  • Does it rotate around a particular axis or depend on distance from that axis? If so, test cylindrical coordinates.
  • Are its components simple polynomials or functions of \(x,y,z\) separately? Cartesian coordinates may be best.
  • Do the components or basis vectors become more complicated after conversion? If so, keep the original coordinates unless another system offers a clear advantage.

A Common Pitfall: Differentiating Components Alone

In cylindrical coordinates, the field \(\mathbf F=\mathbf e_\rho\) has \(F_\rho=1\), with the other components zero. A tempting but incorrect calculation is to say that every component is constant, so the divergence is zero. That argument ignores the changing area of the cylindrical faces: a face at larger \(\rho\) has a larger area.

The correct calculation uses the cylindrical divergence formula:

$$ \nabla\cdot\mathbf e_\rho = \frac{1}{\rho}\frac{\partial}{\partial\rho}(\rho\cdot1) = \frac{1}{\rho}. $$

Equivalently, for a thin cylindrical box with radial thickness \(d\rho\), angular width \(d\phi\), and height \(dz\), the outer face has area \((\rho+d\rho)d\phi\,dz\), while the inner face has area \(\rho\,d\phi\,dz\). Their net outward flux is \(d\rho\,d\phi\,dz\). Dividing by the box volume \(\rho\,d\rho\,d\phi\,dz\), to first order, gives \(1/\rho\). The face-area change is essential, even though the radial component is constant.

Summary

Coordinate choice is a way to expose structure, not a change in the underlying vector field. Cartesian coordinates keep the basis fixed; cylindrical and spherical coordinates can simplify fields with axis or radial symmetry, but their scale factors and position-dependent unit vectors must be respected. A good calculation identifies the field’s symmetry, uses the matching component formulas, and checks the result where a second representation is convenient.

Check Your Understanding

Use the coordinate formulas and the geometric reasoning from this tutorial to answer the following.

  1. Which coordinate system is most natural for a field whose components depend only on distance from the \(z\)-axis?
  2. Why does cylindrical divergence involve the derivative of \(\rho F_\rho\), rather than only the derivative of \(F_\rho\)?
  3. For \(\mathbf F=\rho\mathbf e_\phi\), what are the divergence and curl, and what Cartesian field represents it?
  4. What coordinate restrictions apply to the spherical formulas, and do they necessarily indicate that the vector field is singular?
  5. When might converting a result to Cartesian coordinates provide a useful check?