Electric field due to a finite line charge I was wondering what would happen if we were to calculate electric field due to a finite line charge. Most books have this for an infinite line charge. In the given figure if I remove the portion of the line beyond the ends of the cylinder. I believe the answer would remain the same. Also if I imagine the line to be along the $x$-axis then would it be correct to say that electric field would always be perpendicular to the line and would never make any other angle (otherwise the lines of force would intersect)?

Image source: Electric Field of Line Charge - Hyperphysics
 A: You can find the expression for the electric field of a finite line element at Hyperphysics which gives for the $z$-component of the field of a finite line charge that extends from $x=-a$ to $x=b$
$$E_z = \frac{k\lambda}{z}\left[\frac{b}{\sqrt{b^2+z^2}} + \frac{a}{\sqrt{a^2+z^2}}\right]$$
You can follow the approach in that link to determine the $x$-component (along the wire) as well.
The field will not be perpendicular to the $x$-axis everywhere - at the ends of the line, they "flare out" since the field obviously has to go to zero far from the line segment.
A: I have taken that line charge is placed vertically and one test charge is placed.
Now the electric field experienced by test charge dude to finite line positive charge.  
$$E_x = \int dx \cos \alpha$$
$E_y$ will be cancel out as they will be opposite to each other.
$$E_x = \int k \frac{dq}{x^2+y^2}\cos\alpha$$
$$E_x = \int k \frac{\lambda dy}{x^2+y^2}\cos\alpha$$
Here $\lambda dy$ is the Linear charge density distribution where $dy$ is small section of that line where $y$ is perpendicular distance and $x$ is horizontal distance to the test charge placed. 
$$E_x = \int k \frac{\lambda x\sec^2\alpha d\alpha}{x^2\sec^2\alpha}\cos\alpha$$
Since $$\tan\alpha = \frac{y}{x}$$
$$dy = x\sec^2 \alpha d\alpha$$
Now
$$E_x = k \frac{\lambda}{x}\int_\alpha^\beta \cos\alpha d\alpha$$
(In above $\alpha$ is negative and $\beta$ is positive)
$$E_x = k \frac{\lambda}{x}[\sin\alpha + \sin\beta]$$
Now since you have taken finite line charge you can put the value of angle which can be determined by placing any test charge between or anywhere in front of that ling charge or for easy method you can use Gauss theorem to prove it which is much easier than this.
