Divergence of a Vector Field
$$
Flux of a field across a curve
In this note it will be helpful to consider a vector field \(\mathbf{F}(x,y) = \left\langle P(x,y), Q(x,y)\right\rangle\) as a velocity field of a two-dimensional fluid flow.
Given such vector field \(\mathbf{F}\) and a smooth curve \(C\), we can ask what is the total volume1 of the fluid that crosses the curve from its left side to its right side during one time unit?
1 In two dimensions, volume is the same as area.
It will be easy to figure out in the case the curve is a line segment and the field is constant. The following diagram shows what happens then:
On the diagram2, the light blue area shows the amount of fluid that crosses the line segment \(C\) from left to right in one time unit. We can see that it is a parallelogram, and its area can be calculated as the product of the length of the curve \(C\) and the “height” of the parallelogram. This height is equal to the length of the projection of \(\mathbf{F}\) onto a unit normal vector \(\mathbf{N}\) pointing to the right side of the curve, relative to the direction of travel along the curve.
2 Note that this diagram is two-dimensional: everything on this picture is in the same plane!
In other words, the flux of the constant vector field \(\mathbf{F}\) across the line segment \(C\) of length \(L\) is equal to
\[L \operatorname{comp}_{\mathbf{N}} \mathbf{F} = L \frac{\mathbf{F}\cdot\mathbf{N}}{\left\lvert\mathbf{N} \right\rvert} = L \mathbf{F}\cdot \mathbf{N}\]
where \(\mathbf{N}\) is the unit normal vector to \(C\) pointing to the right side of \(C\) with respect to the direction of travel along \(C\).
General field and curve
Suppose now \(C\) is a smooth curve and \(\mathbf{F}\) is a continuous vector field defined at least on \(C\). We can make the usual intuitive calculus argument to derive the formula for the flux of \(\mathbf{F}\) across \(C\):
As always, we start by looking at a very tiny (possibly infinitesimal) piece of \(C\). Since \(C\) is smooth, each tiny piece of \(C\) is very close to a straight line segment. Let’s call the length of this tiny line segment \(ds\). Since \(\mathbf{F}\) is continuous, we can consider it almost constant when looking at a very tiny piece of the curve. We can no apply the previously derived formula to this tiny line segment and (almost) constant field \(\mathbf{F}\): the flux of \(\mathbf{F}\) across this tiny line segment is approximately \(\mathbf{F}\cdot\mathbf{N}\;ds\).
We can do this for every “point” of the curve \(C\), and add all the results together, to get the following flux integral3:
3 Here we are only barely scratching the surface of this concept. Your textbook has more details about flux integrals. We will come back to this concept later when talking about flux integrals across surfaces in \(\mathbb{R}^3\).
\[\int_C \mathbf{F}\cdot\mathbf{N}\;ds\]
where \(\mathbf{N}\) is the unit normal vector to \(C\) pointing to the right side of \(C\) with respect to the direction of travel along \(C\).
Simple closed curves
Suppose now that \(C\) is a positively oriented simple closed curve whose interior region is \(G\). Then \(\mathbf{N}\) points out away from \(G\) towards the exterior of \(C\), so the flux of a field \(\mathbf{F}\) across \(C\) is equal to the difference of the amount of fluid leaving \(G\) and the amount of fluid entering \(G\). If this number is positive, it means that the fluid is somehow expanding or being created inside \(G\), while if it is negative, the fluid is being compressed or annihilated inside \(G\).
If for any simple closed curve the flux is 0, we say that the field \(\mathbf{F}\) is incompressible.
This is kind of similar to the concept of conservativeness except that instead of circulation integrals we use flux integrals. For circulation, we were able to find a local measure of circulation: \(Q_x(x,y) - P_y(x,y)\), by looking at a circulation along a tiny rectangle. We can try the same strategy with flux.
Let’s calculate a flux integral of a vector field \(\mathbf{F} = \left\langle P, Q\right\rangle\) over a very very tiny rectangle centered at \((x_0,y_0)\), with sides of length \(dx\) and \(dy\). We will label the four sides of the rectangle as \(S_1\), \(S_2\), \(S_3\) and \(S_4\):
Then the flux integral of \(\mathbf{F}\) across the rectangle can be split into the sum of flux integrals over the four sides:
\[\int_{S_1} \mathbf{F}(x,y)\cdot \mathbf{N}_1\;ds + \int_{S_2} \mathbf{F}(x,y)\cdot \mathbf{N}_2\;ds + \int_{S_3} \mathbf{F}(x,y)\cdot \mathbf{N}_3\;ds + \int_{S_4} \mathbf{F}(x,y)\cdot \mathbf{N}_4\;ds \]
Plugging in the four normal vectors \(\mathbf{N}_1 = \left\langle 0,-1\right\rangle\), \(\mathbf{N}_2 = \left\langle 1,0\right\rangle\), \(\mathbf{N}_3 = \left\langle 0,1\right\rangle\) and \(\mathbf{N}_4 = \left\langle -1,0\right\rangle\) and calculating the dot products will give us
\[\int_{S_1} -Q(x,y)\;ds + \int_{S_2} P(x,y)\;ds + \int_{S_3} Q(x,y)\;ds + \int_{S_4} -P(x,y)\;ds\]
Pulling the minus signs out of the integrals and changing the order will give us
\[\int_{S_3} Q(x,y)\;ds - \int_{S_1} Q(x,y)\;ds + \int_{S_2} P(x,y)\;ds - \int_{S_4} P(x,y)\;ds\]
When the rectangle is very small, we can approximate each of the integrals by the value in the middle of the segment times the length of the segment:
\[Q\left(x_0, y_0 + \frac{dy}{2}\right)\;dx - Q\left(x_0, y_0 - \frac{dy}{2}\right)\;dx + P\left(x_0 + \frac{dx}{2}, y_0\right)\;dy - P\left(x_0 - \frac{dx}{2}, y_0\right)\;dy\]
Then \(Q\left(x_0, y_0 + \frac{dy}{2}\right) - Q\left(x_0, y_0 - \frac{dy}{2}\right)\) can be approximated by \(Q_y(x_0, y_0)\;dy\) and \(P\left(x_0 + \frac{dx}{2}, y_0\right) - P\left(x_0 - \frac{dx}{2}, y_0\right)\) can be approximated by \(P_x(x_0, y_0)\;dx\).
Altogether, the flux across the tiny rectangle is approximately equal to
\[\left(P_x(x_0, y_0) + Q_y(x_0, y_0)\right)\;dx\;dy\]
This is very similar to the expression for local circulation along the tiny rectangle, which was
\[\left(Q_x(x_0, y_0) - P_y(x_0, y_0)\right)\;dx\;dy\]
Notice that for the circulation, we had the derivative of the second component with respect to the first variable minus the derivative of the first component with respect to the second variable.
For flux, we have the derivative of the first component with respect to the first variable plus the derivative of the second component with respect to the second variable.
Divergence
Given a vector field \(\mathbf{F}(x,y) = \left\langle P(x,y), Q(x,y)\right\rangle\), the (scalar) function \[P_x(x, y) + Q_y(x, y)\] is called the divergence function of the field \(\mathbf{F}\), and is denoted as \(\operatorname{div}\mathbf{F}\).
This can be naturally extended to three (or, in fact, any number of) dimensions: given \[\mathbf{F}(x,y,z) = \left\langle P(x,y,z), Q(x,y,z), R(x,y,z)\right\rangle\] the divergence of \(\mathbf{F}\) is defined as \[\operatorname{div}\mathbf{F}(x,y,z) = P_x(x,y,z) + Q_y(x,y,z) + R_z(x,y,z).\]