# Gauss law in non-uniform electric field

I am trying to figure out how gauss law would hold in an electric field configuration that varies with space. For simplicity, let us assume the classic XYZ coordinate system. Consider an electric field along the x axis that varies a follows E(x,y,z) = K/(x^2), (similar to the coloumbs inverse square law.) and assume the field vector to be along the positive direction of the X axis, the field lines are parallel and equally spaced, assumed to come from a very large distance.

Now, for simplicity, suppose I choose a cube of side a, whose center lies on the X axis, let us say at some point x= A. With this cube as my Gaussian surface, and with the given configuration of the electric field, my calculations are as follows (using the integral form of gauss law):

1. The only two planes that would contribute to the flux are the ones parallel to the YZ plane. Let P1 and P2 be the planes. If the electric field at P1 is E1, the flux of it will be E1A. Similarly the flux through P2 will be -E2A (assuming the direction of area vector). The area of the surfaces being the same, the field clearly is different at P1 and P2, because the two planes are seperated by a distance = a.

2. Thus if E1 = K/(x^2) then E2 must be K/(x±a)^2.

How can in this case the flux be equal to zero? Please point out if I have any mistakes in my math, or if my analysis is wrong anywhere.

The statements.

Consider an electric field along the x axis that varies as follows E(x,y,z) = K/(x^2)

and

assume the field vector to be along the positive direction of the X axis, the field lines are parallel and equally spaced, assumed to come from a very large distance

cannot be simultaneously true.

In effect you have proved that with your evaluation of the electric flux through the opposite faces of a cube and showing it to be different.

If the electric field lines are parallel then the electric field is uniform and hence cannot depend on position $x$.

• Yeah, it's a good explanation. Thanks. But is there a way to mathematically show that the flux is zero using the integral form of gauss law? I mean, by claclulating the integrals of E over the two planes? – user148898 May 17 '18 at 13:13
• The net flux through the two faces will only be zero if the electric field is uniform. – Farcher May 17 '18 at 13:16
• So if I take an arbitrary closed surface in the vicinity of a point charge, is gauss law inapplicable? – user148898 May 17 '18 at 13:17
• No, you can use Gauss’s law and the net flux though all the faces will be zero, not just the two “end” ones. – Farcher May 17 '18 at 13:21
• I understand it now. Can you point me to some references where I can find a mathematical treatment for this... Like how do I use the basic statement of the integral form, and then calculate the net flux through the whole surface, in cases like the configuration I mentioned? – user148898 May 17 '18 at 13:24