Electrostatics – Is Gauss’s Law Wrong, or Does $\int_s{\vec E} \cdot d\vec{s}=0$ Not Always Imply $\vec E = 0$?

electric-fieldselectrostaticsgauss-lawhomework-and-exercisespotential

This is a question from David J Griffith's Introduction to Electrodynamics.

A specified charge density $$\sigma(\theta)=k\cos(\theta)$$ is glued over the surface of a spherical shell of radius $$R$$. Find the resulting potential inside and outside the sphere.

The question was solved using legendre polynomials and the final answer for potential inside the sphere was :
$$V(r,\theta) = \frac{kr}{3\epsilon_0}cos\theta$$

This final answer is confusing because The Electric field inside the sphere is coming out to be dependent on $$r$$ and $$\theta$$ whereas electric field inside a shell, no matter what the charge distribution is outside, is $$zero$$ from gauss's law.

my doubts:

1. why is the electric field inside non zero?

2. Can gauss's law explain this, or does it fail here?

Since solving using ordinary surface integral gave me the same result and since the. divergence inside the shell is $$zero$$, I concluded that legendre polynomials and gauss's law in differential form are correct. So the problem should be with the integral form of gauss's law : $$\int_s{\vec E}.d\vec{s} = \frac{q}{\epsilon_0}$$

The answer I got for this doubt is that
"since the charges are glued to the surface, and not evenly distributed, electric field inside need not be zero. "

This is not convincing because proof of gauss's law does not expect the charges to be free to move. presence of an exrernal force that would hold the charges in place does not change the theorem. That is
Say only a single charge $$q_i$$ is present outside

then $$\int_s{\vec E_i}.d\vec{s} = \frac{q_{inside}}{\epsilon_0}=0$$

Now if there are more charges, following any distribution, net electric field $$\vec E = \vec E_1 + \vec E_2+\vec E_3+…$$

So the net flux,

$$\int_s{\vec E}.d\vec{s} = \int_s{\vec E_1}.d\vec{s}+\int_s{\vec E_2}.d\vec{s}+\int_s{\vec E_3}.d\vec{s}+. . .=0$$

Or is it possible that $$\int_s{\vec E}.d\vec{s}=0$$ does not imply $$\vec E = 0$$?

You need to be careful here. Gaussâ€™ law is always true, but it is not always possible to use it to infer the electric field. The crucial step is \begin{align} \oint \vec E\cdot d\vec S=\vert\vec E\vert S \tag{1} \end{align} which only holds if the field has constant magnitude on the Gaussian surface and is perpendicular to the surface where it intersects.
Thus for instance, if you place a charge outside a box and compute $$\oint \vec E\cdot d\vec S$$ on the surface bounding the box, this integral is $$0$$ because there is no net charge enclosed, but this does NOT mean $$\vec E=0$$ inside the box as (1) does not hold: by simple geometry the field does not have the same magnitude at every point on the surface of the box.
In other words, yes it is perfectly possible to have $$0$$ net flux $$\oint \vec E\cdot d\vec S=0$$ but $$\vec E\ne 0$$.
A similar situation occurs when a charge distribution does not have a particular symmetry: it becomes very difficult to find a surface on which the magnitude of $$\vec E$$ is constant and thus use (1) to deduce the field.