# Where is the flaw in deriving Gauss's law in its differential form?

From the divergence theorem for any vector field E,

$\displaystyle\oint E\cdot da=\int (\nabla\cdot E) ~d\tau$

and from Gauss's law

$\displaystyle\oint E\cdot da=\frac{Q_{enclosed}}{\epsilon_0}=\int \frac{\rho}{\epsilon_0}~d\tau$

Hence,

$\displaystyle\int\frac{\rho}{\epsilon_0}d\tau=\int (\nabla\cdot E)~d\tau$

Textbooks conclude from the last equation that

$\displaystyle \nabla\cdot E=\frac{\rho}{\epsilon_0}$

My question is how can we conclude that the integrands are the same? Because I can think of the following counter example, assume

$\displaystyle \int_{-a}^a f(x)~dx=\displaystyle \int_{-a}^a [f(x)+g(x)]~dx$

where $g(x)$ is an odd function. Obviously the 2 integrals are equal but we cannot conclude that $f(x)$ is equal to $f(x)+g(x)$ so where is the flaw?

## 2 Answers

The equation $$\displaystyle\int_{V}\frac{\rho}{\epsilon_0}d\tau=\int_{V}(\nabla\cdot E)~d\tau$$ is true for all region $V$ in space the integration is performed over. That is why it follows that the integrands are equal. Your counterexample is invalid, because the integrals are equal only when the domain of integration is of the form $[-a,a]$.

Your counterexample is obviously correct: it is not at all true that, if the integral of a function is the same as that of another function, then the two function coincide.

To mathematically prove the differential form of Gauss' law, if you choose the domain of integration as a paralellepiped $P$ whose sides are $[x_0,x_0+h_x]$, $[y_0,y_0+h_y]$ and $[z_0,z_0+h_z]$ and call $\|h\|=\sqrt{h_x^2+h_y^2+h_z^2}$ the length of the diagonal, by applying what is said here, you can see that$$\lim_{\substack{h\to 0\\h_xh_yh_z\ne 0}}\frac{1}{h_xh_yh_z}\int_{x_0}^{x_0+h_x}\int_{y_0}^{y_0+h_y}\int_{z_0}^{z_0+h_z}\frac{\rho(x,y,z)}{\varepsilon_0}dxdydz=\frac{\rho(x_0,y_0,z_0)}{\varepsilon_0}$$and$$\lim_{\substack{h\to 0\\h_xh_yh_z\ne 0}}\frac{1}{h_xh_yh_z}\int_{x_0}^{x_0+h_x}\int_{y_0}^{y_0+h_y}\int_{z_0}^{z_0+h_z}(\nabla\cdot E)(x,y,z)dxdydz=(\nabla\cdot E)(x_0,y_0,z_0)$$Therefore, since $$\int_{x_0}^{x_0+h_x}\int_{y_0}^{y_0+h_y}\int_{z_0}^{z_0+h_z}\frac{\rho(x,y,z)}{\varepsilon_0}dxdydz$$$$=\int_{x_0}^{x_0+h_x}\int_{y_0}^{y_0+h_y}\int_{z_0}^{z_0+h_z}(\nabla\cdot E)(x,y,z)dxdydz$$you have the thesis.