Tutorials › Calculus III › Checking Box Flux by Direct and Divergence Methods

Flux and Circulation Applications · Tutorial 983 of 999

Checking Box Flux by Direct and Divergence Methods

Learn to calculate box flux face by face, use divergence to evaluate the same flux, and check that both methods agree.

Advanced 11 min read

What You'll Learn

  • Set up outward normals and surface integrals on all six faces of a rectangular box.
  • Compute polynomial vector-field flux directly, including contributions that cancel.
  • Evaluate divergence and integrate it over the box.
  • Derive the agreement between the two methods for a box.
  • Detect how an incorrect face normal changes the total flux.

Two Ways to Check Flux Across a Box

A rectangular box is a useful setting for checking a flux calculation. Its six faces have simple outward normals, so the surface integral can be computed face by face. The same box also makes the divergence integral straightforward: integrate the divergence over the three coordinate intervals.

These are two calculations of the same outward flux. Comparing them is more than an arithmetic check: it shows how the contributions from opposite faces correspond to changes in the vector field across the box. In what follows, the fields are polynomial, so their components and first partial derivatives are continuous everywhere.

Box Flux and Divergence

Let \(B=[a,b]\times[c,d]\times[e,f]\), where \(a<b\), \(c<d\), and \(e<f\). Write a vector field as \(\mathbf{F}=(P,Q,R)\), with component functions \(P,Q,R\). The boundary \(\partial B\) consists of six faces. Each face is oriented using its outward unit normal: respectively, \(\mathbf{i}\) at \(x=b\), \(-\mathbf{i}\) at \(x=a\), \(\mathbf{j}\) at \(y=d\), \(-\mathbf{j}\) at \(y=c\), \(\mathbf{k}\) at \(z=f\), and \(-\mathbf{k}\) at \(z=e\).

Definition: The outward flux of \(\mathbf{F}\) across the box boundary is the sum of its flux integrals across the six faces. The divergence of \(\mathbf{F}=(P,Q,R)\) is \(\nabla\cdot\mathbf{F}=P_x+Q_y+R_z\).

For example, the two \(x\)-face contributions are obtained by integrating \(P\) at \(x=b\) and \(-P\) at \(x=a\) over the \(yz\)-rectangle. The negative sign on the lower-\(x\) face is essential: its outward normal points in the negative \(x\)-direction. The other two pairs follow the same pattern.

$$ \begin{aligned} \iint_{\partial B}\mathbf{F}\cdot\mathbf{n}\,dS ={}&\int_c^d\int_e^f\bigl(P(b,y,z)-P(a,y,z)\bigr)\,dz\,dy\\ &+\int_a^b\int_e^f\bigl(Q(x,d,z)-Q(x,c,z)\bigr)\,dz\,dx\\ &+\int_a^b\int_c^d\bigl(R(x,y,f)-R(x,y,e)\bigr)\,dy\,dx. \end{aligned} $$

Here \(\mathbf{n}\) denotes the outward unit normal on each face. The expressions are simply the six surface integrals grouped into three opposing pairs. In each pair, the value on the face with positive coordinate normal is subtracted by the value on the face with negative coordinate normal.

Why the Two Calculations Agree on a Box

The equality between the face calculation and the divergence integral follows directly from the one-variable Fundamental Theorem of Calculus applied in each coordinate direction. This argument also explains why the differences of component values on opposite faces appear in the direct calculation.

Theorem: If \(\mathbf{F}=(P,Q,R)\) has continuous first partial derivatives on a region containing \(B\), then its outward flux across the box is the integral of its divergence over the box.
1
Apply the Fundamental Theorem in the \(x\)-direction.
For each fixed \(y,z\), \(P(b,y,z)-P(a,y,z)=\int_a^b P_x(x,y,z)\,dx\). Integrating over the \(yz\)-rectangle turns the \(x\)-face pair into the volume integral of \(P_x\).
2
Apply it in the \(y\)-direction.
For each fixed \(x,z\), \(Q(x,d,z)-Q(x,c,z)=\int_c^d Q_y(x,y,z)\,dy\). Integrating over the remaining coordinates gives the volume integral of \(Q_y\).
3
Apply it in the \(z\)-direction and add.
The \(z\)-face pair becomes the volume integral of \(R_z\). Adding the three contributions gives the integral of \(P_x+Q_y+R_z\) over \(B\).

