Integrals I: Feynman's Trick

Study Sheet

Integrals I: Feynman's Trick

Differentiation under the integral sign — the tool that makes impossible integrals routine

Differentiating Under the Integral

Tip
The method in one line

Embed the integral in a family I(a)=f(x,a)dxI(a) = \int f(x, a)\,dx, differentiate in the parameter, integrate back, and fix the constant from a value of aa where I(a)I(a) is known.

Why it works: ddaf(x,a)dx=fadx\dfrac{d}{da}\int f(x,a)\,dx = \int\dfrac{\partial f}{\partial a}\,dx whenever ff and af\partial_af are continuous (Leibniz rule). The parameter is chosen so that af\partial_a f is ELEMENTARY even though ff is not — a logarithm in a denominator, an oscillating factor, a power that refuses to integrate. Then I(a)I'(a) is a routine integral, I(a)I(a) is its antiderivative in aa, and one known value pins the constant. The technique is Richard Feynman's name for a trick already in Leibniz; on the Putnam it appears in some form most years.

Example
The model example: 01xa1lnxdx\int_0^1\frac{x^a - 1}{\ln x}dx

Set I(a)=01xa1lnxdxI(a) = \displaystyle\int_0^1\frac{x^a - 1}{\ln x}\,dx, with I(0)=0I(0) = 0.

Step 1 — differentiate in aa: axa1lnx=xalnxlnx=xa\partial_a\dfrac{x^a - 1}{\ln x} = \dfrac{x^a\ln x}{\ln x} = x^a — the logarithm cancels.

Step 2 — I(a)=01xadx=1a+1I'(a) = \int_0^1 x^a\,dx = \dfrac{1}{a+1}.

Step 3 — integrate back: I(a)=ln(a+1)+CI(a) = \ln(a + 1) + C, and I(0)=0I(0) = 0 gives C=0C = 0.

Step 4 — so 01x21lnxdx=ln3\int_0^1\frac{x^2 - 1}{\ln x}dx = \ln 3, and in general ln(a+1)\ln(a+1). Check: at a=1a = 1 the integrand is x1lnx1\tfrac{x - 1}{\ln x} \approx 1 near x=1x = 1 and 0\to 0 near 00, so a value near ln20.69\ln 2 \approx 0.69 is plausible ✓.

Example
The Dirichlet integral: 0sinxxdx=π2\int_0^\infty\frac{\sin x}{x}dx = \frac\pi2

The integrand has no elementary antiderivative; the parameter is a DAMPING factor.

Step 1 — define I(t)=0etxsinxxdxI(t) = \int_0^\infty e^{-tx}\dfrac{\sin x}{x}\,dx for t0t \ge 0; the target is I(0)I(0), and I(t)0I(t) \to 0 as tt \to \infty (the exponential crushes everything).

Step 2 — I(t)=0etxsinxdx=11+t2I'(t) = -\int_0^\infty e^{-tx}\sin x\,dx = -\dfrac{1}{1 + t^2} — a Laplace transform, computable by two integrations by parts or by taking the imaginary part of e(ti)xdx=1ti\int e^{-(t - i)x}dx = \tfrac{1}{t - i}.

Step 3 — integrate: I(t)=arctant+CI(t) = -\arctan t + C, and I()=0I(\infty) = 0 forces C=π2C = \tfrac\pi2.

Step 4 — I(0)=π2I(0) = \tfrac\pi2. (The interchange of limit and integral at t=0t = 0 needs care — Abel's theorem or dominated convergence — which is exactly the kind of sentence a Putnam grader wants to see.)

Side note
Where the parameter hides

If there is no parameter, invent one: replace a constant by aa (ex2eax2e^{-x^2} \to e^{-ax^2}), an exponent by aa (x2xax^2 \to x^a), or multiply by etxe^{-tx} to make a divergent-looking integral converge. Then ask which choice makes af\partial_a f elementary. That question, not the calculus, is the whole art.

Try it
Try it: a parameter in the exponent

Evaluate 0exe2xxdx\displaystyle\int_0^\infty\frac{e^{-x} - e^{-2x}}{x}\,dx by Feynman's trick.

Set I(a)=0exeaxxdxI(a) = \int_0^\infty\frac{e^{-x} - e^{-ax}}{x}dx with I(1)=0I(1) = 0. Then I(a)=0eaxdx=1aI'(a) = \int_0^\infty e^{-ax}dx = \tfrac1a, so I(a)=lnaI(a) = \ln a and I(2)=ln2I(2) = \ln 2. (This is also Frullani's theorem, topic 4 — two names for one mechanism.)

Proofs & Why It Matters

Tip
Proof: the Leibniz rule

If ff and af\partial_af are continuous on [c,d]×[a0,a1][c,d]\times[a_0, a_1], then ddacdf(x,a)dx=cdaf(x,a)dx\dfrac{d}{da}\int_c^d f(x,a)\,dx = \int_c^d\partial_af(x,a)\,dx.

