Skip to main content
Physics LibreTexts

1.3: Computing Electric Fields for Known Charge Distributions

  • Page ID
  • Continuous Charge Distributions

    Charges occur in nature in discrete microscopic pieces. We can imagine a long line of charges, and the field that the superposition of fields of all these charges would create. If the charges are small enough and close enough together, the line of charge would look continuous. There are many examples of continuous collections of charge besides a linear string. For example, the string of charges doesn’t need to be in a straight line. Also, it doesn’t need to be distributed on a line at all, but can instead be spread across a surface or inside of a volume. These lines, surfaces, and volumes can take on an infinite number of shapes, although mathematically we can only really solve for the electric fields of the simpler, more symmetric ones, like straight lines, circles, planes, cylinders, and spheres.

    The one aspect to solving such problems common to all of them is that in every case, we cease talking about individual charges and instead work with charge density. We discussed the idea of density in detail in both Physics 9A (e.g. mass density is used in calculating center of mass and rotational inertia) and Physics 9B (e.g. mass density of a medium affects the speed of a wave through it, and the density of a fluid plays a role in buoyancy). Here we are measuring charge-per-unit-whatever (the “whatever” being determined by the dimension into which the charge is distributed).

    Figure 1.3.1 – Linear, Surface, and Volume Densities


    The small (infinitesimal) bit of charge residing in each of these regions is found by multiplying the density (located at the position of that region – the density doesn't have to be the same everywhere!) by the size of the region. Typically linear charge densities are represented by a \(\lambda\), surface charge densities by a \(\sigma\), and volume charge densities by a \(\rho\):

    \[dq = \lambda \; dl \;\;\;\;\;\;\;\;\;\; dq = \sigma\;dA \;\;\;\;\;\;\;\;\;\; dq = \rho\;dV \]


    The charge \(dq\) has units of coulombs in every case, which means that these three types of density all have different units: \(Cm^{-1}\), \(Cm^{-2}\), and \(Cm^{-3}\), respectively.

    If we want to know the total amount of charge along a line, on a surface, or within a volume, then we need to integrate these infinitesimal amounts over the full region. Again, the densities are not necessarily uniform, so the density is a function of position, and cannot be removed from the integral:

    \[Q_{tot} = \int\limits_{whole\;line} \lambda\;dl \;\;\;\;\;\;\;\;\;\; Q_{tot} = \int\limits_{whole\;surface} \sigma\;dA \;\;\;\;\;\;\;\;\;\; Q_{tot} = \int\limits_{whole\;volume} \rho\;dV \]

    When it comes to using continuous charge distributions to compute electric fields, there is one critical idea that comes into play:

    An infinitesimal chunk of charge is so small that its field is precisely that of a point charge, so we can write it as a coulomb field.

    So the idea of computing the electric field of a continuous distribution of charge is to write down the (coulomb) electric field of a single infinitesimal chunk, and then add up (integrate) the electric field contributions of all the chunks.


    We have to keep in mind that the electric field contributions are vectors, which adds a layer of complication to the problem. The right approach is to compute the components of the field vector separately. Fortunately, there are often tricks related to symmetry we can use to simplify this particular step.

    The secret to solving such problems is to proceed slowly and methodically. We will break down the steps here with a simple example of a 1-dimensional charge distribution.

    Electric Field of a Straight Line Segment of Uniform Density

    Our line segment will have a length of \(2a\), a total charge of \(Q\), and we will be computing the field at a position a perpendicular distance \(r\) from the center of the line segment. We'll treat the charge as if it is positive. If we want the solution for a negative charge, we just have to flip the direction of the electric field.

    Figure 1.3.2a – Field of a Uniform Line Segment


    Step 1: Sketch an arbitrary infinitesimal chunk of charge, and its contribution to the field vector.

    Figure 1.3.2b – Field of a Uniform Line Segment


    Step 2: Break the field vector into appropriate components and make a symmetry argument (if applicable).

    This step requires a bit of clarification. Our integral will be adding field contributions for every little chunk of charge in the line segment, but we have to add these as vectors. The simplest way to do this is to add like components. In this case, the electric field of every chunk will generally have a vertical and horizontal component (within the plane of the page). We will therefore need to do two integrals – one that adds up the vertical electric field components, and one that adds up the horizontal components.

    Notice that for every chunk above the center line, there is another corresponding chunk below it. These "twin" chunks will provide horizontal components to the field that are equal and in the same direction, but the vertical components, while equal in magnitude oppose each other. When we add up the vertical components over the entire line segment, we therefore find that they cancel, meaning we know (without performing an integral) that the electric field has zero vertical component.


    This symmetry only applies to points on the line perpendicular to the center of the line segment, and only because the charge distribution is uniform. Fortunately, that is what we are calculating here.

    Figure 1.3.2c – Field of a Uniform Line Segment


    Step 3: Introduce a coordinate system and label everything.

    Don't be afraid to introduce variables! Ultimately the answer needs to be in terms of what has been given (in this case, that would be \(a\), \(Q\), and \(r\)), but since you can't simply write down the answer, you need to create some variables to work with. Besides the coordinate axes, we introduce the variable \(R\) to represent the distance separating a chunk of charge from the position of the field, and the angle \(\theta\) to allow us to express the horizontal component of the field. Note that the \(y-\)axis in the diagram below is not necessary, as it is clear that the field will not have a \(y-\)component in the coordinate system shown.

    Figure 1.3.2d – Field of a Uniform Line Segment


    Step 4: Relate the differential chunk of charge to the charge density, using the coordinate system.

    This is a linear distribution and the length of the chunk expressed in terms of the coordinate system is \(dz\), so we have:

    \[dq = \lambda \; dz\]

    But we also know that the charge density is uniform, so it is the ratio of the total charge and the total length:

    \[\lambda = \dfrac{Q}{2a} \;\;\; \Rightarrow \;\;\; dq = \dfrac{Q}{2a} \; dz \]

    Step 5: Apply the fact that an infinitesimal chunk acts like a point charge to produce an infinitesimal coulomb field.

    We have called the distance from the chunk to the point of the field \(R\), so:

    \[ dE = \dfrac{k\;dq}{R^2} = \dfrac{kQ}{2a}\left[\dfrac{dz}{z^2+r^2}\right] \]

    Step 6: Construct the component of the field from the magnitude, and convert variables into the integration variable.

    We can't just integrate \(dE\) at this point! We are adding the horizontal components, not the magnitudes. With our definition of \(\theta\), we have:

    \[ dE_x = dE\cos\theta = \dfrac{kQ}{2a}\left[\dfrac{dz}{z^2+r^2}\right]\cos\theta \]

    We still can't integrate yet, because as we start accounting for different chunks (i.e. integrate over \(z\)), the value of \(\theta\) changes. We therefore need to write \(\theta\) in terms of \(z\). Fortunately, we have a nice right triangle to work with:

    \[\cos\theta = \dfrac{r}{R} = \dfrac{r}{\sqrt{z^2+r^2}} \;\;\; \Rightarrow \;\;\; dE_x =\dfrac{kQr}{2a}\left[\dfrac{dz}{\left(z^2+r^2\right)^{\frac{3}{2}}}\right] \]

    Step 7: Integrate over all of the chunks of electric charge.

    In this case, the chunks lie from \(z=-a\) to \(z=+a\). We already noted that symmetry demands that the contributions of the lower half will be the the same as those of the upper half. We can see that this will be the case by replacing \(z\) in the integrand with \(-z\) – the same integral results. If we like, we can change the limits to \(0\rightarrow +a\) and multiply the integral by 2:

    \[ E_x = 2\int\limits_0^a \dfrac{kQr}{2a}\left[\dfrac{dz}{\left(z^2+r^2\right)^{\frac{3}{2}}}\right] \]

    Perhaps your palms are getting sweaty at this point, with the thought of now having to perform an integral like this. Well, first of all, it isn't that bad. But even if it were, we will be more focused on the physics of these problems than proficiency with techniques of integration, so we will liberally use integral tables to look these up once we have constructed them. This is not to say that you never have to do any math, of course. It's not always obvious how the integral you have can be placed in the form given in an integral table, so you are expected to make substitutions or do whatever it takes to make the integral tables actually useful to you. Anyway, this particular integral comes out to be (check it by taking a derivative!):

    \[ E_x = \dfrac{kQr}{a}\left[\dfrac{z}{r^2\sqrt{z^2+r^2}}\right]_0^a = \dfrac{kQ}{r\sqrt{a^2+r^2}} \;\;\; \Rightarrow \;\;\; \overrightarrow E\left(r\right) = \dfrac{kQ}{r\sqrt{a^2+r^2}} \widehat r\]

    Notice that after the integral is performed, all of the variables we introduced are gone (the last one to go being the integration variable).

    We already concluded that the \(y\) and \(z\) components of the field vanish at this point. The \(y\) component is zero because we defined the coordinate system so that this would be true. If we were to treat this more generally, we would note that no matter how we set up the \(x\) and \(y\) axes, the electric field points directly away from the segment (axially outward for a line of positive charge), which is why we have used the unit vector \(\widehat r\) instead of the unit vector along the \(x\)-axis only.

    The \(z\) component is zero because of symmetry, but if we hadn't noticed this shortcut, we could still have concluded this. Going back to step 5, we would compute:

    \[ dE_y = dE\sin\theta = \dfrac{kQ}{2a}\left[\dfrac{dz}{z^2+r^2}\right]\sin\theta \]

    Using our right triangle to substitute for \(\sin\theta\), we get a \(z\) in the numerator instead of the \(r\) that we got last time:

    \[ dE_y =\dfrac{kQ}{2a}\left[\dfrac{zdz}{\left(z^2+r^2\right)^{\frac{3}{2}}}\right] \]

    This integral differs from the previous one by a factor of \(z\), which makes all the difference. Once again, the limits of integration are symmetric about the origin, but now if we replace \(z\) in the integrand with \(-z\), we get the negative of the original integral. When these are added together for the two halves of the integral, we get zero. This is a nice mathematical trick you can use in these situations that avoids the need to do integrals like this one that come out to zero. If the integral is being performed over an interval over which the integrand is “odd” about the center of that interval (I will define “odd/even” in this context in a moment), then the integral comes out to be zero. If the integrand is “even,” then the integral is double the value of the integral over half the interval. The integrand above is an odd function of \(z\), meaning the function changes sign when \(z\rightarrow -z\). The limits of integration are symmetric across the origin, so this fits the bill for a zero integral as described.

    Figure 1.3.3 – Integrating Odd vs. Even Functions


    Example \(\PageIndex{1}\)

    A thin circular plastic ring with a radius of \(a\) carries a net charge that is uniformly distributed throughout the ring with a linear density of \(\lambda\). For a common point of reference, we will place this ring in the \(yz\) plane, with its center at the origin. Find the electric field at all points on the \(x-\)axis.


    First a diagram, to label the needed variables:


    The distance from a small segment of the circle to the point \(x\) is:

    \[ R=\sqrt{a^2+x^2} \nonumber \]

    So the small contribution to the magnitude of the electric field by this element is:

    \[dE=\dfrac{k\;dq}{a^2+x^2} \nonumber \]

    Thanks to the symmetry of the circle, the \(y\) and \(z\) components of this electric field all cancel out (for every element on the ring there is an element on the opposite side that cancels the components that are not in the \(x-\)direction). So the only part of the electric field we can keep is the \(x-\)component, which we find by multiplying the magnitude by the cosine of the angle \(\theta\) shown in the diagram. This cosine can be written in terms of the right triangle shown above:

    \[dE_x = dE\cos\theta = \left(\dfrac{k\;dq}{a^2+x^2}\right)\left(\dfrac{x}{R}\right) = \dfrac{kx\;dq}{\left(a^2+x^2\right)^{\frac{3}{2}}} \nonumber \]

    Now all we have to do is add up all of the \(dq\) contributions. The amount of charge in an infinitesimal segment of the circle (which is given by the radius times the infinitesimal angle the segment subtends) is given by:

    \[dq = \lambda \left(a\;d\phi\right) \nonumber \]

    Plugging this in and integrating around the entire ring (\(\phi\) ranges from 0 to \(2\pi\), and \(x\) remains constant throughout the integral) gives the answer:

    \[E_x = \int\limits_0^{2\pi} \dfrac{k\lambda ax}{\left(a^2+x^2\right)^{\frac{3}{2}}}d\phi = \dfrac{2\pi k\lambda ax}{\left(a^2+x^2\right)^{\frac{3}{2}}} \nonumber \]

    This is just the \(x-\)component of the field, but since the other components vanish, we have that the field vector on the axis at point \(x\) is:

    \[\overrightarrow E\left(x,0,0\right) = \dfrac{2\pi k\lambda ax}{\left(a^2+x^2\right)^{\frac{3}{2}}} \widehat i \nonumber\]

    Note that the direction changes when \(x\) is negative, as it should. Also note that the electric field vanishes at the origin and at infinity, as we would expect.

    Electric Field of a Circular Disk of Uniform Density

    We next take on a problem that differs from the previous one in two ways. First, it involves a two-dimensional charge distribution (which requires a double integral), and second, we will need to use polar coordinates rather than cartesian. Despite the differences, however, the steps we take are the same.

    Our disk will have a radius of \(a\), a total charge of \(Q\), and we will be computing the field at a position a perpendicular distance \(l\) from the center of the disk.

    Figure 1.3.4a – Field of a Uniform Disk


    Step 1: Sketch an arbitrary infinitesimal chunk of charge, and its contribution to the field vector.

    This is a bit trickier than before, because the chunk is not a simple line segment, and we have to keep an eye on what we will be integrating later. For example, we could draw a chunk that is a square, but integrating this in cartesian coordinates would be challenging. So instead, we choose an arc with a radial thickness.

    Figure 1.3.4b – Field of a Uniform Disk


    Step 2: Break the field vector into appropriate components and make a symmetry argument (if applicable).

    As before, we find that there is symmetry (this time, axial) which creates opposing contributions to the electric field vector along directions perpendicular to the central axis.

    Figure 1.3.4c – Field of a Uniform Disk


    Step 3: Introduce a coordinate system and label everything.

    The shape of our collection of charge calls for a use of polar coordinates to describe the position of the chunks of charge.

    Figure 1.3.4d – Field of a Uniform Disk


    Step 4: Relate the differential chunk of charge to the charge density, using the coordinate system.

    This is a surface charge density, so we need to multiply the constant charge density by the infinitesimal area of the chunk in order to get \(dq\). Since we are using polar coordinates, this requires a closer look at the geometry of the chunk:

    Figure 1.3.4e – Field of a Uniform Disk


    The infinitesimal charge in terms of the charge density is therefore:

    \[ dq = \sigma\;dA = \sigma r dr d\phi \]

    The charge density is uniform, which means that the total charge is the density multiplied by the total area of the disk, which gives:

    \[ \sigma = \dfrac{Q}{\pi a^2} \;\;\; \Rightarrow \;\;\; dq = \dfrac{Q}{\pi a^2}r \;dr \;d\phi \]

    Step 5: Apply the fact that an infinitesimal chunk acts like a point charge to produce an infinitesimal coulomb field.

    \[ dE = \dfrac{k\;dq}{R^2} = \dfrac{kQ}{\pi a^2}\left[\dfrac{r \;dr \; d\phi}{r^2+l^2}\right] \]

    Step 6: Construct the component of the field from the magnitude, and convert variables into the integration variable.

    \[ dE_x = dE\cos\theta = \dfrac{kQ}{\pi a^2}\left[\dfrac{r \;dr \; d\phi}{r^2+l^2}\right]\cos\theta = \dfrac{kQ}{\pi a^2}\left[\dfrac{r \;dr \; d\phi}{r^2+l^2}\right]\left[\dfrac{l}{R}\right] = \dfrac{kQl}{\pi a^2}\dfrac{r \;dr \; d\phi}{\left(r^2+l^2\right)^{\frac{3}{2}}} \]

    Step 7: Integrate over all of the chunks of electric charge.

    To include the contributions of all the chunks, we integrate the angle around the entire circle (\(\phi=0\rightarrow 2\pi\)), and the radius from the center out to the edge (\(r=0\rightarrow a\)). Notice that integrating around the whole circle and from the center to the radius takes care of the "opposing" chunks everywhere around the disk – the components of the field perpendicular to the axis cancel, and those parallel all add (no need to multiply by 2, as we did when we integrated from the center of the line of charge earlier, to include both sides).

    \[ E_x = \dfrac{kQl}{\pi a^2}\int\limits_0^{2\pi} d\phi \int\limits_0^{a} \dfrac{r\;dr}{\left(r^2+l^2\right)^{\frac{3}{2}}} \]

    The integral over \(d\phi\) is simply equal to \(2\pi\), and the integral over \(r\) is so common that we shouldn't even have to look it up (though it is fine to do so). Make the substitution \(u\equiv \left(r^2+l^2\right)^{-\frac{1}{2}}\) and the integral comes out immediately:

    \[ E_x =\dfrac{kQl}{\pi a^2}\left(2\pi\right)\left[\dfrac{-1}{\sqrt{r^2+l^2}}\right]_{r=0}^{r=a} \;\;\;\Rightarrow \;\;\; \overrightarrow E\left(l,0,0\right) = \dfrac{2kQ}{a^2}\left(1-\dfrac{l}{\sqrt{a^2+l^2}}\right) \widehat i \]

    Some General Comments

    Now for a couple general observations about the two calculations we have just performed…

    • Notice that the sub-steps become tougher as the geometry becomes more complex. Here are a few of these problem spots:
      • Labeling the position of the source point charge is a bit trickier if it lies within a 2-dimensional plane (or within a 3-dimensional volume), rather than on a 1-dimensional line. You could use the y and z rectangular coordinates, but then the limits of integration get significantly tougher. In general, the symmetry of the physical situation will dictate what is the best coordinate system to use.
      • The element of charge written in terms of the coordinates is more complicated. Typically we just choose an appropriate coordinate system and look up the expression for an infinitesimal element of length/area/volume (see the end of this section for references), but that doesn’t mean it’s easy.
      • For surfaces, there are two variables over which we must integrate. If we choose a good coordinate system, we usually have only one non-trivial integral. Also, we could choose an element that allows for a shortcut (such as using the solution for a ring of charge Example 1.3.1 in the disk problem we just did), but that gets away from the notion of dq as a point charge, which can confuse our understanding of the situation on physical grounds.
    • As we said after the line charge case, we can actually perform the integrals for the other components of the electric field and show explicitly that they are zero, but this is a bit harder to do for the disk than it was for the line. The best way to do it is to use cylindrical coordinates, with the z-axis pointing along the axis of the disk, then show that the r and ϕ component integrals vanish. The former vanishes with the integral of dϕ, while the latter is identically zero for every charge element (so it is not necessary to do an integral for that component).

    One should not get the impression that all charge densities are uniform; quite the contrary. Dealing with non-uniform densities only changes the problem by complicating the integral, since \(\lambda\), \(\sigma\), and \(\rho\) then become functions of position and cannot simply be pulled out of the integral as constants.

    Infinite Lines and Planes of Charge

    A particularly useful aspect of the solutions provided above for the line segment and the disk lies in extending the result to charge distributions that are infinite in extent. To see how to make this extension, we first need to change the form of the solutions so that they reflect the charge density, rather than the total charge:

    \[\overrightarrow E_{line\;segment}\left(r\right) = \dfrac{kQ}{r\sqrt{a^2+r^2}} \widehat r = \dfrac{2ak\lambda}{r\sqrt{a^2+r^2}} \widehat r \]

    \[\overrightarrow E_{disk}\left(x\right) = \dfrac{2kQ}{a^2}\left(1-\dfrac{x}{\sqrt{a^2+x^2}}\right) \widehat i = 2\pi k \sigma\left(1-\dfrac{x}{\sqrt{a^2+x^2}}\right) \widehat i \]

    For both cases, we can extend the solution to the infinite cases by letting the parameter \(a\) go to infinity.

    \[\overrightarrow E_{line}\left(r\right) = \lim\limits_{a\rightarrow \infty}\dfrac{2ak\lambda}{r\sqrt{a^2+r^2}} \widehat r = \lim\limits_{a\rightarrow \infty}\dfrac{2k\lambda}{r\sqrt{1+\dfrac{r^2}{a^2}}} \widehat r = \dfrac{2k\lambda}{r} \widehat r \]

    \[\overrightarrow E_{plane}\left(x\right) = \lim\limits_{a\rightarrow \infty} 2\pi k \sigma\left(1-\dfrac{x}{\sqrt{a^2+x^2}}\right) \widehat i = 2\pi k \sigma \widehat i\]

    The solutions for the infinite line and plane take on significantly simpler forms than for the finite cases. But there is another simplification for these cases as well: In the finite cases, we had to be careful to remember that the solutions only applied along the point of symmetry, equally-spaced between the extremes of the charge distributions (i.e. in the \(xy\) plane for the line segment, and on the \(x-\)axis for the disk). But with these distributions now having infinite extent, everywhere represents a symmetric position, so these solutions are good everywhere in space.

    It might seem strange that the electric field is uniform everywhere in space for the infinite plane. Why doesn't the field get stronger closer to the plane of charge? This can be more easily seen using the field line description. If the field got stronger closer to the plane, then the field lines would have to get closer together there. But that can only happen if the field lines are not perpendicular to the plane everywhere. Due to the symmetry of the infinite plane, there is no reason to believe that the field would have any \(y\) or \(z\) components anywhere in space. With the field only pointing along the \(x\) direction, the field lines can't change their separation, and the field strength remains constant everywhere.

    One might ask that although these solutions have simpler forms, how can they be "useful," as claimed above? How many infinite lines or planes of charge does one run across in real life? The answer is that all solutions in physics are approximations, and are only useful up to the sensitivity of the measurements. For example, if we look at the field of a finite-sized plane of charge, but look at a position in space that is very close to the plane compared to the dimensions of that plane, then treating it as "infinite" is a good approximation. What is especially nice about this approximation is that so long as we are looking at positions close to the plane compared to the distance from the edges, we don't even care what shape the plane is – it can be a circular disk, a square, or some random, jagged shape.

    One other comment about usefulness. Once we have made a computation, we don't have to do it over again. That means that to the extent that a new problem has elements that can be approximated as these above, we can simply use the solutions – we don't have to start from scratch and perform an integral every time. We saw this utility once before in Physics 9A, where we may have performed an integral to compute the moment of inertia of a rod or some other object, but after that, we can just use what we computed.

    A New Constant

    The constant \(k\) that we introduced in Coulomb's law, and is present in all of the solutions above, was convenient in the context for which it was introduced, but we will introduce a new constant here that we will use hereafter. There is no fundamental difference in using either of these constants – mostly the change is for cosmetic reasons. Without further ado, presenting the permittivity of free space:

    \(\epsilon_o \equiv \dfrac{1}{4\pi k} = 8.85\times 10^{-12} \frac{C^2}{Nm^2} \)

    Rewriting the magnitudes of the coulomb field and the fields of the infinite distributions above in terms of this constant, we have:

    \[E_{point}\left(r\right) = \dfrac{q}{4\pi\epsilon_or^2} \]

    \[E_{line}\left(r\right) = \dfrac{\lambda}{2\pi\epsilon_o r} \]

    \[E_{plane} = \dfrac{\sigma}{2\epsilon_o} \]

    We will make extensive use of these.

    Area and Volume Elements

    For reference purposes, we present here the area and volume elements for cartesian, cylindrical, and spherical coordinates.

    Figure 1.35 – Cartesian Coordinates


    Figure 1.36 – Cylindrical Coordinates


    Figure 1.37 – Spherical Coordinates