Electric field intensity due to uniformly charged wire of infinite length

Derivation of electric field intensity due to the uniformly charged wire of infinite length: Let us consider a uniformly-charged (positively charged) wire of infinite length having a constant linear charge density (that is, a charge per unit length) $\lambda$ coulomb/meter. Let P is a point at a distance $r$ from the wire at which electric field $\overrightarrow{E}$ has to find.

Let us draw a coaxial Gaussian cylindrical surface of length $l$ through $P$. By symmetry, the magnitude $E$ of the electric field will be the same at all points on this surface and directed radially outward. Thus, for any small area taken on the surface both the electric field vector $\overrightarrow{E}$ and the area vector $\overrightarrow{dA}$ are along the same direction(radially outward). Therefore,
Electric field due to infinite length of charged wire
Charged wire of infinite length
$ d \phi_{E}= \overrightarrow{E} \cdot \overrightarrow{dA}$

$ d \phi_{E}= E\: dA cos\theta$

$ d \phi_{E}= E\:dA cos0^{\circ} \qquad \left(\because \theta =0^{\circ} \right)$

$ d \phi_{E}= E\:dA \qquad \left(\because cos0^{\circ}=1 \right)$

Hence, the electric flux through the Gaussian surface is

$ \phi_{E}= \oint{E\:dA} $

$ \phi_{E}= E\:\oint{dA} $

$ \phi_{E}= E\:\left(2\pi r l \right) \qquad \left\{\because \oint{dA} =2\pi r l \right\} $

The electric flux through the plane ends of the surface is zero because $\overrightarrow{E}$ and $\overrightarrow{dA}$ are at right angle everywhere on these faces ($\because \overrightarrow{E} \cdot \overrightarrow{dA}=0$).Hence, the total electric flux through the Gaussian surface is

$ \phi_{E}= E\:\left(2\pi r l \right)$

But, by Gauss's law, this must be $\frac{q}{\epsilon_{0}}$, where $q$ is the net charge enclosed by the Gaussian surface. so that

$ \frac{q}{\epsilon_{0}}= E\:\left(2\pi r l \right)$

$ E= \frac{q}{2\pi r l \epsilon_{0}}$

for linear charge distribution → $q=\lambda l$. So the above equation can be written as

$ E= \frac{\lambda l}{2\pi r l \epsilon_{0}}$

$ E= \frac{\lambda}{2\pi\epsilon_{0} r }$

The vector form of the above equation can be written as:

$ E= \frac{\lambda}{2\pi\epsilon_{0} r }\widehat{r}$

Where $\widehat{r}$ is unit vector in the direction of $r$. The direction of $\overrightarrow{E}$ is radially outwards(for positively charged wire).

Thus, the electric field ($E$) due to the linear charge is inversely proportional to the distance ($r$) from the linear charge and its direction is outward perpendicular to the linear charge.

Special Note: A charged cylindrical conductor behaves for external points as if the whole charge is distributed along its axis.