# PlanetPhysics/Electric Field of a Line of Charge
## The Electric Field of a Line of Charge

Calculating the Electric Field due to a non-moving continuous distribution of charge is a common task in electrostatics. Unfortunately, without resorting to numerical methods, we are limited to simple geometries and field points that rely on symmetry in order to make the integrals tractable.
Here we will examine the electric field due to a continuous line of charge on a line segment of length 2L. Analytically, we will compute the E-field at two different types of field points and then look at computing the entire field using the principle of superposition.

### Center Line

The electric field at a height h above the line segment and along the center line as shown in below figure is straight forward and is one of the basic examples given in [1][2][3].
   \includegraphics[scale=0.8]{ElectricFieldLineSeg.eps}
Once the problem is setup correctly, the rest is straightforward. Commbining the notation used in [1] and [2] helps us connect the general formulation with our special case given here. For a line of charge, with a charge density of $\lambda (r')$, the general formula is
   ${\mathbf {E} }={\frac {1}{4\pi \epsilon _{0}}}\int {\frac {\lambda (r')({\mathbf {r} }-{\mathbf {r} '})dl'}{\left|{\mathbf {r} }-{\mathbf {r} '}\right|^{3}}}$
The first assumption is that the line of charge has a uniform charge density. This means that for a infinitesimal part dl', the charge per unit length is just $\lambda$. Then, with the coordinate system setup in the figure
$\lambda (r')dl'=\lambda dx$
The vector setup is next and this is where practice is important. Try out different geometries and coordinate systems until your proficient. Remembering the convention that the prime vector is to the source point and the unprimed vector is to the field point, we get in Cartesian coordinates
${\mathbf {r} '}=x{\hat {\mathbf {x} }}$ ${\mathbf {r} }=h{\hat {\mathbf {y} }}$
Then for our integral in (1) we have
${\mathbf {r} }-{\mathbf {r} '}=h{\hat {\mathbf {y} }}-x{\hat {\mathbf {x} }}$ $\left|{\mathbf {r} }-{\mathbf {r} '}\right|={\sqrt {x^{2}+h^{2}}}$
Substituting these relationships into (1)
   ${\mathbf {E} }={\frac {\lambda }{4\pi \epsilon _{0}}}\int _{-L}^{L}{\frac {(h{\hat {\mathbf {y} }}-x{\hat {\mathbf {x} }})dx}{(x^{2}+h^{2})^{3/2}}}$
The next step is to break the integral into its x and y components and then integrate
{\mathbf x} component:
Usually, one looks at this setup and quickly sees the symmetry and how all the x components cancel, so it should be obvious that this integral will be zero. However, for the practice let's go throught the motions ${\mathbf {E} }_{x}=-\int _{-L}^{L}{\frac {x{\hat {\mathbf {x} }}dx}{(x^{2}+h^{2})^{3/2}}}$
Using u substitution set
$u=x^{2}+h^{2}$ $du=2xdx$ $dx=du/2x$
notice that when we plug in the limits of integration from -L to L we get for both limits
$u=L^{2}+h^{2}$
${\mathbf {E} }_{x}=-\int _{L^{2}+h^{2}}^{L^{2}+h^{2}}{\frac {du}{2(u)^{3/2}}}$
however the limits of integration are the same, so we know that the integral is zero.
   ${\mathbf {E} }_{x}=0$
{\mathbf y} component:
${\mathbf {E} }_{y}=\int _{-L}^{L}{\frac {h{\hat {\mathbf {y} }}dx}{(x^{2}+h^{2})^{3/2}}}$
This integral is a little more tricky, but is straight forward once you realize you need to use trigonometric substitution. Trig. substitution is nicely explained in [4] or any other calculus textbook. Use the right triangle in below figure to setup the needed relationships:
   \includegraphics[scale=.4]{TrigSub.eps}
$\tan u={\frac {x}{h}}$ $x=h\tan u$ $dx=h\sec ^{2}udu$ $\cos u={\frac {h}{\sqrt {x^{2}+h^{2}}}}$ ${\sqrt {x^{2}+h^{2}}}={\frac {h}{\cos u}}=h\sec u$
Putting all these together into the integral leaves us with
${\mathbf {E} }_{y}={\hat {y}}\int {\frac {h^{2}\sec ^{2}udu}{h^{3}\sec ^{3}u}}$
simplfying
${\mathbf {E} }_{y}={\frac {\hat {y}}{h}}\int {\frac {du}{\sec u}}$
but this is just
${\mathbf {E} }_{y}={\frac {\hat {y}}{h}}\int \cos u$
Note that we can pull out the unit vector ${\hat {y}}$ because they are constant in cartesian coordinates. Make sure that you do not do this for other coordinate systems where the unit vectors may not be constant. Carrying out this simple integration yeilds
${\mathbf {E} }_{y}={\frac {\hat {y}}{h}}\left.\right|_{-L}^{L}\sin u$
we cannot simply plug in the limits of integration here, first convert back using the right triangle in figure
$\sin u={\frac {x}{\sqrt {x^{2}+h^{2}}}}$
${\mathbf {E} }_{y}={\frac {\hat {y}}{h}}\left.\right|_{-L}^{L}{\frac {x}{\sqrt {x^{2}+h^{2}}}}$
Finally, evaluating this gives the the y component of the electric field.
${\mathbf {E} }_{y}={\frac {\hat {y}}{h}}\left({\frac {2L}{\sqrt {L^{2}+h^{2}}}}\right)$
Now that we know the x component is zero, the overall electric field along the center line is just in the y direction and is given by
${\mathbf {E} }={\frac {\lambda L{\hat {y}}}{2\pi \epsilon _{0}h{\sqrt {L^{2}+h^{2}}}}}$

### End Line

The electric field at a height h above the line segment and along the end line as shown in below figure is simliar to the previous example, except our x components of the electric field will not cancel out this time.
   \vspace{10 pt} \includegraphics[scale=.8]{ElectricFieldLineSegEnd.eps} \vspace{10 pt}
The vector setup is the same as for the center line and the only difference is the limits of integration
   ${\mathbf {E} }={\frac {\lambda }{4\pi \epsilon _{0}}}\int _{0}^{2L}{\frac {(h{\hat {\mathbf {y} }}-x{\hat {\mathbf {x} }})dx}{(x^{2}+h^{2})^{3/2}}}$
Once again, break the integral into its x and y components and integrate
\underline{{\mathbf x} component}:
This time the x component is non zero ${\mathbf {E} }_{x}=-\int _{0}^{2L}{\frac {x{\hat {\mathbf {x} }}dx}{(x^{2}+h^{2})^{3/2}}}$
Using u substitution set
$u=x^{2}+h^{2}$ $du=2xdx$ $dx=du/2x$
notice that when we plug in the limits of integration we now get
$u=h^{2}$
and
$u=4L^{2}+h^{2}$
${\mathbf {E} }_{x}=-{\hat {x}}\int _{h^{2}}^{4L^{2}+h^{2}}{\frac {du}{2(u)^{3/2}}}$
integrating yields
${\mathbf {E} }_{x}={\hat {x}}\left.\right|_{h^{2}}^{4L^{2}+h^{2}}{\frac {1}{(u)^{1/2}}}$
finally, evaluate the limits of integration and add in the constants to get
   ${\mathbf {E} }_{x}={\frac {\lambda }{4\pi \epsilon _{0}}}\left({\frac {\hat {x}}{\sqrt {4L^{2}+h^{2}}}}-{\frac {\hat {x}}{h}}\right)$
{\mathbf y} component:
The y component also just differs in the limits of integration so starting from previous setup
${\mathbf {E} }_{y}=\int _{0}^{2L}{\frac {h{\hat {\mathbf {y} }}dx}{(x^{2}+h^{2})^{3/2}}}$
which we now know gives
${\mathbf {E} }_{y}={\frac {\hat {y}}{h}}\left.\right|_{0}^{2L}{\frac {x}{\sqrt {x^{2}+h^{2}}}}$
Finally, evaluating this gives the the y component of the electric field.
${\mathbf {E} }_{y}={\frac {\hat {y}}{h}}\left({\frac {2L}{\sqrt {4L^{2}+h^{2}}}}\right)$
Now combining x and y components with the other constants of integration, gives the overall electric field along the end line
   ${\mathbf {E} }={\frac {\lambda }{4\pi \epsilon _{0}}}\left[{\frac {\hat {x}}{\sqrt {4L^{2}+h^{2}}}}-{\frac {\hat {x}}{h}}+{\frac {2L{\hat {y}}}{h{\sqrt {4L^{2}+h^{2}}}}}\right]$

### General Solution

For the general solution of the electric field due to a line of charge, we will show off the power of the principle of superposition. Since, we know electric fields follow the principle of superposition, we can build upon simpler solutions to get a total electric field through their sums
   $E_{tot}=E_{1}+E_{2}+\dots ...+E_{n}$
So we can now find the electric field at any point, P(x,y), in the plane by adding two cases of the earlier end line example. One electric field to handle the line of charge left of the point and one to handle the line of charge right of the point and then sum their solutions.
   \includegraphics[scale=0.8]{PlaneFieldSetupSeg.eps}
The key here is to get the signs correct when adding the fields and make sure we do not mix up the new terms we introduce. The relationship between the above figure and our previous analysis is
$2L_{1}+x=L$
$2L_{2}-x=L$
rearranging gives
   $L_{1}=(L-x)/2$
   $L_{2}=(L+x)/2$
Starting with the x component of equation (6) we get the electric field at $P(x,y)$ from the left side of the line segment by inserting $L=L_{1}$ and $h=y$
${\mathbf {E} _{x1}}={\frac {\lambda }{4\pi \epsilon _{0}}}\left[{\frac {\hat {x}}{\sqrt {4L_{1}^{2}+y^{2}}}}-{\frac {\hat {x}}{y}}\right]$
For the right side the electric field is in the x direction is opposite to the left side and we must apply a negative sign
${\mathbf {E} _{x2}}={\frac {\lambda }{4\pi \epsilon _{0}}}\left[-{\frac {\hat {x}}{\sqrt {4L_{2}^{2}+y^{2}}}}+{\frac {\hat {x}}{y}}\right]$
The total electric field in the x direction is then
   ${\mathbf {E} _{x}}={\mathbf {E} _{x1}}+{\mathbf {E} _{x2}}={\frac {\lambda {\hat {x}}}{4\pi \epsilon _{0}}}\left[{\frac {1}{\sqrt {4L_{1}^{2}+y^{2}}}}-{\frac {1}{\sqrt {4L_{2}^{2}+y^{2}}}}\right]$
Inserting equations (8) and (9) into (10) we get
   ${\mathbf {E} _{x}}={\mathbf {E} _{x1}}+{\mathbf {E} _{x2}}={\frac {\lambda {\hat {x}}}{4\pi \epsilon _{0}}}\left[{\frac {1}{\sqrt {(L-x)^{2}+y^{2}}}}-{\frac {1}{\sqrt {(L+x)^{2}+y^{2}}}}\right]$
Now for the y components, this time however, both the left and right side are in the same direction so we add them straight away
${\mathbf {E} _{y}}={\frac {\lambda }{4\pi \epsilon _{0}}}\left[{\frac {2L_{1}{\hat {y}}}{y{\sqrt {4L_{1}^{2}+y^{2}}}}}+{\frac {2L_{2}{\hat {y}}}{y{\sqrt {4L_{2}^{2}+y^{2}}}}}\right]$
Once again, inserting equations (8) and (9) and a little rearranging of the signs we get
   ${\mathbf {E} _{y}}={\frac {\lambda {\hat {y}}}{4\pi \epsilon _{0}y}}\left[{\frac {(x+L)}{\sqrt {(x+L)^{2}+y^{2}}}}-{\frac {(x-L)}{\sqrt {(x-L)^{2}+y^{2}}}}\right]$
Combining equations (11) and (12), we get the total electric field at point $P(x,y)$ due to a line segment of length 2L with the origin of the x and y coordinate frame at the center of the segment
   ${\mathbf {E} }={\frac {\lambda }{4\pi \epsilon _{0}}}\left[{\frac {\hat {x}}{\sqrt {(L-x)^{2}+y^{2}}}}-{\frac {\hat {x}}{\sqrt {(L+x)^{2}+y^{2}}}}+{\frac {{\hat {y}}(x+L)}{y{\sqrt {(x+L)^{2}+y^{2}}}}}-{\frac {{\hat {y}}(x-L)}{y{\sqrt {(x-L)^{2}+y^{2}}}}}\right]$
Finally, it would be a good exercise for the reader to apply the techniques above regarding the field and source points to find the electric field directly from equation (1). The below figure displays the setup and you should get the same answer as equation (13).
   \includegraphics[scale=0.8]{PlaneSourceFieldSetupSeg.eps}
[1] Reitz, J., "Foundations of Electromagnetic Theory" Fourth Edition. Addison-Wesley Publishing Company, Inc. 1993.
[2] Griffiths, D. "Introduction to Electrodynamics", Prentice-Hall, Inc., 1999.
[3] Halliday, D., Resnick, R., Walker, J.: "fundamentals of physics". 5th Edition, John Wiley \& Sons, New York, 1997.
[4] Etgen, G. "Calculus" John Wiley \& Sons, New York, 1999.