You are here: start » whitepapers » divcurl
Divergence & Curl
From Flux to Divergence
Consider a small closed box, with sides parallel to the coordinate planes, as shown on the right. What is the flux of $\EE$ out of the box?
Consider first the vertical contribution, namely the flux up through the top plus the flux down through the bottom. These two sides each have area element $dA=dx\,dy$, but the outward normal vectors point in opposite directions, that is \begin{align} \nn_{\hbox{up}} &= +\zhat ,\\ \nn_{\hbox{down}} &= -\zhat , \end{align} so we get \begin{align} \sum_{\hbox{top+bottom}} \EE \cdot d\AA &= \EE(z+dz) \cdot \zhat\> dx\,dy - \EE(z) \cdot\zhat\> dx\,dy \nonumber\\ &= \Bigl( E_z(z+dz) - E_z(z) \Bigr) \> dx\,dy \nonumber\\ &= \frac{E_z(z+dz) - E_z(z)}{dz} \> dx\,dy\,dz \nonumber\\ &= \Partial{E_z}{z} \>\> dx\,dy\,dz \end{align} where we have multiplied and divided by $dz$ to obtain the volume element $dV=dx\,dy\,dz$ in the third step, and used the definition of the derivative in the final step.
Repeating this argument using the remaining pairs of faces, it follows that the total flux out of the box is \begin{align} \hbox{total flux} = \sum_{\hbox{box}} \EE \cdot d\AA = \left( \Partial{E_x}{x} + \Partial{E_y}{y} + \Partial{E_z}{z} \right) \> dV . \end{align} Since the total flux is proportional to the volume of the box, it approaches zero as the box shrinks down to a point. The interesting quantity is therefore the ratio of the flux to volume; this ratio is called the divergence.
At any point $P$, we therefore define the divergence of a vector field $\EE$, written $\grad\cdot\EE$, to be the flux of $\EE$ per unit volume leaving a small box around $P$. In other words, the divergence is the limit as the box collapses around $P$ of the ratio of the flux of the vector field out of the box to the volume of the box. Thus, the divergence of $\EE$ at $P$ is the flux per unit volume through a small box around $P$, and is given in rectangular coordinates by \begin{align} \grad\cdot\EE = \frac{\hbox{flux}}{\hbox{unit volume}} = \Partial{E_x}{x} + \Partial{E_y}{y} + \Partial{E_z}{z} . \label{divE} \end{align}
Other Coordinates
You may have seen (\ref{divE}) before, but remember that it is merely the rectangular coordinate expression for the divergence of $\EE$, defined geometrically as flux per unit volume. Similar computations can be used to determine expressions for the divergence in other coordinate systems. Because of the geometric nature of divergence, these expressions give the same value at any point in space.
Recall that the divergence is defined in terms of flux per unit volume; we used this geometric definition above to derive (\ref{divE}). Similar computations to those in rectangular coordinates can be done using boxes adapted to other coordinate systems. Not surprisingly, this introduces some additional factors of $r$ (and $\sin\theta$). For instance, consider a radial vector field of the form \begin{align} \EE = E_r\,\rhat \end{align} where $\rhat$ is the unit vector in the radial direction. The electric field of a point charge would have this form. What is the flux of $\EE$ through a small box around an arbitrary point $P$, whose sides are surfaces with one of the spherical coordinates held constant, as shown in the figure above? Only the two sides which are parts of spheres contribute, and each such contribution takes the form \begin{align} \EE\cdot d\AA = \pm E_r \,r^2\sin\theta\,d\theta\,d\phi . \end{align} An argument similar to the one used in rectangular coordinates leads to \begin{align} \EE\cdot d\AA = \Partial{}{r}\Bigl(r^2 E_r\Bigr) \sin\theta\,dr\,d\theta\,d\phi = \frac{1}{r^2} \Partial{}{r}\Bigl(r^2 E_r\Bigr) \,dV \end{align} where it is important to note that the factor of $r^2$ must also be differentiated. It now finally follows that \begin{align} \grad\cdot\EE = \frac{1}{r^2} \Partial{}{r}\Bigl(r^2 E_r\Bigr) . \end{align}
This expression only gives the divergence of the very special vector field $\EE$ given above. The full expression for the divergence in spherical coordinates is obtained by performing a similar analysis of the flux of an arbitrary vector field $\FF$ through our small box; the result can be found here. This formula, as well as similar formulas for other vector derivatives in rectangular, cylindrical, and spherical coordinates, are sufficiently important to the study of electromagnetism that they can, for instance, be found on the inside front cover of Griffiths' textbook, Introduction to Electrodynamics.
Divergence Theorem
The total flux of the electric field out through a small rectangular box is \begin{align} \hbox{flux} = \sum_{\hbox{box}} \EE \cdot d\AA = \grad\cdot\EE \> dV . \end{align} But any closed region can be filled with such boxes, as shown in on the left. Furthermore, the flux out of such a region is just the sum of the flux out of each of the smaller boxes, since the net flux through any common face will be zero (because adjacent boxes have opposite notions of “out of”), as indicated schematically in on the right. Thus, the total flux out of any closed box is given by \begin{align} \Int_{\hbox{box}} \EE \cdot d\AA = \Int_{\hbox{inside}} \!\! \grad\cdot\EE \>\> dV . \end{align} This is the Divergence Theorem.
From Circulation to Curl
Consider a small rectangular loop in the $yz$-plane, with sides parallel to the coordinate axes, as shown on the right. What is the circulation of $\AA$ around this loop?
Consider first the horizontal edges, on each of which $d\rr=dy\,\yhat$. However, when computing the circulation of $\AA$ around this loop, we traverse these two edges in opposite directions. In particular, when traversing the loop in the counterclockwise direction, $dy<0$ on top and $dy>0$ on the bottom. We would like to compare these two edges, but we have \begin{equation} dy_{\hbox{top}} = -dy_{\hbox{bot}} \end{equation} so we conventionally set $dy=dy_{\hbox{bot}}$, leading to $dy_{\hbox{top}}=-dy$. 1) Thus, \begin{align} \sum_{\hbox{top+bottom}} \AA \cdot d\rr &= - \AA(z+dz)\cdot\yhat\> dy + \AA(z)\cdot\yhat\> dy \nonumber\\ &= - \Bigl( A_y(z+dz) - A_y(z) \Bigr) \> dy \nonumber\\ &= - \frac{A_y(z+dz) - A_y(z)}{dz} \> dy\,dz \nonumber\\ &= - \Partial{A_y}{z} \>\> dy\,dz \label{topbot2} \end{align} where we have multiplied and divided by $dz$ to obtain the surface element $dA=dy\,dz$ in the third step, and used the definition of the derivative in the final step.
Just as with the divergence, in making this argument we are assuming that $\AA$ doesn't change much in the $x$ and $y$ directions, while nonetheless caring about the change in the $z$ direction. We are again subtracting the values at two points separated in the $z$ direction, so we are canceling the zeroth order term in $z$, and therefore need the next order term. This can be made precise using a multivariable Taylor series expansion.
Repeating this argument for the remaining two sides leads to \begin{align} \sum_{\hbox{sides}}\AA \cdot d\rr &= \AA(y+dy)\cdot\zhat\> dz - \AA(y)\cdot\zhat\> dz \nonumber\\ &= \Bigl( A_z(y+dy) - A_z(y) \Bigr) \> dz \nonumber\\ &= \frac{A_z(y+dy) - A_z(y)}{dy} \> dy\,dz \nonumber\\ &= \Partial{A_z}{y} \>\> dy\,dz \end{align} where care must be taken with the signs, which are different from those in (\ref{topbot2}). Adding up both expressions, we obtain \begin{equation} \hbox{total $yz$-circulation} = \left( \Partial{A_z}{y} - \Partial{A_y}{z} \right) dx\,dy . \end{equation} Since this is proportional to the area of the loop, it approaches zero as the loop shrinks down to a point. The interesting quantity is therefore the ratio of the circulation to area. This ratio is almost the curl, but not quite.
However, we could have oriented our loop any way we liked. We obtain a circulation for each orientation, which we can associate with the normal vector to the loop; curl is a vector quantity. Our loop has counterclockwise orientation of the loop as seen from the positive $x$-axis; we are computing the $\xhat$-component of the curl.
Putting this all together, we define the $\xhat$-component of the curl of a vector field $\AA$ to be \begin{equation} \hbox{curl}(\AA)\cdot\xhat = \frac{\hbox{$yz$-circulation}}{\hbox{unit area}} = \Partial{A_z}{y} - \Partial{A_y}{z} . \end{equation} The rectangular expression for the full curl now follows by cyclic symmetry, yielding \begin{equation} \hbox{curl}(\AA) = \left( \Partial{A_z}{y} - \Partial{A_y}{z} \right) \xhat + \left( \Partial{A_x}{z} - \Partial{A_z}{x} \right) \yhat + \left( \Partial{A_y}{x} - \Partial{A_x}{y} \right) \zhat \end{equation} which is more easily remembered in the form \begin{equation} \hbox{curl}(\AA) = \grad\times\AA = \left| \matrix{\xhat& \yhat& \zhat\cr \noalign{\smallskip} \Partial{}{x}& \Partial{}{y}& \Partial{}{z}\cr \noalign{\smallskip} A_x& A_y& A_z\cr} \right| . \end{equation} An analogous construction can be used in curvilinear coordinates; the results for spherical and cylindrical coordinates can be found here, as well as on the inside front of Griffiths' textbook, Introduction to Electrodynamics.
Stokes' Theorem
The total circulation of the magnetic field around a small loop is given by \begin{align} \hbox{circulation} = \sum_{\hbox{box}} \BB \cdot d\rr = (\grad\times\BB) \cdot d\AA \end{align} where $d\AA=\nn\,dA$, where $\nn$ is perpendicular to the (filled in) loop. But any surface can be filled with such loops, as shown on the left. Furthermore, the circulation around the edge of the surface is just the sum of the circulations around each of the smaller loops, since the circulation through any common side will be zero (because adjacent loops have opposite notions of “around”), as indicated schematically on the right Thus, the total circulation around any loop is given by \begin{align} \oint\limits_{\hbox{loop}} \BB \cdot d\rr = \Int_{\hbox{inside}} \!\! (\grad\times\BB) \cdot d\AA . \end{align} This is Stokes' Theorem.
There is no need for the “inside” of the loop to be planar. 2) Consider the surface shown on the right, which has the same boundary as the original loop. The circulation around interior loops cancels just as before, and Stokes' Theorem holds without modification. We like to describe such surfaces as “butterfly nets”, whose rim is the original loop. Butterfly nets should be able to catch butterflies! In other words, they need an opening, and a net. 3)
The orientations used in the two integrals in Stokes' Theorem must be compatible. This is easy if the loop lies in the $xy$-plane: Choose the circulation counterclockwise and the flux upward. More generally, for any loop which is more-or-less planar, the circulation should be counterclockwise when looking at the loop from “above”, that is, from the direction in which the flux is being taken. (So you're really looking in the direction of negative flux.) An easy way to remember this is to take the flux up and the circulation counterclockwise when seen from above, with obvious modifications should the loop be sideways.
But what if the loop is not planar? What about a cylinder which is closed at one end? There are several strategies which can be used to obtain compatible orientations.
- Gears: Break up the surface into small loops, which can be thought of as small gears. Choose an orientation of the surface, and look at the surface from “above”. As the gears turn counterclockwise, the edge of the surface also turns; use that orienation to compute the circulation.
- Toothpicks: Think of the surface as a rubber sheet. Move the rubber sheet so that it is taut across the loop. Choose a compatible orientation using the “up” and “counterclockwise” rule. Now imagine putting toothpicks in the surface on the “up” side only, and move the rubber sheet back to the original position. The direction of the toothpicks gives you the compatible orientation of the surface.
- Left-Hand Rule: Walk around the edge of the surface, with your head up. That is, face in the direction $\TT$, with your head in the direction $\nn$ (where $d\rr=\TT\,ds$ and $d\SS=\nn\,\dS$). In a compatible orientation, your left hand should point along the surface; if it doesn't, turn around (or stand on your head, but not both).
Visualizing Divergence and Curl
The Divergence Theorem says \begin{equation} \Int_{\hbox{box}} \FF \cdot d\SS = \Int_{\hbox{inside}} \grad\cdot\FF \> dV \end{equation} which tells us that \begin{equation} \grad\cdot\FF \approx \frac{\Int \FF \cdot d\SS}{\hbox{volume of box}} = \frac{\hbox{flux}}{\hbox{unit volume}} \end{equation} so that the divergence measures how much a vector field “points out” of a box. Similarly, Stokes' Theorem says \begin{equation} \oint\limits_{\hbox{loop}} \FF \cdot d\rr = \Int_{\hbox{inside}} (\grad\times\FF) \cdot d\SS \end{equation} which tells us that \begin{equation} (\grad\times\FF) \cdot \nn \approx \frac{\oint \FF \cdot d\rr}{\hbox{area of loop}} = \frac{\hbox{(oriented) circulation}}{\hbox{unit area}} \end{equation} so that the (orthogonal component of the) curl measures how much a vector field “goes around” a loop.
Can we use these ideas to investigate graphically the divergence and curl of a given vector field? Consider the two vector fields on either side. In each case, can you find the divergegence? The ($\zhat$-component of the) curl?
A natural place to start is at the origin. So draw a small box around the origin, as shown in the figures below. 4) Is there circulation around the loop? Is there flux across the loop?
These two figures help us determine the divergence and curl at the origin, but not elsewhere. The divergence is a function, and the curl is a vector field, so both can vary from point to point. We therefore need to examine loops which are not at the origin. It is useful to adapt the shape of our loop to the vector field under consideration. Both of our vector fields are better adapted to polar coordinates than to rectangular, so we use polar boxes. Can you determine the divergence and ($\zhat$-component of the) curl using the loops shown below? Imagine trying to do the same thing with a rectangular loop, or even a circular loop.
Finally, it is important to realize that not all vector fields which point away from the origin have divergence, and not all vector fields which go around the origin have curl. The final two examples below demonstrate this important principle; they have no divergence or curl away from the origin. These examples represent solutions of Maxwell's equations for electromagnetism. The figure on the left describes the electric field of an infinite charged wire; the figure on the right describes the magnetic field due to an infinite current-carrying wire (with current coming out of the page at the origin).
Second Derivatives
A conservative vector field is the gradient of some function, for example \begin{align} \EE = - \grad V . \end{align} But integrals of conservative vector fields are independent of path, so that evaluating the integral along two different paths between the same two points yields the same answer, as illustrated on the left. Combining two such paths into a closed loop changes the orientation of one path, as shown on the right, and the integrals now cancel; the integral of $\grad V$ around any closed loop vanishes. Using Stokes' Theorem, we therefore obtain \begin{equation} \Int_{\hbox{inside}} \!\! (\grad\times\grad V) \cdot d\AA = \oint\limits_{\hbox{loop}} \grad V \cdot d\rr = 0 . \qquad\quad \label{curlgrad} \end{equation} Equivalently, the Master Formula tells us how to evaluate the left-hand side of (\ref{curlgrad}), namely by evaluating the potential at the endpoints. Since both endpoints are the same, the integral must be zero. But since the left-hand side must vanish for any closed curve, the integrand must be identically zero. We have proved that \begin{align} \grad\times\grad V = \zero \end{align} for any function $V$.
A similar argument can be used to show that \begin{align} \grad\cdot(\grad\times\FF) = 0 \end{align} for any vector field $\FF$. Consider a closed surface. Cut it in half along some closed curve, as shown on the left Then each piece of the surface is a butterfly net with the same rim, as shown on the right (with the pieces separated for clarity). Applying Stokes' Theorem to each piece leads to the conclusion that the flux of the curl of $\FF$ upward through each piece must be the same, so that the flux up through the top cancels the flux downward through the bottom. This cancellation forces the flux of the curl of $\FF$ outward through the entire surface to vanish. Using the Divergence Theorem, we get \begin{align} \Int_{\hbox{inside}} \grad\cdot(\grad\times\FF) \, d\tau = \Int_{\hbox{surface}} (\grad\times\FF)\cdot d\AA = 0 . \end{align} This argument shows that the first integral is zero over any volume, forcing the integrand to vanish, as claimed.
The above identities can also be derived by direct computation, most easily done in rectangular coordinates. For instance, when calculating the curl of $\grad{V}$, each component will contain mixed second-order partial derivatives of $V$, for example: \begin{align} \grad\times\grad V = … + \left( \Partial{}{x}\Partial{V}{y} - \Partial{}{y}\Partial{V}{x} \right) \,\zhat . \end{align} But partial derivatives can be taken in any order, so the derivatives above cancel, thus proving the identity. Similar second-order derivatives arise when computing the divergence of $\grad\times\FF$, establishing the other identity.
One second derivative, the divergence of the gradient, occurs so often it has its own name and notation. It is called the Laplacian of the function $V$, and is written in any of the forms \begin{align} \triangle V = \nabla^2 V = \grad\cdot\grad V . \end{align} In rectangular coordinates, it is easy to compute \begin{align} \triangle V = \grad\cdot\grad V = \PARTIAL{V}{x} + \PARTIAL{V}{y} + \PARTIAL{V}{z} . \end{align}
Product Rules
We digress briefly to discuss product rules for vector derivatives.
All types of derivatives have product rules, all of which take the form
- The derivative of a product is the derivative of the first quantity times the second plus the first quantity times the derivative of the second.
For more complicated functions, the only trick is figuring out which derivative to take, and what multiplication to use! Here are the product rules for the various incarnations of the del operator: \begin{align} \grad(fg) &= (\grad f) \, g + f \, (\grad g) \\ \grad\cdot(f\GG) &= (\grad f) \cdot \GG + f \, (\grad\cdot\GG)\\ \grad\times(f\GG) &= (\grad f) \times \GG + f \, (\grad\times\GG) \end{align} Care must be taken with the order of the factors in the last of these rules, since the cross product is not commutative.
How do you prove these rules? The simplest way is to work out the components of both sides in rectangular coordinates, using the ordinary product rule for partial derivatives.