Chapter 11
18 min read
Section 103 of 353

Electric Charge Distribution

Applications in Physics and Engineering (Integration)

Learning Objectives

By the end of this section, you will be able to:

  1. Understand charge density and distinguish between linear, surface, and volume charge densities
  2. Set up integrals to compute total charge from continuous charge distributions
  3. Apply integration to calculate electric fields from charged objects
  4. Use appropriate coordinate systems (Cartesian, cylindrical, spherical) based on the symmetry of the problem
  5. Recognize the superposition principle and how integration implements it for continuous distributions
  6. Connect these ideas to numerical methods, scientific computing, and machine learning applications
Why This Matters: Understanding electric charge distribution is fundamental to electromagnetism, which underpins all of modern electronics, communications, and power systems. The mathematical techniques you learn here—setting up integrals over continuous distributions and using symmetry to simplify calculations—are essential skills that appear throughout physics, engineering, and computational science.

The Big Picture

In previous chapters, you learned Coulomb's law for point charges: the electric field from a single point charge qq at distance rr is E=kqr2r^\vec{E} = \frac{kq}{r^2}\hat{r}. But real charged objects are rarely points—they are wires, plates, spheres, and more complex shapes with charge spread across them.

The key insight is that we can treat a continuous charge distribution as being made up of infinitely many infinitesimally small charges dqdq. Each tiny charge contributes a tiny electric field dEd\vec{E}, and the total field is the sum of all contributions—which becomes an integral.

Historical Context

