You can use $q/\epsilon_0$ to calculate flux for both cases because that's what Gauss' law says: Just look at the enclosed charge. It's amazing.
Flux for any closed surface is $\Phi = \oint \vec{E} \cdot d\vec{A}$. There are two ways to calculate this quantity:
- The hard way, which means evaluating $\vec{E}$ on every part of the surface, and integrating. This is hard because for your case 2, the electric field strength varies on the surface and it is not normal everywhere. When computed in this manner, it is not obvious at all that your two cases should yield the same value for flux. It really isn't obvious.
- The easy way, which is using Gauss' law $\Phi = Q_\text{encl}/\epsilon_0$. To evaluate flux using Gauss' law, you only need to look at how much charge how is physically enclosed. That's what Gauss' law says. That's why Gauss' law gives the same answer in both cases. It makes no mention of the particular geometry of your closed surface and does not assume that the electric field is normal to the surface.
There are proofs of Gauss' law floating around, but I don't think you are asking for that.
As a side note, one often uses Gauss' law to figure out what the electric field is. Case 1 is very useful for figuring out the electric field at some distance away from your charge. Case 2 is not useful since you can't factor out $\vec{E}$ from the integral. Nonetheless, both cases yield the same value for flux.
Yes, for any closed Gaussian surface (including irregular surfaces), this law holds.
But we consider only symmetrical surfaces (sphere, cylinder, etc.) in academics as it is easy for performing the integration.
Let us consider the example which you have given:
Black dot represents a point charge.
Here, in order to find the net flux through the surface you must integrate each
E.dA, which is not so easy. The advantage with symmetry is that E is always constant, and dA is always perpendicular to the surface so that you may integrate easily. Even in this case, if you integrate E.dA, you will end up with the same result.
Gauss law even applies for irregular surfaces :
The only problem is to integrate. You would have the same result.
How to think without mathematics :
As we know, flux is the measure of number of lines of electric field passing through the Gaussian surface. Even if you move the charge anywhere within the surface, the number of field lines won't change, right?
All the Gauss laws(of electrostatics, magnetism, gravitation), field vectors, inverse square laws can be derived from the GAUSS LAW OF DIVERGENCE.
It's so exciting!!!
Best Answer
The problem here is that you've failed to specify a boundary condition.
In an electrostatics problem where you're given a charge distribution $\rho(\mathbf{r})$ and asked to find the electric field $\mathbf{E}(\mathbf{r})$, the answer is the solution to the set of differential equations $$\nabla \times \mathbf{E} = 0, \quad \nabla \cdot \mathbf{E} = \rho/\epsilon_0.$$ To get a unique solution to a differential equation, you have to specify a boundary condition. Usually, that condition is "the field is zero at infinity".
In this situation, the usual boundary condition doesn't work because the charge distribution is also infinite. To find the electric field, you must specify a boundary condition. Otherwise, the solution is just as ambiguous as trying to solve $F = ma$ without an initial position or velocity.
Once you do that, the symmetry will be broken, making your "$\mathbf{E}$ is symmetric so must be zero" argument fail. For example, one solution is $\mathbf{E}(\mathbf{r}) = kx \hat{i}$ for some value of $k$. You can check it satisfies Gauss's law. The boundary condition is "the field looks like $kx\hat{i}$ at infinity", which is not symmetric.
This issue is subtle: it also comes up when considering gravitational fields in an infinite uniform universe. Newton made the same mistake, thinking that $\mathbf{g}$ had to vanish everywhere by symmetry.