Skip to Content
←All Posts

Feynman's Technique for Computing Integrals

 — 

Introduction

During his high school years, renowned American theoretical physicist Richard Feynman was not the best student. Though clearly gifted, he struggled to stay engaged in class. One day, Feynman's physics teacher, Mr. Bader, pulled Feynman after class and said to him,

Feynman, you talk too much, and you make too much noise. I know why. You’re bored. So I’m going to give you a book. You go up there in the back, in the corner, and study this book, and when you know everything that’s in this book, you can talk again (Feynman).

The book was Advanced Calculus, published in 1926 by MIT mathematician Frederick S. Woods. It contained all kinds of concepts that Feynman didn't know about, including a method of solving integrals called the Leibniz Integral Rule. The Leibniz Integral Rule, also known as differentiation under the integral sign, was not emphasized in university, but Feynman would use it time and time again.

According to Feynman,

When guys at MIT or Princeton had trouble doing a certain integral, it was because they couldn’t do it with the standard methods they had learned in school...Then I come along and try differentiating under the integral sign, and often it worked. So I got a great reputation for doing integrals, only because my box of tools was different from everybody else's (Feynman).

This article is about the Leibniz Integral Rule, which is colloquially referred to as Feynman's Technique for Computing Integrals.

How Feynman's Technique Works

Leibniz's Rule states that given a differentiable function f(x,k)f(x,k),

ddk(∫abf(x,k)dx)=∫ab∂∂kf(x,k)dx.\frac{d}{dk}\bigg(\int_{a}^{b}f(x,k)dx\bigg)=\int_{a}^{b}\frac{\partial}{\partial k}f(x,k)dx.

In other words, it is possible to interchange the derivative operator and the integral in certain circumstances. Feynman's Technique employs this rule to change a seemingly impossible integral into a solvable differential equation.

Examples

Problem 1

Evaluate

∫01x2−1ln⁡xdx.\int_{0}^{1}\frac{x^2-1}{\ln{x}}dx.

The integrand must have two unknowns to apply Feynman's technique, so we introduce the constant kk such that

g(k)=∫01xk−1ln⁡xdxg(k) = \int_{0}^{1}\frac{x^k-1}{\ln{x}}dx

for k>0k>0. This step (assigning a new variable) is the most difficult part, and in some cases there won't be any suitable options. Fortunately, in this case, replacing the exponent with kk will later allow us to cancel out the ln⁡(x).\ln(x).

We proceed with differentiating under the integral sign.

dgdk=ddk∫01xk−1ln⁡xdx=∫01∂∂kxk−1ln⁡xdx=∫01xkln⁡xln⁡xdx=∫01xkdx=xk+1k+1∣01=1k+1.\begin{split} \frac{dg}{dk} &= \frac{d}{dk}\int_{0}^{1}\frac{x^k-1}{\ln{x}}dx \\ &= \int_{0}^{1}\frac{\partial}{\partial k}\frac{x^k-1}{\ln{x}}dx \\ &= \int_{0}^{1}\frac{x^k\ln{x}}{\ln{x}}dx \\ &= \int_{0}^{1}x^kdx \\ &= \frac{x^{k+1}}{k+1}\bigg\vert_{0}^{1} \\ &= \frac{1}{k+1}. \end{split}

Therefore

#eq-1
g(k)=ln⁡∣k+1∣+C.g(k)=\ln{|k+1|}+C.

As our final step, we must find CC using our original equation

g(k)=∫01xk−1ln⁡xdx.g(k) = \int_{0}^{1}\frac{x^k-1}{\ln{x}}dx.

Logically, we start with k=0k=0.

g(0)=∫011−1ln⁡xdx=0.g(0)=\int_{0}^{1}\frac{1-1}{\ln{x}}dx = 0.

Substituting into #eq-1,

g(0)=ln⁡∣0+1∣+C0=0+CC=0g(k)=ln⁡∣k+1∣.\begin{split} g(0) &= \ln{|0+1|}+C \\ 0 &= 0+C \\ C &= 0 \\ g(k) &= \ln{|k+1|}. \end{split}

Finally, to solve the original integral we calculate g(2)g(2).

