Gauss' theorem in electrostatics