The mathematical treatment of continuous charge distributions was developed in the 18th and 19th centuries by Charles-Augustin de Coulomb (1736–1806), Carl Friedrich Gauss (1777–1855), and Siméon Denis Poisson (1781–1840). Coulomb established the inverse-square law for point charges, while Gauss developed the powerful divergence theorem (Gauss's law) that relates electric fields to charge distributions. Poisson derived the equation 2ϕ=ρ/ϵ0\nabla^2 \phi = -\rho/\epsilon_0 that connects the electric potential to the charge density.

These ideas were unified into Maxwell's equations in the 1860s, providing a complete description of electromagnetism. Today, the same integration techniques appear in computational electromagnetics, semiconductor physics, and even in machine learning when dealing with continuous probability distributions.


From Point Charges to Continuous Distributions

Let's bridge the gap between discrete point charges and continuous distributions.

The Discrete Case: Many Point Charges

If we have NN point charges q1,q2,,qNq_1, q_2, \ldots, q_N, the total charge is simply:

Qtotal=i=1NqiQ_{\text{total}} = \sum_{i=1}^{N} q_i

And the electric field at any point is the vector sum:

E=i=1Nkqiri2r^i\vec{E} = \sum_{i=1}^{N} \frac{k q_i}{r_i^2}\hat{r}_i

The Continuous Limit

Now imagine the charges become more and more numerous and smaller, distributed continuously along a wire, over a surface, or throughout a volume. In this limit:

  • The discrete sum \sum becomes a continuous integral \int
  • Individual charges qiq_i become infinitesimal elements dqdq
  • We need a charge density function to describe how charge is spread out

The Superposition Principle

The superposition principle states that electric fields add as vectors. For a continuous distribution, this means:

Etotal=dE=kdqr2r^\vec{E}_{\text{total}} = \int d\vec{E} = \int \frac{k\,dq}{r^2}\hat{r}

Integration is simply superposition applied to infinitely many infinitesimal contributions.


Linear Charge Density

When charge is distributed along a one-dimensional object (like a wire or rod), we use linear charge density.

Definition: The linear charge density λ\lambda (lambda) at position xx is the charge per unit length:
λ(x)=dqdx(units: C/m)\lambda(x) = \frac{dq}{dx} \quad \text{(units: C/m)}
Equivalently: dq=λ(x)dxdq = \lambda(x)\,dx

Physical Interpretation

Think of λ(x)\lambda(x) as describing "how densely packed" the charge is at each position. If λ\lambda is large, there is a lot of charge crammed into each meter of wire. If λ\lambda varies with position, the charge is distributed non-uniformly.

Computing Total Charge

To find the total charge on a wire of length LL (from x=ax = a to x=bx = b where L=baL = b - a):

Q=abλ(x)dxQ = \int_a^b \lambda(x)\,dx

Special Case: Uniform Distribution

If λ\lambda is constant (uniform distribution), then:

Q=abλdx=λ(ba)=λLQ = \int_a^b \lambda\,dx = \lambda(b - a) = \lambda L

This is just the familiar relationship: charge=charge per length×length\text{charge} = \text{charge per length} \times \text{length}.


Surface Charge Density

When charge is distributed over a two-dimensional surface (like a metal plate or the surface of a sphere), we use surface charge density.

Definition: The surface charge density σ\sigma (sigma) at position (x,y)(x, y) on a surface is the charge per unit area:
σ(x,y)=dqdA(units: C/m2)\sigma(x, y) = \frac{dq}{dA} \quad \text{(units: C/m}^2\text{)}
Equivalently: dq=σ(x,y)dAdq = \sigma(x, y)\,dA

Computing Total Charge

For a surface SS:

Q=Sσ(x,y)dAQ = \iint_S \sigma(x, y)\,dA

The area element dAdA depends on the coordinate system:

Coordinate SystemArea Element dATypical Use
Cartesiandx dyRectangular plates
Polarr dr dθCircular disks, rings
Spherical (on sphere)R² sinθ dθ dφSpherical surfaces

Example: Uniformly Charged Disk

For a disk of radius RR with uniform surface charge density σ\sigma:

Q=diskσdA=σ02π0Rrdrdθ=σ2πR22=πσR2Q = \iint_{\text{disk}} \sigma\,dA = \sigma \int_0^{2\pi} \int_0^R r\,dr\,d\theta = \sigma \cdot 2\pi \cdot \frac{R^2}{2} = \pi \sigma R^2

This is simply σ×(area of disk)\sigma \times \text{(area of disk)}.


Volume Charge Density

When charge is distributed throughout a three-dimensional region (like a solid sphere or a cloud of electrons), we use volume charge density.

Definition: The volume charge density ρ\rho (rho) at position (x,y,z)(x, y, z) is the charge per unit volume:
ρ(x,y,z)=dqdV(units: C/m3)\rho(x, y, z) = \frac{dq}{dV} \quad \text{(units: C/m}^3\text{)}
Equivalently: dq=ρ(x,y,z)dVdq = \rho(x, y, z)\,dV

Computing Total Charge

For a volume VV:

Q=Vρ(x,y,z)dVQ = \iiint_V \rho(x, y, z)\,dV

Volume elements in different coordinate systems:

Coordinate SystemVolume Element dVTypical Use
Cartesiandx dy dzRectangular boxes
Cylindricalr dr dθ dzCylinders, wires
Sphericalr² sinθ dr dθ dφSpheres, atoms

Example: Uniformly Charged Sphere

For a solid sphere of radius RR with uniform volume charge density ρ\rho:

Q=sphereρdV=ρ02π0π0Rr2sinθdrdθdϕQ = \iiint_{\text{sphere}} \rho\,dV = \rho \int_0^{2\pi} \int_0^{\pi} \int_0^R r^2 \sin\theta\,dr\,d\theta\,d\phi
=ρ2π2R33=43πρR3= \rho \cdot 2\pi \cdot 2 \cdot \frac{R^3}{3} = \frac{4}{3}\pi \rho R^3

Again, this is ρ×(volume of sphere)\rho \times \text{(volume of sphere)}.


Interactive: Charge Distribution Explorer

Use this interactive visualization to explore how different charge density functions affect the total charge. You can:

  • Select different types of charge distributions (linear, surface, circular)
  • Choose various density functions (uniform, linear, quadratic, sinusoidal)
  • Adjust the number of Riemann rectangles to see how the approximation improves
  • Compare the numerical approximation to the exact integral
Interactive Charge Distribution Visualizer

Charge Density Function

λ(x)=2\lambda(x) = 2

Total Charge Calculation

Exact (integral): Q = 10.0000 C

Riemann sum (10 rectangles): Q ≈ 10.0000 C

Error: 0.00%

Integration Formula

Q=0Lλ(x)dxQ = \int_0^{L} \lambda(x)\,dx

For a linear charge distribution, integrate the linear charge density over the length.


Computing the Electric Field

To find the electric field from a continuous charge distribution, we apply the superposition principle: integrate the contributions from each infinitesimal charge element.

The General Strategy

  1. Identify the charge element: Express dqdq in terms of the charge density and the appropriate coordinate element (dxdx, dAdA, or dVdV)
  2. Find the field from this element: dE=kdqr2r^d\vec{E} = \frac{k\,dq}{r^2}\hat{r} where rr is the distance from the charge element to the observation point
  3. Decompose into components: Express dEd\vec{E} in terms of its Cartesian (or other) components
  4. Use symmetry: Identify components that cancel by symmetry to simplify the integral
  5. Integrate: Sum up all contributions over the entire charge distribution

Example: Field from a Uniformly Charged Rod

Consider a rod of length LL with uniform linear charge density λ\lambda, and we want to find the electric field at a point PP on the perpendicular bisector at distance dd.

Step 1: Place the rod along the x-axis from L/2-L/2 to L/2L/2. The charge element is dq=λdxdq = \lambda\,dx.

Step 2: For an element at position xx, the distance to PP at (0,d)(0, d) is r=x2+d2r = \sqrt{x^2 + d^2}.

Step 3: The x-components from symmetric pairs of elements cancel, so only EyE_y survives:

Ey=L/2L/2kλdxx2+d2dx2+d2=kλdL/2L/2dx(x2+d2)3/2E_y = \int_{-L/2}^{L/2} \frac{k\lambda\,dx}{x^2 + d^2} \cdot \frac{d}{\sqrt{x^2 + d^2}} = \frac{k\lambda d}{} \int_{-L/2}^{L/2} \frac{dx}{(x^2 + d^2)^{3/2}}

Step 4: Using the substitution x=dtanθx = d\tan\theta, the integral evaluates to:

Ey=kλLdd2+(L/2)2E_y = \frac{k\lambda L}{d\sqrt{d^2 + (L/2)^2}}

Interactive: Electric Field from a Rod

This visualization shows how the electric field at a point is computed by integrating contributions from each segment of a charged rod. Observe how:

  • Each segment contributes a small field dEd\vec{E} pointing away from positive charge
  • The x-components cancel by symmetry for a point on the perpendicular bisector
  • The y-components add up to give the total field
  • More segments give a better approximation to the exact integral
Electric Field from a Charged Rod

Integration Formula

E=L/2L/2dE=L/2L/2kλdxr2r^\vec{E} = \int_{-L/2}^{L/2} d\vec{E} = \int_{-L/2}^{L/2} \frac{k\,\lambda\,dx}{r^2}\hat{r}

Each infinitesimal element dq=λdxdq = \lambda\,dx contributes to the total field

Field Calculation Results

Ex (numerical): -0.0000 N/C

Ey (numerical): 0.3702 N/C

|E| (numerical): 0.3702 N/C


|E| (analytical): 0.3698 N/C

Error: 0.11%

Analytical Result (Perpendicular Bisector)

Ey=kλLdd2+(L/2)2E_y = \frac{k\lambda L}{d\sqrt{d^2 + (L/2)^2}}

For a point on the perpendicular bisector of a uniformly charged rod, Ex = 0 by symmetry.


Worked Examples

Example 1: Non-uniform Linear Charge Distribution

Problem: A wire of length L=2L = 2 m has linear charge density λ(x)=3x2\lambda(x) = 3x^2 C/m, where xx is measured from one end. Find the total charge.

Solution:

Q=0Lλ(x)dx=023x2dx=[x3]02=80=8 CQ = \int_0^L \lambda(x)\,dx = \int_0^2 3x^2\,dx = \left[x^3\right]_0^2 = 8 - 0 = 8 \text{ C}

Example 2: Ring of Charge

Problem: A thin ring of radius R=0.5R = 0.5 m carries total charge Q=4πQ = 4\pi nC uniformly distributed. Find the electric field at the center of the ring.

Solution: By symmetry, the electric field at the center is zero! Each charge element has a partner directly across the ring that produces a field pointing in the opposite direction. All contributions cancel.

Note: The field is not zero at points along the axis of the ring away from the center.

Example 3: Spherical Shell

Problem: A spherical shell of radius RR has surface charge density σ=σ0cosθ\sigma = \sigma_0 \cos\theta where θ\theta is the polar angle. Find the total charge.

Solution:

Q=SσdA=02π0πσ0cosθR2sinθdθdϕQ = \iint_S \sigma\,dA = \int_0^{2\pi} \int_0^{\pi} \sigma_0 \cos\theta \cdot R^2 \sin\theta\,d\theta\,d\phi
=2πR2σ00πcosθsinθdθ=2πR2σ0[sin2θ2]0π=0= 2\pi R^2 \sigma_0 \int_0^{\pi} \cos\theta \sin\theta\,d\theta = 2\pi R^2 \sigma_0 \left[\frac{\sin^2\theta}{2}\right]_0^{\pi} = 0

The total charge is zero! The positive charge in the upper hemisphere exactly balances the negative charge in the lower hemisphere.


Real-World Applications

1. Semiconductor Physics

In semiconductors, the charge distribution of electrons and holes is described by the carrier density n(x,y,z)n(x, y, z). The total number of carriers in a region determines electrical conductivity. Poisson's equation 2ϕ=ρ/ϵ\nabla^2 \phi = -\rho/\epsilon relates the electric potential to the charge density, which is fundamental to understanding transistors and diodes.

2. Capacitors and Energy Storage

Parallel plate capacitors store energy in the electric field between charged plates. The surface charge density σ\sigma on each plate determines the field strength E=σ/ϵ0E = \sigma/\epsilon_0 and the capacitance C=ϵ0A/dC = \epsilon_0 A/d. Understanding charge distribution is essential for designing high-energy-density capacitors.

3. Electrostatic Precipitators

Industrial electrostatic precipitators use charged plates to remove particulate matter from exhaust gases. The electric field pattern depends on the charge distribution on the electrodes, and calculus is used to optimize the design for maximum efficiency.

4. Atomic and Molecular Physics

The electron cloud around an atom is a continuous charge distribution. The probability density ψ2|\psi|^2 from quantum mechanics gives the effective charge density. Integrating this over space gives the total number of electrons, and the resulting electric potential determines chemical bonding.


Connection to Machine Learning

The mathematical techniques used for electric charge distributions have direct analogues in machine learning:

1. Probability Distributions

A probability density function p(x)p(x) is mathematically identical to a charge density. The total probability is:

p(x)dx=1\int_{-\infty}^{\infty} p(x)\,dx = 1

Just as total charge is λ(x)dx\int \lambda(x)\,dx. Expected values, variances, and other moments are all computed as integrals over the distribution.

2. Kernel Density Estimation

In KDE, we place "charge" (probability mass) at each data point and smear it out with a kernel function. The resulting continuous distribution is an estimate of the underlying probability density—exactly analogous to replacing point charges with a continuous density.

3. Gaussian Processes

Gaussian processes use kernel functions to define correlations between function values at different points. The mathematical machinery is similar to computing potentials from charge distributions: both involve integrals over kernel functions weighted by some "source" distribution.

4. Physics-Informed Neural Networks (PINNs)

PINNs learn to solve PDEs like Poisson's equation. They must learn the relationship between charge density and potential, using the same integration concepts we have studied.


Python Implementation

Here is how to compute total charge and electric field from continuous distributions using Python:

Computing Charge and Field from Distributions
🐍python
1

Import NumPy for arrays, Matplotlib for visualization, and SciPy for numerical integration.

8

Define the charge density function lambda(x). Here we use a linearly varying density.

14

Use scipy.integrate.quad for accurate 1D integration. Returns result and error estimate.

19

Compute the electric field using a Riemann sum over rod segments.

28

For each segment, compute the charge element dq = lambda * dx.

31

Calculate the distance vector from charge element to observation point.

35

Apply Coulomb's law: dE = k * dq / r^2, then decompose into components.

46

Compare numerical result to the analytical integral for validation.

56

Compute the field at a specific observation point above the rod.

75

Create a grid of points and compute the field at each for visualization.

84

Normalize field vectors for cleaner quiver plot arrows.

101 lines without explanation
1import numpy as np
2import matplotlib.pyplot as plt
3from scipy import integrate
4
5# Physical constants (normalized for visualization)
6k = 1  # Coulomb's constant (normalized)
7
8# Define linear charge density function
9def lambda_x(x, lambda_0=1):
10    """Linear charge density: lambda(x) = lambda_0 * (1 + x/L)"""
11    L = 2.0  # Rod length
12    return lambda_0 * (1 + x / L)
13
14# Compute total charge by integration
15def total_charge(lambda_func, x_start, x_end):
16    """Compute Q = integral of lambda(x) dx"""
17    result, error = integrate.quad(lambda_func, x_start, x_end)
18    return result, error
19
20# Compute electric field at point (px, py) from a charged rod
21def electric_field_from_rod(px, py, L, lambda_func, n_segments=100):
22    """
23    Compute E-field at point (px, py) from a rod on x-axis from -L/2 to L/2.
24    Uses numerical integration (Riemann sum).
25    """
26    x_vals = np.linspace(-L/2, L/2, n_segments + 1)
27    dx = x_vals[1] - x_vals[0]
28
29    Ex_total = 0
30    Ey_total = 0
31
32    for i in range(n_segments):
33        # Center of segment
34        x = (x_vals[i] + x_vals[i+1]) / 2
35
36        # Charge element
37        dq = lambda_func(x + L/2) * dx  # Shift x to start from 0
38
39        # Distance from charge element to observation point
40        rx = px - x
41        ry = py
42        r = np.sqrt(rx**2 + ry**2)
43
44        # Field contribution (magnitude)
45        dE = k * dq / r**2
46
47        # Components (pointing from charge to observation point)
48        Ex_total += dE * rx / r
49        Ey_total += dE * ry / r
50
51    return Ex_total, Ey_total, np.sqrt(Ex_total**2 + Ey_total**2)
52
53# Example: Compute total charge
54L = 2.0
55Q, error = total_charge(lambda_x, 0, L)
56print(f"Total charge on rod: {Q:.4f} C (error: {error:.2e})")
57
58# Analytical result for comparison
59# For lambda(x) = lambda_0 * (1 + x/L), integral = lambda_0 * (L + L/2) = 1.5 * lambda_0 * L
60analytical_Q = 1.5 * 1 * L
61print(f"Analytical result: {analytical_Q:.4f} C")
62
63# Compute electric field at a point
64px, py = 0, 1.5  # Point on perpendicular bisector
65Ex, Ey, E_mag = electric_field_from_rod(px, py, L, lambda_x)
66print(f"\nElectric field at ({px}, {py}):")
67print(f"  Ex = {Ex:.4f} N/C")
68print(f"  Ey = {Ey:.4f} N/C")
69print(f"  |E| = {E_mag:.4f} N/C")
70
71# Visualize the charge distribution and field
72fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(12, 5))
73
74# Plot 1: Charge distribution
75x = np.linspace(0, L, 100)
76ax1.plot(x, [lambda_x(xi) for xi in x], 'r-', linewidth=2)
77ax1.fill_between(x, [lambda_x(xi) for xi in x], alpha=0.3)
78ax1.set_xlabel('Position x (m)')
79ax1.set_ylabel('Charge density λ(x) (C/m)')
80ax1.set_title('Linear Charge Density')
81ax1.grid(True, alpha=0.3)
82
83# Plot 2: Electric field vectors
84x_grid = np.linspace(-2, 2, 10)
85y_grid = np.linspace(0.3, 3, 8)
86X, Y = np.meshgrid(x_grid, y_grid)
87
88Ex_grid = np.zeros_like(X)
89Ey_grid = np.zeros_like(Y)
90
91for i in range(X.shape[0]):
92    for j in range(X.shape[1]):
93        Ex_grid[i,j], Ey_grid[i,j], _ = electric_field_from_rod(
94            X[i,j], Y[i,j], L, lambda_x
95        )
96
97# Normalize for visualization
98E_mag_grid = np.sqrt(Ex_grid**2 + Ey_grid**2)
99Ex_norm = Ex_grid / E_mag_grid
100Ey_norm = Ey_grid / E_mag_grid
101
102ax2.quiver(X, Y, Ex_norm, Ey_norm, E_mag_grid, cmap='hot')
103ax2.plot([-L/2, L/2], [0, 0], 'b-', linewidth=8, label='Charged rod')
104ax2.set_xlabel('x (m)')
105ax2.set_ylabel('y (m)')
106ax2.set_title('Electric Field from Charged Rod')
107ax2.legend()
108ax2.set_aspect('equal')
109ax2.grid(True, alpha=0.3)
110
111plt.tight_layout()
112plt.show()

