Finding direction of field when using Gauss law I have seen this stack question Applying Gauss' Law to find Electric Field but I got confused when I saw the comment and the answer because, clearly the flux is a scalar quantity (due to dot product). So after using Gauss law to find magnitude, how do I find the direction in which the field vector points?
 A: You're right! While Gauss's law always holds true, it is precisely for this reason that it isn't always useful to calculate the Electric Field. It is only useful when the problem possesses some symmetries that greatly simplify it.
In general, before you start using Gauss's Law you must first enumerate the symmetries of the problem. The trick is to begin by guessing an ansatz for the Electric Field using the symmetries of the charge configuration. You can then choose a Gaussian surface over which (by symmetry) the field is assumed to be constant, such that the flux integral simplifies to a product or a sum of products. This then gives you the magnitude of the field and coupled with your symmetry argument, you can get its direction as well.
For example, when you have a spherically symmetric charge distribution, you can argue that the Electric Field cannot depend on the $\theta$ or $\phi$ coordinates or directions, since the field must be the same no matter from which orientation you're looking at the distribution. From this, you can argue that: $$\mathbf{E} = E(r) \hat{r}.$$
Using a spherical Gaussian surface which has an infinitesimal area $\mathbf{\text{d}A} = r^2 \sin\theta \text{d}\theta \text{d}\phi\,\,\, \hat{r},$ you can see that $$\int_S \mathbf{E\cdot\text{d}A} \equiv E(r) r^2 \int_S \sin\theta\text{d}\theta\text{d}\phi = 4 \pi r^2 E(r).$$
Once you calculate $E(r)$, you can say that the Electric Field is just $\mathbf{E}= E(r) \hat{r}!$
Similarly, if you had an infinite charged wire you could argue that (in cylindrical coordinates $(s,\phi,z)$) the Electric Field cannot depend on the $z$ or $\phi$ coordinates or directions through symmetry, and so $\mathbf{E} = E(s) \hat{s}$. This time, you'd like a Gaussian surface that points along $\hat{s}$, but we can't find a single finite surface that does that, and so we choose a cylinder of length $L$. The cylinder has three faces, the curved face and the two "lids". Of course, on the "lids" the area element is along $\hat{z}$, and so $\mathbf{E\cdot\text{d}A} = 0$ over the lids.
$$\int_\text{cylinder} \mathbf{E\cdot\text{d}A} \equiv E(s) s \int_\text{curved} \text{d}\phi \text{d}z + \underbrace{\int_\text{lids}\mathbf{E\cdot\text{d}A}}_{0} = 2\pi s L E(s).$$
This is precisely the reason why we cannot use Gauss's Law to calculate the Electric Field of a finite wire. If the wire is finite, then $\mathbf{E}$ will general be some $\mathbf{E} = E(s,z)\hat{s} + E(s,z)\hat{z}$, and neither of the above integrals will simplify, either over the curved surface or the lids. That doesn't mean that Gauss's Law does not hold, of course. If you had the exact solution for the Electric Field you could show that the integral of the flux over any surface is indeed proportional to the enclosed charge. However, you wouldn't be able to use this method to calculate the field.
A: If you apply Gauss' law to obtain the electric field, the direction of the electric field should be clear before applying Gauss' law, otherwise you will not be able to do the product $\vec{E}\cdot \vec{dS}$ and get the magnitude out of the flux integral. To determine the direction use symmetry arguments; try placing the vector in an arbitrary direction and think: is this direction privileged in any way? Does it make any sense at all that the electric field has a component in this direction given the symmetry of the charge distribution?
