Divergence theorem/Proof

Let $${\mathbf E}({\mathbf x})=[E_x(x,y,z), E_y(x,y,z), E_z(x,y,z)]$$ be a smooth (differentiable) three-component vector field on the three dimensional space and $$\nabla\cdot\mathbf{E}=\frac{\partial E_x}{\partial x} + \frac{\partial E_y}{\partial y} + \frac{\partial E_z}{\partial z}$$ is its divergence then the field divergence integral over the arbitrary three dimensional volume $$V$$ equals to the integral over the surface $$S$$ of the field itself projected onto the unite length vector field $$\mathbf{n}(\mathbf{x})$$ always perpendicular to the surface and pointing outside the surface which contains this volume or otherwise the inner values of the field divergence make virtually no contributions to the integral over the volume i.e,

$$\int_V \nabla\cdot\mathbf{E}\,\,dV=\int_S \mathbf{E} \cdot d \mathbf{S}$$

where $$d \mathbf{S}= \mathbf{n} dS $$ and the $$S$$ wraps the $$V$$.

Proof
We can approximate the integral of the divergence over the volume by the finite sum by dividing densely the space inside the volume $$V$$ into small cubes with the edges $$dx=dy=dz$$ and the corners $$[x_{i},y_{j},z_{k}]$$ as well as approximating three of the coordinate derivatives by their difference quotients. We will keep the edges coordinate names for the convenience even if they are equal. We get

$$\int_V \nabla\cdot\mathbf{E}\,\,dV=\sum_{i,j,k} \left [ \frac{E_x(x_{i+1},y_j,z_k) - E_x(x_i,y_j,z_k)}{dx}+\frac{E_y({x_i,y_{j+1},z_k}) - E_y(x_i,y_j,z_k)}{dy}+\frac{E_z(x_{i,j,k+1}) - E_z(x_{i,j,k})}{dz} \right ] dxdydz+ \Theta(dxdydz)$$

Let us focus on a single contribution to this sum related to the derivative with respect to a chosen coordinate for example $$x$$ i.e. for example $$\sum_{i,j,k}  \frac{E_x(x_{i+1},y_j,z_k) - E_x(x_i,y_j,z_k)}{dx} dxdydz$$. For a fixed $$j,k$$ we have

$$\sum_{i}\frac{E_x(x_{i+1},y_j,z_k) - E_x(x_i,y_j,z_k)}{dx} dxdydz= \sum_{i} [E_x(x_{i+1},y_j,z_k) - E_x(x_i,y_j,z_k)]dydz$$

Note now that because of the alternating signs the vast majority of terms in the right sum vanish and we have

$$\sum_{i} [E_x(x_{i+1},y_j,z_k) - E_x(x_i,y_j,z_k)]dydz=[E_x(x_{1},y_j,z_k) - E_x(x_0,y_j,z_k) + E_x(x_{2},y_j,z_k) - E_x(x_1,y_j,z_k) + ... + E_x(x_{n},y_j,z_k) - E_x(x_{n-1},y_j,z_k)]dy dz$$

which reduces only to two terms or

$$\sum_{i} [E_x(x_{i+1},y_j,z_k) - E_x(x_i,y_j,z_k)]dydz=[E_x(x_{n},y_j,z_k)-E_x(x_{1},y_j,z_k)]dy dz$$

where the bordering $$[x_{n},y_j,z_k]$$ and $$[x_{1},y_j,z_k]$$ with the first coordinate obviously depending on the choice of $$j$$ and $$k$$ are such that those points are the closed to the surface $$S$$ containing the volume $$V$$.

Also note that while $$dy dz$$ is an infinitesimal (small) element of the surface parallel to the $$y-z$$ plane and for the unite vector $$\mathbf{n}_x=[1,0,0]$$ perpendicular to it $$\mathbf{E} (x_{n},y_j,z_k) \cdot \mathbf{n}_x = E_x(x_{n},y_j,z_k)$$ and so for the second point the right side is an approximate to the growth $$\mathbf{E} \cdot d \mathbf{S}$$ of the surface integral $$\int_S \mathbf{E} \cdot d \mathbf{S}$$ i.e.

$$E_x(x_{n},y_j,z_k)dy dz = \mathbf{E} \cdot d \mathbf{S} + \Theta(dydz)$$,

$$-E_x(x_{1},y_j,z_k)]dy dz = \mathbf{E} \cdot d \mathbf{S} + \Theta(dydz)$$,

Repeating the estimate for the two other dimensions and coming back to the original sum we get

$$\int_V \nabla\cdot\mathbf{E}\,\,dV=\sum_{j,k} [E_x(x_{n_{j,k}},y_j,z_k)-E_x(x_{1_{j,k}},y_j,z_k)]dy dz + \sum_{i,k} [E_y(x_i,y_{n_{i,k}},z_k)-E_y(x_i,y_{1_{i,k}},z_k)]dx dz + \sum_{i,j} [E_z(x_i,y_j,z_{n_{i,j}})-E_z(x_i,y_j,z_{1_{i,j}})]dx dy+ \Theta(dxdydz)$$

so the right side is the approximate surface integral (sum over the surfaces of the cubes closest to the surface $$S$$) of the field itself projected on the outward unit vector field which proves the therem i.e.

$$\int_V \nabla\cdot\mathbf{E}\,\,dV=\int_S \mathbf{E} \cdot d \mathbf{S}$$.