Solution (source code)

= Solution

Let $\mathbf F=(F_x,F_y,F_z)$ be continuously differentiable near $P$. Take a small axis-aligned rectangular volume around $P$, with side lengths $\Delta x,\Delta y,\Delta z$ shrinking with bounded aspect ratios. The outward <flux> through its two $x$ faces is, to leading order,
$$
\bigl[F_x(x+\Delta x/2,y,z)-F_x(x-\Delta x/2,y,z)\bigr]\Delta y\Delta z
=\frac{\partial F_x}{\partial x}(P)\,\Delta x\Delta y\Delta z+o(\Delta V),
$$
where $\Delta V=\Delta x\Delta y\Delta z$. The analogous face pairs give $\partial F_y/\partial y$ and $\partial F_z/\partial z$. Dividing total <flux> by $\Delta V$ and taking the limit gives
$$
\boxed{\nabla\cdot\mathbf F=\frac{\partial F_x}{\partial x}+\frac{\partial F_y}{\partial y}+\frac{\partial F_z}{\partial z}.}
$$
The <divergence> is thus the local outward <flux> per unit volume; the symbols on the right are Cartesian <partial derivatives>.

For a bounded volume $V$ with piecewise smooth closed boundary $S$, subdivide into small cells. Each internal face occurs twice with opposite <normal vectors>, so its <flux> cancels. The remaining sum is the exterior <surface integral>; the cell sums of $(\nabla\cdot\mathbf F)\Delta V$ converge to the <volume integral>. Assuming continuous first <partial derivatives> on a neighborhood of the closure of $V$, this proves the <divergence theorem>:
$$
\boxed{\oiint_S\mathbf F\cdot\mathbf n\,dS=\iiint_V\nabla\cdot\mathbf F\,dV.}
$$
The unit <normal vector> $\mathbf n$ points out of $V$. Multiple boundary components are allowed; at a cavity wall it points into the cavity.