Gauss' law in the presence of surface charges Assume $V$ is a volume such that $\rho=0$ in $V$ where $\rho$ is the charge density. Assume further that we have a surface charge density $\sigma$ on the surface $S$ enclosing $V$ such that the total charge $Q_S$ on the surface is $\neq 0$. If we assume that $S$ is an equipotential surface (a conductor), we have the formula
$$\vec{E} =\frac{\sigma}{\epsilon_0}\vec{n} \ \ \text{on }S$$
where $\vec{E}$ is the electric field and $\vec{n}$ the unit normal.
But now, if I apply Gauss' law to this situation, I get this:
$$0=\frac{1}{\epsilon_0}\int_V \rho d^3x=\int_{S} (\vec{E} \cdot \vec{n}) da=\int_S \frac{\sigma}{\epsilon_0} da=\frac{Q_S}{\epsilon_0}\neq 0$$
What is the mistake in this reasoning or overall setting?
 A: There are two ways of explaining this. First is that if you're considering a charge density which is concentrated on a surface, then the electric field $\mathbf{E}$ does not satisfy the hypotheses of Gauss' divergence theorem (being continuously differentiable), because if you assume $\mathbf{E}$ is continuously differentiable, then by Maxwell, $\nabla\cdot\mathbf{E}=\frac{\rho}{\epsilon_0}$ everywhere, so if $\mathbf{E}$ is $C^1$ then the divergence is continuous so $\rho$ is continuous, so if it vanishes away from the surface, then by continuity it must vanish on the surface as well, i.e no surface charges. Therefore, you cannot invoke the theorem, so your second equality is not justified.
Alternatively, if you insist on pushing the applicability of the divergence theorem beyond the classical hypotheses, then you have to treat things distributionally. So, you can't say $\rho=0$ and thus the first (left) integral is zero. You have to say $\rho=0$ away from the surface, but at the surface, the density is modelled by some Dirac-delta, which therefore gives a non-zero contribution.