∫01x2−1ln⁡xdx=g(2)=ln⁡(3).\int_{0}^{1}\frac{x^2-1}{\ln{x}}dx = g(2) = \boxed{\ln({3})}.

Not bad! Here is a more complicated example.

Problem 2

Evaluate

∫0πln⁡(1−2αcos⁡x+α2)dx\int_{0}^{\pi} \ln(1-2\alpha\cos{x}+\alpha^2)dx

for ∣α∣<1|\alpha|<1.


Again, the usual tricks will not result in a solution; the reader can attempt it if they wish. It turns out that Feynman's Technique is the only method that works.

This time, there are already two variables in the integrand, α\alpha and xx. In this case, we will treat the integral as a function of α\alpha.

f(α)=∫0πln⁡(1−2αcos⁡x+α2)dx.f(\alpha)=\int_{0}^{\pi}\ln(1-2\alpha\cos{x}+\alpha^2)dx.

Now we differentiate under the integral sign with respect to alpha.

dfdα=ddα∫0π−2cos⁡x+2α1−2αcos⁡x+α2dx=∫0π∂∂αln⁡(1−2αcos⁡x+α2)dx=∫0π−2cos⁡x+2α1−2αcos⁡x+α2dx.\begin{split} \frac{df}{d\alpha} &= \frac{d}{d\alpha}\int_{0}^{\pi}\frac{-2\cos{x}+2\alpha}{1-2\alpha\cos{x}+\alpha^2}dx \\ &= \int_{0}^{\pi}\frac{\partial}{\partial \alpha}\ln(1-2\alpha\cos{x}+\alpha^2)dx \\ &= \int_{0}^{\pi}\frac{-2\cos{x}+2\alpha}{1-2\alpha\cos{x}+\alpha^2}dx. \end{split}

While this looks messy, it is indeed solvable.

∫0π−2cos⁡x+2α1−2αcos⁡x+α2dx=1α∫0π−2αcos⁡x+2α21−2αcos⁡x+α2dx=1α∫0π−2αcos⁡x+2α21−2αcos⁡x+α2dx−1+1=1α∫0π−2αcos⁡x+2α21−2αcos⁡x+α2dx−1−2αcos⁡x+α21−2αcos⁡x+α2+1=1α∫0πα2−11−2αcos⁡x+α2dx+1=1α∫0π1−1−α21−2αcos⁡x+α2dx.\begin{split} \int_{0}^{\pi}\frac{-2\cos{x}+2\alpha}{1-2\alpha\cos{x}+\alpha^2}dx &= \frac{1}{\alpha}\int_{0}^{\pi}\frac{-2\alpha\cos{x}+2\alpha^2}{1-2\alpha\cos{x}+\alpha^2}dx \\&= \frac{1}{\alpha}\int_{0}^{\pi}\frac{-2\alpha\cos{x}+2\alpha^2}{1-2\alpha\cos{x}+\alpha^2}dx - 1 + 1 \\&=\frac{1}{\alpha}\int_{0}^{\pi}\frac{-2\alpha\cos{x}+2\alpha^2}{1-2\alpha\cos{x}+\alpha^2}dx - \frac{1-2\alpha\cos{x}+\alpha^2}{1-2\alpha\cos{x}+\alpha^2} + 1 \\&=\frac{1}{\alpha}\int_{0}^{\pi}\frac{\alpha^2-1}{1-2\alpha\cos{x}+\alpha^2}dx + 1 \\&= \frac{1}{\alpha}\int_{0}^{\pi}1 - \frac{1-\alpha^2}{1-2\alpha\cos{x}+\alpha^2}dx. \end{split}

Dividing everything by 1+α21+\alpha^2, we get

#eq-2
dfdα=1α(π−1−α21+α2)∫0π11−2α1+α2cos⁡xdx=πα−(1α)(1−α21+α2)∫0π11−2α1+α2cos⁡xdx.\begin{split} \frac{df}{d\alpha} &= \frac{1}{\alpha}\bigg(\pi-\frac{1-\alpha^2}{1+\alpha^2}\bigg)\int_{0}^{\pi}\frac{1}{1-\frac{2\alpha}{1+\alpha^2}\cos{x}}dx \\&= \frac{\pi}{\alpha}-\bigg(\frac{1}{\alpha}\bigg)\bigg(\frac{1-\alpha^2}{1+\alpha^2}\bigg)\int_{0}^{\pi}\frac{1}{1-\frac{2\alpha}{1+\alpha^2}\cos{x}}dx. \end{split}

