A14 · Lesson 21 · Differentiating under the integral sign
When the derivative of an integral is the integral of the derivative
An engineer wants to know how a filter's output energy changes as its time constant changes, or how a detector's error rate moves with its threshold. Each is an integral that depends on a parameter, and the quick way to its derivative is to differentiate inside the integral. Usually that works. Sometimes it gives nonsense: an integral that's constant in its parameter, whose "derivative inside" doesn't even converge. This lesson states when the swap is allowed, uses it to evaluate integrals that resist every other method, and shows the case where it fails.
- The curve is , computed as , against . Its derivative, from differentiating under the integral, is .
- At the integral is , the famous Dirichlet integral, reached by a detour through the parameter.
Predict
equals for every . What happens if you differentiate under the integral sign?
You get , which has no value: it oscillates forever. Yet is constant, so its derivative is plainly 0. Swapping derivative and integral isn't automatic; it needs the derivative inside to be controlled by something integrable, and isn't.
Name it
On a bounded interval
If and are continuous on , then for in
The proof uses lesson 13's uniform continuity: on a compact set, the difference quotient approaches uniformly in , and a uniform limit can be integrated term by term.
Moving limits: Leibniz's rule
The first two terms come from the fundamental theorem (lesson 18), the last from the rule above.
Improper integrals: domination
On an infinite range the swap needs more. It's allowed when there's a single integrable function with for every in the range of interest (lesson 47's dominated convergence, applied to difference quotients). For with , the derivative inside is bounded by , so the swap is fine; for there's no such bound.
Using it: Feynman's trick
To evaluate , put it inside a family whose derivative is easy, find , integrate back in , and fix the constant from a value of where is known.
Worked example
Find by differentiating .
Show the solution
- The family to differentiate. For ,
- Differentiate under the integral. is continuous and bounded on for (it tends to 0 at ), so
- Put in t = 1.
- Differentiate again. A second derivative gives with no integration by parts at all.
Answer , which is for n = 1.
Worked example
Evaluate the Dirichlet integral with Feynman's trick.
Show the solution
- Put it in a family. For let
- Differentiate under the integral. The derivative inside, , is dominated by for , so
- Integrate back. and as gives .
- Let . The convergence is uniform enough to pass to the limit, so
- A value on the way. At the integral is .
Answer .
Worked example
A filter's impulse response is , so its output energy for a unit impulse is . Find both ways.
Show the solution
- Directly. , so
- Differentiate the integrand.
- Check domination. For in any interval with , this is dominated by , which is integrable.
- Differentiate under the integral.
- Why it's useful. The same method gives sensitivities when the integral has no closed form, which is how circuit optimizers compute gradients of energy, noise or error measures.
Answer both ways give .
Check
Using , what is ?
Check
Starting from , differentiate 2 time(s) with respect to to find .
Check
What is at = 1.2?
Check
For , compute at t = 1 three ways: from the formula (exact), as a central difference of the formula with (diff), and by integrating numerically from 0 to 20 with Simpson's rule on 20 000 intervals (inside).
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Find from .
Step 1
What is ?
Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.
Step 2
And ?
Step 3
So
Check
is for all , yet differentiating inside gives a divergent integral. Which condition for the swap fails?
Explain why
Why does differentiating under an integral over an infinite range need a dominating function, when on a bounded range continuity is enough?
The derivative of the integral is the limit of integrals of difference quotients, and the swap claims that limit equals the integral of the limit. On a bounded box, continuity gives uniform continuity, so the difference quotients converge uniformly and uniform limits pass through integrals. On an infinite range uniformity can fail: the difference quotients can converge at each while their integrals over the far tail don't shrink, as with , whose derivative never decays. A single integrable function bounding all of them stops any mass from escaping to infinity, which is exactly what the dominated convergence theorem needs.
Practice
Keep practicing
6 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.