# Gauss' law and external electric flux through a cube: net flux is not zero while the interior charge is 0. What have I done wrong?

Consider a cube with side length $L$ and with its sides parallel to the basis vectors $\vec{i}$, $\vec{j}$ and $\vec{k}$. The $X$ axis goes right through the center of two of its faces. The closest face is at a distance $d$ from the origin. Consider an electric field given as follows, parallel to $\vec{i}$: $$\vec{E}=\frac{1}{x}\,\vec{i}$$

Consider the distance $d$ to the origin and the sidelength $L$ of the cube to be such that we don't have to worry about the singularity at $x=0$.

Now consider the flux through this cube.

$$\Phi=\int\vec{E}\cdot d\vec{S}=\frac{Q_{int}}{\epsilon_0}$$

The area vector is perpendicular to the field at four of the cube's sides by construction, so we only have to worry about the flux through the faces pointing in the $-\vec{i}$ and $\vec{i}$ directions, both of whose area ($S$) is equal to $L^2$. The value of the electric field is different at both though, since it depends on the distance to the origin along the $X$ axis, $x$. With this in mind:

$$\Phi=\frac{1}{d}L^2\vec{i}\,\cdot(-\vec{i})+\frac{1}{d+L}L^2\,\vec{i}\cdot\vec{i}=L^2\left(\frac{1}{d+L}-\frac{1}{d}\right)\neq 0$$

The charge enclosed in the interior of the cube is $0$ but the net flux is not, so there appears to be some conflict with Gauss' law. Where have I gone astray?

• How do you conclude that the internal charge is zero? I think, in order to generate the field $\vec E$ there should be some charge distribution inside the cube. Jun 18, 2015 at 18:45
• It depends on how the field looks like, for example an electromagnetic wave propagates through vacuum, that is, there is no charge necessary to generate it, at least with fitting boundary conditions. But for a static electric field with non-zero divergence, there should be some charge distribution, since, according to one of the Maxwell equations, $\vec\nabla\cdot\vec E\sim \rho$. For the given field configuration, you explicitly calculated that the internal charge is non-zero, which means that it is actually non-zero. Jun 18, 2015 at 19:00
I think, in order to generate the field $E$ there should be some charge distribution inside the cube. For example an electromagnetic wave propagates through vacuum, that is, there is no charge necessary to generate it, at least with fitting boundary conditions. But for a static electric field with non-zero divergence, there should be some charge distribution, since, according to one of the Maxwell equations, $\vec\nabla\cdot\vec E\sim \rho$. For the given field configuration, you explicitly calculated that the internal charge is non-zero, which means that it is actually non-zero.