Define a coordinate system along the axis of rod, with the origin at the center of the rod as shown below.
Figure: Define the coordinate system.
Break the rod into pieces of charge of width at location on the rod. The electric field at location P due to a piece of the rod is .
Figure: Define a piece of the rod.
The electric field at point P due to a piece of the rod of charge is
where the vector is the position of point P relative to the charge . It is calculated in general by
Note that the distance between and point P is just , and the vector points in the +xdirection which is the unit vector . Because only has an xcomponent, the electric field also only has an xcomponent and the y and zcomponents of the electric field are zero. So, substituting into the electric field and solving only for the xcomponent of the electric field gives
If the charge is positive, then is in the direction. If is negative, then is in the direction.
The rod is uniformly charged. As a result, the charge of a piece divided by its length is the same as the total charge divided by the total length of the rod.
This allows us to write the charge of a piece of the rod in terms of its length .
Substituting this into the electric field gives
According to the Superposition Principle, the net electric field at point P is the sum of the electric fields due to all pieces of the rod. Thus, we must sum (i.e. integrate) the electric field due to each piece, over the length of the rod. Use algebra to simply your answer.
This can be written more generally, even for points to the left of the rod by calculating the magnitude of the electric field.
The direction of along the axis is away from the rod if the rod is positively charged, , and toward the rod if the rod has a negative charge . To check that the answer makes sense, consider the electric field at a point P that is VERY far away from the rod so that . In this case, the term is negligible compared to . Then,
as expected for the field due to a point particle.