Form the difference quotient I(a+h)I(a)h=cdf(x,a+h)f(x,a)hdx\dfrac{I(a + h) - I(a)}{h} = \int_c^d\dfrac{f(x, a+h) - f(x, a)}{h}dx. By the mean value theorem in aa, the integrand equals af(x,ξx)\partial_af(x, \xi_x) for some ξx\xi_x between aa and a+ha + h. Continuity of af\partial_af on the compact rectangle makes it uniformly continuous, so af(x,ξx)af(x,a)\partial_af(x, \xi_x) \to \partial_af(x, a) UNIFORMLY in xx as h0h \to 0 — and uniform convergence lets the limit pass inside the integral. \blacksquare For infinite intervals one needs a dominating integrable function (dominated convergence); Putnam solutions should say so in one sentence.

Tip
Proof: 0etxsinxdx=11+t2\int_0^\infty e^{-tx}\sin x\,dx = \frac{1}{1+t^2}

The Laplace transform that powers the Dirichlet integral.

Integrate by parts twice with u=sinxu = \sin x then u=cosxu = \cos x: J=0etxsinxdx=[etxtsinx]0+1t0etxcosxdx=1t([etxtcosx]01tJ)=1t21t2JJ = \int_0^\infty e^{-tx}\sin x\,dx = \left[-\tfrac{e^{-tx}}{t}\sin x\right]_0^\infty + \tfrac1t\int_0^\infty e^{-tx}\cos x\,dx = \tfrac1t\left(\left[-\tfrac{e^{-tx}}{t}\cos x\right]_0^\infty - \tfrac1t J\right) = \tfrac{1}{t^2} - \tfrac{1}{t^2}J. Solve: J(1+1t2)=1t2J(1 + \tfrac{1}{t^2}) = \tfrac{1}{t^2}, so J=11+t2J = \tfrac{1}{1 + t^2}. \blacksquare Significance: the same "bounce-back and solve" is the engine of exsinx\int e^x\sin x from first-year calculus — Feynman's trick is built from techniques you already own.

Going Deeper: Worked Problems

Example
Worked: the Gaussian with a parameter

Compute 0ex2cos(2bx)dx\displaystyle\int_0^\infty e^{-x^2}\cos(2bx)\,dx as a function of bb.

Step 1 — let I(b)I(b) be the integral; I(0)=π2I(0) = \tfrac{\sqrt\pi}{2} (half the Gaussian).

Step 2 — differentiate: I(b)=02xex2sin(2bx)dxI'(b) = -\int_0^\infty 2xe^{-x^2}\sin(2bx)\,dx.

Step 3 — integrate by parts with u=sin2bxu = \sin 2bx, dv=2xex2dxdv = 2xe^{-x^2}dx (so v=ex2v = -e^{-x^2}): I(b)=[ex2sin2bx]02b0ex2cos2bxdx=2bI(b)I'(b) = \left[e^{-x^2}\sin 2bx\right]_0^\infty - 2b\int_0^\infty e^{-x^2}\cos 2bx\,dx = -2bI(b).

Step 4 — a differential equation! I/I=2bI'/I = -2b gives I(b)=Ceb2I(b) = Ce^{-b^2}, and I(0)I(0) fixes CC: I(b)=π2eb2I(b) = \tfrac{\sqrt\pi}{2}e^{-b^2}.

Step 5 — the lesson: sometimes II' is expressed back in terms of II, and Feynman's trick hands you an ODE instead of a direct integral.

Example
Worked: 0πln(12acosx+a2)dx\int_0^{\pi}\ln(1 - 2a\cos x + a^2)\,dx for a<1|a| < 1

A Putnam classic with the parameter already present.

Step 1 — I(a)=0π2a2cosx12acosx+a2dxI'(a) = \int_0^\pi\dfrac{2a - 2\cos x}{1 - 2a\cos x + a^2}dx.

Step 2 — the Weierstrass substitution (topic 4) or the identity 2a2cosx12acosx+a2=1a(11a212acosx+a2)\dfrac{2a - 2\cos x}{1 - 2a\cos x + a^2} = \dfrac1a\left(1 - \dfrac{1 - a^2}{1 - 2a\cos x + a^2}\right) reduces it to the standard 0πdx12acosx+a2=π1a2\int_0^\pi\dfrac{dx}{1 - 2a\cos x + a^2} = \dfrac{\pi}{1 - a^2}.

Step 3 — so I(a)=1a(ππ)=0I'(a) = \dfrac1a(\pi - \pi) = 0 for a<1|a| < 1.

Step 4 — II is constant, and I(0)=0πln1dx=0I(0) = \int_0^\pi\ln 1\,dx = 0: the integral is 00 for every a<1|a| < 1. (For a>1|a| > 1, factor out a2a^2 to get 2πlna2\pi\ln|a|.) A whole family of integrals evaluated by showing the derivative vanishes.