The Leibniz integral rule in electrodynamics

I have been slowly working through David Griffith’s widely-used textbook, Introduction to Electrodynamics. It is known for having a large number of reasonably difficult exercises, which are instrumental in conveying some concepts not directly addressed in the main text.

I found an elegant shortcut to one of the questions, which was not noted in the solution manual. The shortcut involves (ab)using a very versatile, if slightly overlooked theorem in calculus – the Leibniz integral rule. I will briefly discuss this, before working through the problem.

The Leibniz integral rule

The Leibniz rule concerns derivatives of integrals; the most basic form is as follows:

This can be proven by letting $I(x) = \int_a^b f(x,t) dt$, then using the definition of the derivative to evaluate $I’(x)$, which will be left as an exercise for the reader (ha). However I hope you can get an intuitive feel for this: the integral measures the total variation with respect to $t$, whereas the derivative measures the rate of change with respect to $x$, so it makes sense that the order of operation doesn’t really matter.

A slightly more general version concerns the case where the limits of the integral are variable:

Effectively, it is the same as what we had before, plus some additions to take into account of the variable limits. This formula can be explained in terms of the fundamental theorem of calculus, but the derivation is besides the point. For now, I would urge you to just accept the above rule (it is surprisingly useful). Let’s go through an example to evaluate the following expression:

Hint: do not do it by evaluating the indefinite integral, substituting in the limits, then differentiating. Applying the Leibniz rule, we see that:

The electrodynamics problem

I say ‘electrodynamics’, but really it is an electrostatics problem. Below I have reproduced the question from Chapter 2 (Electrostatics) of Griffith’s Introduction to Electrodynamics. It has been edited slightly.

Problem 27 Find the electric field on the axis of a uniformly charged solid cylinder, at a distance z from the centre. The length of the cylinder is L, its radius is R, and the charge density is $\rho$.

Our general strategy will be to first find the potential (or rather, an expression for the potential), by decomposing the cylinder into simpler shapes. Then we will find the field using $\mathbf{E} = - \nabla V$.

A cylinder can be thought of as many discs; a disc can be thought of as many rings; a ring can be thought of as many point charges. We will thus build a cylinder.

1. A single point charge

Recall the formula for the potential at a point $P$:

In this formula, $r$ is the displacement between the charge and the test point. Applying Pythagoras’ theorem to the diagram, we see that $r^2 = R^2 + z^2$.

Plugging values into the formula:

2. A ring of charge

In order to find the potential for a ring of charge given the potential of a point charge, we consider a charge element $\lambda dl$. But the length of a segment on a circle is given by $R \theta$, so we can say that $dl = R d\theta$.

Instead of a positive point charge $q$, we now have a charge element $\lambda R d\theta$. Using our previous result, the potential at P from one of these charge elements is:

The total potential for the ring is the sum of the contributions from each of the charge elements.

3. A disc of charge

We can build up a disc of charge with radius R from an infinite number of rings of charge of radius r. Note that this r is different to the one briefly mentioned earlier, which was the separation between P and the charge.

Because we are going from 1D to 2D, we must let $\lambda = \sigma dr$, where $\sigma$ is the surface charge. Thus the potential from one ring is:

We could arrive at this otherwise, by noting that the total charge in the ring is

Anyway, let us continue.

As is rarely the case in electrodynamics, this integral is not at all difficult to evaluate. We use the ‘reverse chain rule’ to see that:

The total potential is then easily found.

4. A cylinder of charge

We are now ready to tackle the original problem. Here it is again:

Find the electric field on the axis of a uniformly charged solid cylinder, at a distance z from the centre. The length of the cylinder is L, its radius is R, and the charge density is $\rho$.

I’ll set up the solution in the same way Griffiths does – this image is taken from the solution manual.

A cylinder is made up of an infinite number of discs. We want an expression for the potential at the test point, a distance z from the centre. We will let x denote the distance between the test point and a given disc. The potential from one such disc is given by the formula we found earlier, with the substitution $z \rightarrow x$ and $\sigma \rightarrow \rho dx$:

Since L is the length of the cylinder, and z is the distance from the centre of the cylinder, it is clear that there are discs all the way from $x = z - \frac L 2$ to $x = z+ \frac L 2$. The total potential at our test point is just the integral over all of these discs:

Despite the simple-looking expression, this integral will soon become a nightmare to evaluate. And don’t forget – we are trying to find the electric field, so we will then have to take the gradient of the whole mess.

To be clear, because of the cylinder’s symmetry, ‘taking the gradient’ here just means differentiating with respect to z, but nevertheless this will not be a fun calculation.

Leibniz to the rescue

Instead of immediately evaluating the integral to calculate the potential, then differentiating, why don’t we write it in one expression first:

This might look more complicated, but in fact it makes life much easier. Because we are taking the derivative of an integral, we can simply apply the Leibniz integral rule. The limits are not constant, but the integrand is independent of z, so the rule tells us that:

Intuitively, there is some kind of ‘cancellation’ between the differentiation and integration, so we simply substitute the limits into the integrand (and multiply by the derivative of the limit since it is not constant), then subtract. In this case it is even simpler because the derivatives of the limits are one:


In many electrodynamics problems, one finds the electric field by first calculating the potential, then taking the gradient. I hope I’ve given you a reasonable motivation to not just do this mechanically – keep an eye out for shortcuts that will save you time, and reduce the chances of you making a minor algebraic error.