# 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?

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]$.
• let me take the RHS integral to LHS to get $\displaystyle\int_{V}\frac{\rho}{\epsilon_0} -(\nabla\cdot E)~d\tau$ = 0 for every region V in space. does that mean the integrand has to be zero? I dont think so. Thomae's function has its Reimann integral zero everywhere in the region it is defined. yet the function is non zero at countably infinite points. Even dirichlet function gives zero general integration everywhere. Apr 27 at 12:04
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.