Let us consider an infinitely long straight wire having uniform linear charge density `lambda`. Let P be a point located at a perpendicular distance r from the wire. (Fig (a))

The electric field at the point P can be determined using Gauss law. Let us select small charge elements `A_1` and `A_2` on the wire which are at equal distances from the point P. The resultant electric field due to these two charge elements points radially away from the charged wire and the magnitude of electric field is same at all points on the circle of radius r. (Fig (b)). From this property, it is if=nferred that the charged wire possesses a cylindrical symmetry.
Let us select a cylindrical Gaussian surface of radius r and length L as shown in the figure.
The total electric flux in this closed surfac is given by
`phi_E = ointvecE.dvecA`
`= {:(intvecE.dvecA +),(curved),(surface):} {:(intvecE.dvecA +),("top"),(surface):} {:(vecE.dvecA),("bottom"),(surface):} `
It is found from figure, that for the curved surface, `vecE` is parallel to `vecA` and `vecE.dvecA = EdA`. For the top and bottom surfaces, `vecE` is perpendicular to `vecA` and `vecE.dvecA = 0`.
Substituting these values in the equation (1) and applying Gauss law to the cylindrical surface, we have
`phi_E = intEdA = Q_(encl)/epsilon_0`
Since the magnitude of the electric field for the entire curved surface is constant, E is taken out of the integration and `Q_(encl)` is given by `Q_(encl) = lambdaL`.
`EintdA = (lambdaL)/epsilon_0` Here, `phi_E = int dA` ...(1)
= total area of the curved surface
`= 2pirL`
Sustituting this in equation (1), we get,
`E.2pirL = (lambdaL)/epsilon_0`
`E = 1/(2piepsilon_0)lambda/r` ...(2)
In vector form
`vecE = 1/(2piepsilon_0)lambda/hatr` ...(3)
The electric field due to the infinite charged wire depends on `1/r` rather than `1/r^2` for point charge.
Equation (3) indicates that the electric field is always along the perpendicular outward `(hatr)` from the wire and if `lambda lt 0` then `(|vecE|)` points perpedicular inward `(-hatr)`.
The equation (3) is true only for an infinitely long charged wire. For a charged wire of finite length, the electric field need not be radial at all points. However, equation (3) for such a wire is taken approximately true from the both ends of the wire.