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: dda∫f(x,a) dx=∫∂f∂a dx\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: ∫01xa−1ln⁡xdx\int_0^1\frac{x^a - 1}{\ln x}dx

Set I(a)=∫01xa−1ln⁡x dxI(a) = \displaystyle\int_0^1\frac{x^a - 1}{\ln x}\,dx, with I(0)=0I(0) = 0.

Step 1 — differentiate in aa: ∂axa−1ln⁡x=xaln⁡xln⁡x=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)=∫01xa dx=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 ∫01x2−1ln⁡xdx=ln⁡3\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 x−1ln⁡x≈1\tfrac{x - 1}{\ln x} \approx 1 near x=1x = 1 and →0\to 0 near 00, so a value near ln⁡2≈0.69\ln 2 \approx 0.69 is plausible ✓.

Example
The Dirichlet integral: ∫0∞sin⁡xxdx=π2\int_0^\infty\frac{\sin x}{x}dx = \frac\pi2
xy51015e^(−x/4)sin x / x
sin x/x (solid) and its damped version e^(−x/4) sin x/x (dashed): the damping makes the integral absolutely convergent, and I(1/4) = π/2 − arctan(1/4) ≈ 1.326.

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

Step 1 — define I(t)=∫0∞e−txsin⁡xx dxI(t) = \int_0^\infty e^{-tx}\dfrac{\sin x}{x}\,dx for t≥0t \ge 0; the target is I(0)I(0), and I(t)→0I(t) \to 0 as t→∞t \to \infty (the exponential crushes everything).

Step 2 — I′(t)=−∫0∞e−txsin⁡x dx=−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−(t−i)xdx=1t−i\int e^{-(t - i)x}dx = \tfrac{1}{t - i}.

Step 3 — integrate: I(t)=−arctan⁡t+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 (e−x2→e−ax2e^{-x^2} \to e^{-ax^2}), an exponent by aa (x2→xax^2 \to x^a), or multiply by e−txe^{-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.

Side note
Where it goes wrong

Differentiate the Dirichlet integral directly. J(a)=∫0∞sin⁡axxdx=π2J(a) = \int_0^\infty\frac{\sin ax}{x}dx = \frac\pi2 for every a>0a > 0 (substitute t=axt = ax), so J′(a)=0J'(a) = 0. The naive Leibniz step gives J′(a)=∫0∞cos⁡(ax) dxJ'(a) = \int_0^\infty\cos(ax)\,dx, which does not converge at all. The rule "differentiate under the integral" needs a dominating function — an integrable g(x)g(x) with ∣∂af(x,a)∣≤g(x)|\partial_af(x, a)| \le g(x) for all aa in question — and ∣cos⁡ax∣|\cos ax| has none on [0,∞)[0, \infty). That is exactly why the solution above inserts e−txe^{-tx}: for t≥t0>0t \ge t_0 > 0, ∣∂t(e−txsin⁡xx)∣≤e−t0x|\partial_t(e^{-tx}\tfrac{\sin x}{x})| \le e^{-t_0x}, which is integrable.

Try it
Try it: a parameter in the exponent

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

Show the answer

Set I(a)=∫0∞e−x−e−axxdxI(a) = \int_0^\infty\frac{e^{-x} - e^{-ax}}{x}dx with I(1)=0I(1) = 0. Then I′(a)=∫0∞e−axdx=1aI'(a) = \int_0^\infty e^{-ax}dx = \tfrac1a, so I(a)=ln⁡aI(a) = \ln a and I(2)=ln⁡2I(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 dda∫cdf(x,a) dx=∫cd∂af(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 h→0h \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: ∫0∞e−txsin⁡x dx=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=sin⁡xu = \sin x then u=cos⁡xu = \cos x: J=∫0∞e−txsin⁡x dx=[−e−txtsin⁡x]0∞+1t∫0∞e−txcos⁡x dx=1t([−e−txtcos⁡x]0∞−1tJ)=1t2−1t2JJ = \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 ∫exsin⁡x\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 ∫0∞e−x2cos⁡(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)=−∫0∞2xe−x2sin⁡(2bx) dxI'(b) = -\int_0^\infty 2xe^{-x^2}\sin(2bx)\,dx.

Step 3 — integrate by parts with u=sin⁡2bxu = \sin 2bx, dv=2xe−x2dxdv = 2xe^{-x^2}dx (so v=−e−x2v = -e^{-x^2}): I′(b)=[e−x2sin⁡2bx]0∞−2b∫0∞e−x2cos⁡2bx dx=−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)=Ce−b2I(b) = Ce^{-b^2}, and I(0)I(0) fixes CC: I(b)=π2e−b2I(b) = \tfrac{\sqrt\pi}{2}e^{-b^2}.

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

Example
Worked: ∫0πln⁡(1−2acos⁡x+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π2a−2cos⁡x1−2acos⁡x+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 2a−2cos⁡x1−2acos⁡x+a2=1a(1−1−a21−2acos⁡x+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πdx1−2acos⁡x+a2=π1−a2\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πln⁡1 dx=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πln⁡∣a∣2\pi\ln|a|.) A whole family of integrals evaluated by showing the derivative vanishes.