More explicitly, continuity allows the iterated integrals to be written as integrals over the same box. Thus the three face-pair terms add to

$$ \iiint_B P_x\,dV+\iiint_B Q_y\,dV+\iiint_B R_z\,dV =\iiint_B \nabla\cdot\mathbf{F}\,dV. $$

This proves the stated result for the box. The conditions matter: the component derivatives must be continuous on a region containing the box for this argument to apply. Polynomial vector fields satisfy that condition automatically.

Worked Example: A Box with Unequal Side Lengths

Worked Example: Computing All Six Face Contributions

Let \(B=[0,2]\times[-1,1]\times[0,3]\) and \(\mathbf{F}=(x^2+y,\,2yz+x,\,3z^2-x)\). We first integrate over each face, retaining the outward sign.

Faces \(x=2\) and \(x=0\): At \(x=2\), the outward component is \(P(2,y,z)=4+y\), so the flux is \(\int_{-1}^{1}\int_0^3(4+y)\,dz\,dy=24\). At \(x=0\), the outward component is \(-P(0,y,z)=-y\), so the flux is \(\int_{-1}^{1}\int_0^3(-y)\,dz\,dy=0\). The \(x\)-face pair contributes \(24\).

Faces \(y=1\) and \(y=-1\): At \(y=1\), the outward component is \(Q(x,1,z)=2z+x\). Its integral is \(\int_0^2\int_0^3(2z+x)\,dz\,dx=\int_0^2(9+3x)\,dx=18+6=24\). At \(y=-1\), the outward component is \(-Q(x,-1,z)=2z-x\). Its integral is \(\int_0^2\int_0^3(2z-x)\,dz\,dx=\int_0^2(9-3x)\,dx=18-6=12\). The \(y\)-face pair contributes \(36\).

Faces \(z=3\) and \(z=0\): At \(z=3\), the outward component is \(R(x,y,3)=27-x\). The flux is \(\int_0^2\int_{-1}^{1}(27-x)\,dy\,dx=2\int_0^2(27-x)\,dx=2(54-2)=104\). At \(z=0\), the outward component is \(-R(x,y,0)=x\), giving \(\int_0^2\int_{-1}^{1}x\,dy\,dx=2\int_0^2x\,dx=4\). The \(z\)-face pair contributes \(108\).

The total direct flux is \(24+36+108=168\). Now compute the divergence: \(\nabla\cdot\mathbf{F}=2x+2z+6z=2x+8z\). Therefore

$$ \begin{aligned} \iiint_B(2x+8z)\,dV &=\left(\int_0^2 2x\,dx\right)(2)(3) +(2)(2)\left(\int_0^3 8z\,dz\right)\\ &=4\cdot6+4\cdot36\\ &=24+144=168. \end{aligned} $$

The two methods agree. Substituting the face contributions back into the boundary sum gives \(24+36+108=168\), matching the divergence integral.

Worked Example: Cross Terms and Cancellation

Worked Example: A Symmetric Interval in One Coordinate

Let \(B=[-1,1]\times[0,1]\times[0,2]\) and \(\mathbf{F}=(x^2+yz,\,y^2+xz,\,z^2+xy)\). Cross terms in the components will cancel on some opposite faces, so it is useful to keep the individual face values visible.

Faces \(x=1\) and \(x=-1\): At \(x=1\), \(P=1+yz\), and the outward flux is \(\int_0^1\int_0^2(1+yz)\,dz\,dy=2+1=3\), since \(\int_0^1 y\,dy\int_0^2 z\,dz=(1/2)(2)=1\). At \(x=-1\), \(P=1+yz\) also, but the outward component is \(-P\), so its integral is \(-3\). The pair contributes \(0\).

Faces \(y=1\) and \(y=0\): At \(y=1\), the outward component is \(Q=1+xz\). Its integral over \(x\in[-1,1]\), \(z\in[0,2]\) is \(4+0=4\), because the integral of \(xz\) vanishes over the symmetric \(x\)-interval. At \(y=0\), the outward component is \(-Q=-xz\), whose integral is \(0\) for the same reason. The pair contributes \(4\).