Common Pitfalls

PitfallWhat Goes WrongHow to Avoid It
Confusing density typesUsing wrong units or wrong integral dimensionAlways check: λ (C/m), σ (C/m²), ρ (C/m³)
Wrong coordinate systemIntegrals become unnecessarily complexMatch coordinates to symmetry: spherical for spheres, cylindrical for cylinders
Forgetting JacobianMissing factors like r or r² in dA or dVdA = r dr dθ, dV = r² sinθ dr dθ dφ
Ignoring symmetryUnnecessary work computing zero componentsIdentify canceling components before integrating
Wrong limitsComputing charge over wrong regionSketch the geometry and label all boundaries
Sign errorsGetting wrong field directionField points from + to -, or use unit vectors carefully
Pro Tip: Always start by drawing a clear diagram showing the charge distribution, the coordinate system, a typical charge element dqdq, and the observation point. Label distances and angles. This prevents most common errors.

Summary

In this section, we learned how to use integration to work with continuous charge distributions—a fundamental application of calculus in physics and engineering.

Key Formulas

TypeDensityTotal Charge Formula
Linear (1D)λ(x) [C/m]Q = ∫ λ(x) dx
Surface (2D)σ(x,y) [C/m²]Q = ∫∫ σ dA
Volume (3D)ρ(x,y,z) [C/m³]Q = ∫∫∫ ρ dV

Electric Field from Continuous Distributions

E=kdqr2r^\vec{E} = \int \frac{k\,dq}{r^2}\hat{r}

Problem-Solving Strategy

  1. Identify the geometry and choose appropriate coordinates
  2. Express dq in terms of the charge density and coordinate element
  3. Use symmetry to simplify by identifying canceling components
  4. Set up the integral with correct limits and integrand
  5. Evaluate using substitution, tables, or numerical methods
  6. Check units and limiting cases (e.g., far away should look like a point charge)

Knowledge Check

Test your understanding of electric charge distributions with this quiz:

Knowledge Check
Question 1 of 8

A wire has a linear charge density given by

λ(x)=3x2\lambda(x) = 3x^2

C/m³ where x is in meters. The total charge on a wire of length L (from x=0 to x=L) is:

Loading comments...