Gausss law would be invalid if the inverse square law were n
Solution
Consider a point charge, a spherical shell around it at one radius, and another shell around it at a much larger radius. The flux density at the surfaces varies as the inverse of the square of the two radii. However, the area of the shells varies as the square of the radii, so that the total flux for both shells is the same. Thus, we have conservation of flux going into the space between them and coming out again. If, however, the elecrtic field varied inversely( other then square) (suppose as the cube of the radii), the amount of flux from the outer shell would total less than that through the inner shell, so that the divergence of the field (in places where charge is not) could no longer be zero, and flux would not be conserved. By the way, this sort of situation somewhat resembled that of the strong force inside atomic nuclei.
The validity of Gauss’ law depends upon the inverse square law of Coulomb. If the force law were not exactly the inverse square, it would not be true that the field inside a uniformly charged sphere would be exactly zero. For instance, if the force varied more rapidly, like, say, the inverse cube of r, that portion of the surface which is nearer to an interior point would produce a field which is larger than that which is farther away, resulting in a radial inward field for a positive surface charge. These conclusions suggest an elegant way of finding out whether the inverse square law is precisely correct. We need only determine whether or not the field inside of a uniformly charged spherical shell is precisely zero