Faces \(z=2\) and \(z=0\): At \(z=2\), the outward component is \(R=4+xy\). The integral of the constant \(4\) over the face is \(4\cdot(2\cdot1)=8\), and the integral of \(xy\) is zero because \(\int_{-1}^1x\,dx=0\). At \(z=0\), the outward component is \(-R=-xy\), whose integral is also zero. The pair contributes \(8\).

The total direct flux is \(0+4+8=12\). The divergence is \(\nabla\cdot\mathbf{F}=2x+2y+2z\). Its integral is

$$ \begin{aligned} \iiint_B(2x+2y+2z)\,dV &=0+ \left(\int_0^1 2y\,dy\right)(2)(2) +\left(\int_0^2 2z\,dz\right)(2)(1)\\ &=0+1\cdot4+4\cdot2\\ &=12. \end{aligned} $$

Here the \(2x\) contribution vanishes by symmetry, just as the corresponding \(x\)-dependent terms cancel in the face calculation. The result checks: both methods give \(12\).

Worked Example: A Short Independent Check

Worked Example: A Product Field on a Unit-Sized Box

Take \(B=[0,1]\times[0,2]\times[0,1]\) and \(\mathbf{F}=(xy,yz,zx)\). On \(x=1\), the outward component is \(y\), whose integral is \(\int_0^2\int_0^1 y\,dz\,dy=2\); on \(x=0\), it is zero. The \(x\)-pair contributes \(2\).

On \(y=2\), the outward component is \(2z\), whose integral is \(\int_0^1\int_0^1 2z\,dz\,dx=1\); on \(y=0\), it is zero. The \(y\)-pair contributes \(1\). On \(z=1\), the outward component is \(x\), whose integral is \(\int_0^1\int_0^2 x\,dy\,dx=1\); on \(z=0\), it is zero. The \(z\)-pair contributes \(1\). Thus direct flux is \(2+1+1=4\).

The divergence is \(y+z+x\). Integrating the three terms separately gives \(2\), \(1\), and \(1\), respectively: \(\int_0^2 y\,dy=2\); \(\int_0^1 z\,dz\) multiplied by the other side lengths gives \((1/2)(1)(2)=1\); and \(\int_0^1x\,dx\) multiplied by the other side lengths gives \((1/2)(2)(1)=1\). The divergence integral is \(4\), agreeing with the face sum.

A Common Sign Error

The most common mistake in a direct box calculation is using the wrong direction for one of the face normals. Consider the \(x=-1\) face in the second example. Its component is \(P=1+yz\), and its outward normal is \(-\mathbf{i}\). Its flux is therefore \(\int -P\,dS=-3\), not \(+3\). If the normal is mistakenly taken as \(+\mathbf{i}\), the total would be reported as \(3+3+4+8=18\) instead of \(12\). The divergence integral still gives \(12\), exposing the sign error.

Takeaway: On each lower-coordinate face, use the negative component in the outward flux integral. Pairing opposite faces is a useful check, but it does not remove the need to assign each face its correct outward normal.

Why This Comparison Is Useful

For a box and a smooth polynomial field, direct integration is often manageable because each face is a rectangle and each normal is constant. The divergence integral is often shorter when the divergence is simple. Computing both can reveal a missed face, a reversed normal, an incorrect bound, or an integration error.

The calculations also show what divergence measures in this setting. For each coordinate, the corresponding pair of face fluxes records the net change in one component between the two ends of that coordinate interval. The Fundamental Theorem converts that change into the integral of the component’s partial derivative. Adding the three directional changes produces the total outward flux.

Check Your Understanding

Use the face orientations and box identity from this tutorial to answer the following questions.

  1. What is the outward unit normal on the face \(y=c\) of a box?
  2. Why does the \(x\)-face pair involve \(P(b,y,z)-P(a,y,z)\)?
  3. For \(\mathbf{F}=(x^2,y^2,z^2)\) on \([0,1]^3\), what is the divergence?
  4. When applying the box flux identity, what regularity condition on the vector field is sufficient?
  5. How can comparing direct face flux with the divergence integral help detect a sign error?