Finally, the rightmost integral is solvable! We use a reverse uu substitution: let x=2arctan⁡ux=2\arctan{u}. Then cos⁡x=1−u21+u2\cos{x}=\frac{1-u^2}{1+u^2}, u=tan⁡x2u=\tan{\frac{x}{2}}, and dx=2du1+u2dx=\frac{2du}{1+u^2}.

∫0π11−2α1+α2cos⁡xdx=∫0π2du1−2α1+α21−u21+u2=∫0π2du1+u2−2α(1−u2)1+α2=∫0π2(1+α2)du(1+u2)(1+α2)−2α(1−u2)=∫0π2(1+α2)du1+u2+α2+u2α2−2α+2αu2=∫0π2(1+α2)du1−2α+α2+u2(1+2α+α2)=∫0π2(1+α2)du(1−α)2+(1+α)2u2=2(1+α2)(1−α)2∫0πdu1+(1+α1−α)2u2.\begin{split} \int_{0}^{\pi}\frac{1}{1-\frac{2\alpha}{1+\alpha^2}\cos{x}}dx &= \int_{0}^{\pi}\frac{2du}{1-\frac{2\alpha}{1+\alpha^2}\frac{1-u^2}{1+u^2}}\\ &= \int_{0}^{\pi}\frac{2du}{1+u^2-\frac{2\alpha(1-u^2)}{1+\alpha^2}} \\&= \int_{0}^{\pi}\frac{2(1+\alpha^2)du}{(1+u^2)(1+\alpha^2)-2\alpha(1-u^2)} \\&= \int_{0}^{\pi}\frac{2(1+\alpha^2)du}{1+u^2+\alpha^2+u^2\alpha^2-2\alpha+2\alpha u^2} \\&= \int_{0}^{\pi}\frac{2(1+\alpha^2)du}{1-2\alpha+\alpha^2+u^2(1+2\alpha+\alpha^2)}\\&= \int_{0}^{\pi}\frac{2(1+\alpha^2)du}{(1-\alpha)^2+(1+\alpha)^2u^2} \\&= \frac{2(1+\alpha^2)}{(1-\alpha)^2}\int_{0}^{\pi}\frac{du}{1+(\frac{1+\alpha}{1-\alpha})^2u^2}. \end{split}

Note that 1+α1−α\frac{1+\alpha}{1-\alpha} ranges from 0 to −∞-\infty because ∣α∣<1|\alpha|<1. To simplify things, we declare a constant β\beta such that

β=1+α1−αu and dβ=1+α1−αdu (so du=1−α1+αdβ).\beta=\frac{1+\alpha}{1-\alpha}u \text{ and } d\beta=\frac{1+\alpha}{1-\alpha}du \text { (so } du=\frac{1-\alpha}{1+\alpha}d\beta \text{)}.

Substituting,

2(1+α2)(1−α)2∫0πdu1+(1+α1−α)2u2=2(1+α2)(1−α)(1+α)∫0−∞dβ1+β2.\frac{2(1+\alpha^2)}{(1-\alpha)^2}\int_{0}^{\pi}\frac{du}{1+(\frac{1+\alpha}{1-\alpha})^2u^2} = \frac{2(1+\alpha^2)}{(1-\alpha)(1+\alpha)}\int_{0}^{-\infty}\frac{d\beta}{1+\beta^2}.

This looks familiar; it's arctan!

2(1+α2)(1−α)(1+α)∫0−∞dβ1+β2=2(1+α2)1−α2arctan⁡β∣0−∞=2(1+α2)1−α2(−π2)=−π(1+α2)1−α2.\begin{split} \frac{2(1+\alpha^2)}{(1-\alpha)(1+\alpha)}\int_{0}^{-\infty}\frac{d\beta}{1+\beta^2} &= \frac{2(1+\alpha^2)}{1-\alpha^2}\arctan{\beta}\bigg\vert_{0}^{-\infty} \\&= \frac{2(1+\alpha^2)}{1-\alpha^2}(\frac{-\pi}{2}) \\&= \frac{-\pi(1+\alpha^2)}{1-\alpha^2}. \end{split}

