Skip to Content
All Posts

Feynman's Technique for Computing Integrals



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)=abkf(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.


Problem 1



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

g(k)=01xk1lnxdxg(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=ddk01xk1lnxdx=01kxk1lnxdx=01xklnxlnxdx=01xkdx=xk+1k+101=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}



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

g(k)=01xk1lnxdx.g(k) = \int_{0}^{1}\frac{x^k-1}{\ln{x}}dx.

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

g(0)=0111lnxdx=0.g(0)=\int_{0}^{1}\frac{1-1}{\ln{x}}dx = 0.

Substituting into #eq-1,

g(0)=ln0+1+C0=0+CC=0g(k)=lnk+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).

01x21lnxdx=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


0πln(12αcosx+α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.


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

dfdα=ddα0π2cosx+2α12αcosx+α2dx=0παln(12αcosx+α2)dx=0π2cosx+2α12αcosx+α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π2cosx+2α12αcosx+α2dx=1α0π2αcosx+2α212αcosx+α2dx=1α0π2αcosx+2α212αcosx+α2dx1+1=1α0π2αcosx+2α212αcosx+α2dx12αcosx+α212αcosx+α2+1=1α0πα2112αcosx+α2dx+1=1α0π11α212αcosx+α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

dfdα=1α(π1α21+α2)0π112α1+α2cosxdx=πα(1α)(1α21+α2)0π112α1+α2cosxdx.\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=2arctanux=2\arctan{u}. Then cosx=1u21+u2\cos{x}=\frac{1-u^2}{1+u^2}, u=tanx2u=\tan{\frac{x}{2}}, and dx=2du1+u2dx=\frac{2du}{1+u^2}.

0π112α1+α2cosxdx=0π2du12α1+α21u21+u2=0π2du1+u22α(1u2)1+α2=0π2(1+α2)du(1+u2)(1+α2)2α(1u2)=0π2(1+α2)du1+u2+α2+u2α22α+2αu2=0π2(1+α2)du12α+α2+u2(1+2α+α2)=0π2(1+α2)du(1α)2+(1+α)2u2=2(1+α2)(1α)20π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{)}.


2(1+α2)(1α)20πdu1+(1+α1α)2u2=2(1+α2)(1α)(1+α)0dβ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+α)0dβ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:

f(α)=2πlnα+C.f(\alpha) = 2\pi\ln{|\alpha|}+C.

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


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(22cosx)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


so C=0.C=0.

Finishing up,

0πln(12αcosx+α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

    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)

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

    Hint Let f(k)=0πekcosxcos(ksinx)dx.\displaystyle{f(k)=\int_{0}^{\pi}e^{k\cos{x}}\cos({k\sin{x}})}dx.
    Answer π\boxed{\pi}

Happy integrating!


  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, Accessed 18 Jan. 2020.