In a region of space the electric field is in the x-direction and proportional to x, i.e., . Consider an imaginary cubical volume of edge a with its edges parallel to the axes of coordinates. The charge inside this volume will be
Field at face ABCD =
Flux over the face ABCD
The negative sign arises as the field is directed into the cube.
Field at face EFGH
Flux over the face EFGH
Flux over the other four faces is zero as the field is parallel to the surfaces.
Total flux over the cube
Where q is the total charge under the cube