Quant Memo
Advanced

Differentiation Under the Integral Sign

A technique (sometimes called Feynman's trick) for evaluating a hard integral by introducing a parameter, differentiating the integral with respect to that parameter to get an easier integral, solving that, then integrating back — useful for computing moments and normalizing constants in probability.

Some integrals resist every standard substitution or integration-by-parts trick, yet become easy once you notice they're really one member of a whole family of integrals indexed by a parameter. Differentiating that family with respect to the parameter can produce a much simpler integral, which you solve directly and then integrate back with respect to the parameter to recover the original answer.

The method

Given a hard integral I=f(x)dxI = \int f(x)\, dx, find a natural parameter tt to insert so the integral becomes I(t)=f(x,t)dxI(t) = \int f(x, t)\, dx, with the original problem recovered at a specific value of tt. Differentiate under the integral sign, dIdt=ftdx\frac{dI}{dt} = \int \frac{\partial f}{\partial t}\, dx, swapping the order of differentiation and integration (valid under mild regularity conditions). If the resulting integral is easy, solve it to get dIdt\frac{dI}{dt} as a function of tt, then integrate that back over tt, using a known boundary value of II at some convenient tt to fix the constant of integration.

Worked example

To evaluate I=0exsinxxdxI = \int_0^\infty \frac{e^{-x}\sin x}{x}\, dx, introduce a parameter as I(t)=0etxsinxxdxI(t) = \int_0^\infty \frac{e^{-tx}\sin x}{x}\, dx with I(1)I(1) the target and I()=0I(\infty) = 0 as the known boundary. Differentiating gives I(t)=0etxsinxdx=11+t2I'(t) = -\int_0^\infty e^{-tx}\sin x\, dx = -\frac{1}{1+t^2}, an elementary Laplace-transform integral. Integrating I(t)I'(t) from tt to infinity (where II vanishes) gives I(t)=π2arctantI(t) = \frac{\pi}{2} - \arctan t, so I(1)=π2π4=π4I(1) = \frac{\pi}{2} - \frac{\pi}{4} = \frac{\pi}{4} — a closed-form answer to an integral with no elementary antiderivative.

Differentiation under the integral sign solves a hard integral by embedding it in a parametrized family, differentiating with respect to the parameter to get an easier integral, solving that, and integrating back using a known boundary value — turning problems with no elementary antiderivative into solvable ones.

Related concepts

Practice in interviews

Further reading

  • Feynman, Surely You're Joking, Mr. Feynman — 'A Different Box of Tools'
ShareTwitterLinkedIn