Let's consider an infinite plane sheet of charge. The infinite plane sheet of charge is an idealization which works only if the point where the electric field to be calculated is close enough to the sheet compared to the sheet's dimensions and not too near the edges. The charge is distributed uniformly throughout the sheet and produces the electric field radially outward on either side of the sheet. If there is any component of the electric field parallel to the sheet, then we need to explain why the electric field has parallel component. So, the electric field is perpendicularly outward from the sheet. Now we make a Gaussian surface, a cylinder with its ends each having area \(A\). The cylinder's ends are parallel to the sheet and the sheet is at the middle point of the axis of the cylinder. See Figure 1.
Let the sheet has total charge \(q\) and the surface charge density i.e. charge per unit area be \(\sigma \). Now we divide the Gaussian surface into different parts and find the electric flux through each of those parts and obtain the total flux by adding them. But the electric field is parallel to the curved surface and perpendicular to the ends of the cylinder. Therefore the electric flux through the curved Gaussian surface is zero. Let the cylinder has radius \(r\) and the surface charge density of the sheet is \(\sigma\). The charge enclosed by the Gaussian surface is \(\sigma A\) (surface charge density multiplied by the sheet area enclosed by the Gaussian surface). Now the electric flux through the Gaussian surface is
\[\begin{align*} EA + EA + 0 &= \frac{{\sigma A}}{{{\epsilon_0}}}\\ \therefore E &= \frac{\sigma }{{2{\epsilon_0}}} \tag{1} \end{align*}\]
Here 0 is the electric flux through the curved Gaussian surface and \(EA\) through each ends of the Gaussian cylinder. The electric field is independent of the distance from the sheet so the electric field is uniform and perpendicular to the sheet.