The integral portion of #eq-2 is now simplified, but we must not forget the multipliers.

dfdα=πα−(1α)(1−α21+α2)−π(1+α2)1−α2=πα−−πα=2πα.\frac{df}{d\alpha} = \frac{\pi}{\alpha}-\bigg(\frac{1}{\alpha}\bigg)\bigg(\frac{1-\alpha^2}{1+\alpha^2}\bigg)\frac{-\pi(1+\alpha^2)}{1-\alpha^2} = \frac{\pi}{\alpha}-\frac{-\pi}{\alpha} = \frac{2\pi}{\alpha}.

We can now solve for f(α)f(\alpha) by integrating:

#eq-3
f(α)=2πln⁡∣α∣+C.f(\alpha) = 2\pi\ln{|\alpha|}+C.

Our final step is to find CC using our original equation,

f(α)=∫0πln⁡(1−2αcos⁡x+α2)dx.f(\alpha)=\int_{0}^{\pi}\ln(1-2\alpha\cos{x}+\alpha^2)dx.

We first consider substituting α=0\alpha=0, but we note that it would give us ln⁡(0)\ln{(0)} in #eq-3, which is undefined. We try α=1\alpha=1 next:

f(1)=∫0πln⁡(2−2cos⁡x)dx.f(1)=\int_{0}^{\pi} \ln(2-2\cos{x})dx.

This integral evaluates to 0. The derivation is left as an exercise to the reader.

It follows that

f(1)=2πln⁡(1)+C=0+C=0,f(1)=2\pi\ln{(1)}+C=0+C=0,

so C=0.C=0.

Finishing up,

∫0πln⁡(1−2αcos⁡x+α2)dx for ∣α∣<1=f(α)=2πln⁡∣α∣.\int_{0}^{\pi} \ln(1-2\alpha\cos{x}+\alpha^2)dx \text{ for } |\alpha|<1 = f(\alpha) = \boxed{2\pi\ln{|\alpha|}}.

The technique of differentiating under the integral sign is not commonly used, but very powerful in certain situations.

Exercises for the Reader

The solution to these integrals are much shorter than the first example, so don't hesitate to try them.

  1. Use Feynman's technique to evaluate

    ∫01(2x+k3)2dx.\int_{0}^{1}(2x+k^3)^2dx.
    Hint Take the derivative with respect to k.k.
    Answer 6k5+6k2\boxed{6k^5+6k^2}
  2. Use Feynman's technique to evaluate the following integral (2005 Putnam Competition, #A5)

    ∫01ln⁡(x+1)x2+1dx\int_{0}^{1}\frac{\ln(x+1)}{x^2+1}dx
    Hint Let f(k)=∫01ln⁡(kx−1)x2+1dx.\displaystyle{f(k)=\int_{0}^{1}\frac{\ln({kx-1})}{x^2+1}}dx.
    Answer πln⁡28\boxed{\dfrac{\pi\ln{2}}{8}}
  3. Use Feynman's technique to evaluate

    ∫0πecos⁡xcos⁡(sin⁡x)dx.\int_{0}^{\pi}e^{\cos{x}}\cos{(\sin{x})}dx.
    Hint Let f(k)=∫0πekcos⁡xcos⁡(ksin⁡x)dx.\displaystyle{f(k)=\int_{0}^{\pi}e^{k\cos{x}}\cos({k\sin{x}})}dx.
    Answer π\boxed{\pi}

Happy integrating!

References

  1. Feynman, Richard P. Surely You're Joking, Mr. Feynman! Bantam Books, 1986.

  2. The Red, Panda. Richard Feynman's Integral Trick.. Medium, 16 July 2018, https://medium.com/cantors-paradise/richard-feynmans-integral-trick-e7afae85e25c. Accessed 18 Jan. 2020.