The beat of a different drum

“I had learned to do integrals by various methods shown in a book that my high school physics teacher Mr. Bader had given me. [It] showed how to differentiate parameters under the integral sign — it’s a certain operation. It turns out that’s not taught very much in the universities; they don’t emphasize it. But I caught on how to use that method, and I used that one damn tool again and again. [If] guys at MIT or Princeton had trouble doing a certain integral, [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, and they had tried all their tools on it before giving the problem to me.” (Richard P. Feynman, “Surely You’re Joking, Mr. Feynman!”, Bantam Book, 1985)

“Feynman’s Trick” is a powerful technique for evaluating nontrivial definite integrals. It is based on Leibniz’s rule (LR-1) which states:

Let f(x, \beta) be a differentiable function in\beta with \frac{\partial}{\partial \beta}f(x, \beta) continuous. Then

\frac{d}{d\beta}\int\limits_{a}^{b}f(x, \beta)\;dx = \int\limits_{a}^{b}\frac{\partial}{\partial \beta}f(x, \beta)\;dx.

This is how it works in practice:

To evaluate definite integral

\int\limits_{a}^{b} f(x)\;dx,

we introduce into integrand f(x) a parameter \beta such that

f(x) = f(x, \beta) when \beta = \beta_0\quad\quad\quad(1)


\int\limits_{a}^{b}f(x,\beta)\;dx = f_* when \beta = \beta_*.\quad\quad\quad(2)


\int\limits_{a}^{b}\frac{\partial}{\partial \beta}f(x,\beta)\; dx=g(\beta).\quad\quad\quad(3)

By Leibniz’s rule,

\frac{d}{d\beta}\int\limits_{a}^{b}f(x, \beta)=\int\limits_{a}^{b}\frac{\partial}{\partial \beta}f(x,\beta)\; dx\overset{(3)}{=}g(\beta).\quad\quad\quad(4)

Integrate (4) with respect to \beta:

\int \left(\frac{d}{d\beta}\int\limits_{a}^{b}f(x, \beta)\;dx\right) \; d\beta = \int g(\beta)\;d\beta\implies \int\limits_{a}^{b}f(x,\beta)\;dx = G(\beta)+ C\quad(5)

where G'(\beta)=g(\beta).

Let \beta=\beta_*,

\int\limits_{a}^{b}f(x, \beta_*)\;dx \overset{(2)}{=} f_* \overset{(5)}{=} G(\beta_*) + C\implies C=f_*-G(\beta_*).

Let \beta = \beta_0,

\int\limits_{a}^{b}f(x) \;dx \overset{(1)}{=} \int\limits_{a}^{b}f(x, \beta_0)\;dx\overset{(5)}{=} G(\beta_0)  + C.

And so,

\int\limits_{a}^{b}f(x) \;dx = G(\beta_0)  + f_*-G(\beta_*).

Now, let’s play “Feynman’s Trick” on definite integral \int\limits_{0}^{1} \frac{x-1}{\log(x)}\;dx:

Differentiate \int\limits_{0}^{1}\frac{x^{\beta}-1}{\log(x)}\;dx with respect to \beta, we have

\frac{d}{d\beta}\int\limits_{0}^{1}\frac{x^\beta-1}{\log(x)}\;dx =\int\limits_{0}^{1}\frac{\partial}{\partial \beta}\frac{x^{\beta-1}}{\log(x)}\;dx=\int\limits_{0}^{1}\frac{x^{\beta}\log(x)}{\log(x)}\;dx=\int\limits_{0}^{1}x^{\beta}\;dx=\frac{x^{\beta+1}}{\beta+1}\bigg|_{0}^{1}=\frac{1}{\beta+1}.

It means

\int\limits_{0}^{1}\frac{x^{\beta}-1}{\log(x)}\;dx=\int\frac{1}{\beta+1}\;d\beta = \log(\beta+1)+C\overset{\beta=0}{\implies} 0=\log(0+1) +C \implies C=0.


\int\limits_{0}^{1}\frac{x^{\beta}-1}{\log(x)}\;dx = \log(\beta+1).

Let \beta=1,

\int\limits_{0}^{1}\frac{x-1}{\log(x)}\;dx = \log(2).

Exercise-1 Given \int\limits_{-\infty}^{\infty}\frac{e^{2x}}{ae^{3x}+b}\;dx = \frac{2\pi}{3\sqrt{3}a^{2/3}b^{1/3}} where a, b >0. Show that

\int\limits_{-\infty}^{\infty}\frac{e^{2x}}{(e^{3x}+1)^2}\;dx = \frac{2\pi}{9\sqrt{3}}.


Playing “Feynman’s Trick” on Indefinite Integrals – Tongue in Cheek

“Differentiation under the integral sign”, a.k.a., “Feynman’s trick” is a clever application of Leibniz’s rule (LR-1):

Let f(x, \beta) be continuous and have a continuous derivative \frac{\partial}{\partial \beta} in a domain of x\beta-plane that includes the rectangle a \le x \le b, \beta_1 \le \beta \le \beta_2,

\frac{d}{d\beta}\int\limits_{a}^{b}f(x, \beta)\;dx =\int\limits_{a}^{b}\frac{\partial}{\partial \beta}f(x, \beta)\;dx.

“Feynman’s trick” is known to be an effective technique for evaluating difficult definite integral such as \int\limits_{0}^{1}\frac{x-1}{\log(x)}\;dx.

Is Feynman’s “trick” applicable to indefinite integrals too?

In other words, is it also true that

\frac{\partial}{\partial \beta}\int f(x, \beta)\;dx + C = \int \frac{\partial}{\partial \beta}f(x, \beta)\;dx?\quad\quad\quad(\star)

Let’s apply(\star) to indefinite integral \int \log(x)\;dx:

\frac{\partial}{\partial \beta}\int x^{\beta}\;dx+C = \int \frac{\partial}{\partial \beta}x^{\beta}\;dx = \int x^{\beta}\log(x)\;dx;


\int x^{\beta}\log(x)\;dx =\frac{\partial}{\partial \beta}\int x^{\beta}\;dx+C.\quad\quad\quad(1)

Since \int x^{\beta}\; dx = \frac{x^{\beta+1}}{\beta+1} + C_1, the right-hand side of (1) is

\frac{\partial}{\partial \beta}\left(\frac{x^{\beta+1}}{\beta+1}+C_1\right) + C= \frac{x^{\beta+1}\log(x)\cdot (\beta+1) - x^{\beta+1}}{(\beta+1)^2}+C.

It means

\int x^{\beta}\log(x)\;dx = \frac{x^{\beta+1}\log(x)\cdot (\beta+1) - x^{\beta+1}}{(\beta+1)^2}+C.

For \beta = 0, we have

\int \log(x)\;dx = x\log(x)-x+C.

It checks out:

\frac{d}{dx}(x\log(x)-x+C) = \log(x)+x \cdot \frac{1}{x}-1 = \log(x).

Let’s also evaluate \int x e^{x}\;dx:

By (\star),

\frac{\partial}{\partial \beta}\int e^{\beta x}\;dx + C  = \int\frac{\partial}{\partial \beta} e^{\beta x}\;dx=\int x e^{\beta x}\;dx.

That is,

\int x e^{\beta x}\;dx = \frac{\partial}{\partial \beta}\int e^{\beta x}\; dx+C= \frac{\partial}{\partial \beta}\left(\frac{1}{\beta}e^{\beta x} + C_1\right)+C=\frac{e^{\beta x}\beta x - e^{\beta x}}{\beta^2}+C.\quad\quad(2)

Let \beta = 1, (2) yields

\int x e^{x} \;dx= e^x (x-1)+C.

It checks out too:

\frac{d}{dx} (e^x (x-1)+C) = e^x(x-1) + e^x = x e^x.

This image has an empty alt attribute; its file name is images.png

Now that we have gained confidence in the validity of (\star), let’s prove it.


G_1(x) = \int g(x)\;dx, G_2(x) = \int\limits_{a}^{x} g(x)\; dx

where g(x) is a function of x, we have,

(G_1(x)-G_2(x))' = (\int g(x)\;dx)' -  (\int\limits_{a}^{x}  g(x) \;dx)'= g(x)-g(x) = 0.

It means

G_1(x)-G_2(x)=C\implies \int g(x)\;dx= \int\limits_{a}^{x}g(x)\;dx + C.

When x=b,

\int g(x)\;dx = \int\limits_{a}^{b}g(x)\;dx+C;

i.e., for f(x,\beta), a function of both x and \beta,

\int f(x,\beta)\;dx = \int\limits_{a}^{b} f(x, \beta)\;dx+C.\quad\quad\quad(3)


\int \frac{\partial}{\partial \beta} f(x,\beta)\;dx = \int\limits_{a}^{b} \frac{\partial}{\partial \beta}f(x, \beta)\;dx+C.\quad\quad\quad(4)

It follows that

\frac{\partial}{\partial \beta}\int f(x,\beta)\;dx \overset{(3)}{=} \frac{\partial}{\partial \beta}\left(\int\limits_{a}^{b}f(x,\beta)\;dx+C\right)

=\frac{\partial}{\partial \beta}\int\limits_{a}^{b}f(x,\beta)\;dx

\overset{\textbf{LR-1}}{=} \int\limits_{a}^{b}\frac{\partial}{\partial \beta}f(x,\beta)\;dt

\overset{(4)}{=} \int\frac{\partial }{\partial \beta}f(x,\beta)\;dx -C.

And so,

\frac{\partial}{\partial \beta}\int f(x,\beta)\;dx +C= \int \frac{\partial}{\partial \beta} f(x,\beta)\;dx.

Exercise-1 Evaluate \int x^2 e^x\;dx.

hint: \frac{\partial}{\partial \beta}\int x e^{\beta x}\;dx = \int x^2 e^{\beta x}\; dx.


Problem Given

f(x) = e^x + \int\limits_{0}^{x} (t-x)f(t)\;dt\quad\quad\quad(\star)

where f(x) is a continuous function, find f(x).


From (\star), we see that

f(0) = 1;

f(x) = e^x + \int\limits_{0}^{x} t\cdot f(t) - x\cdot f(t) \;dt = e^x + \int\limits_{0}^{x} t\cdot f(t)\;dt-x\cdot \int\limits_{0}^{x}f(t)\;dt.

And so,

\frac{df(x)}{dx}=\frac{de^x}{dx} + \frac{d}{dx}\int\limits_{0}^{x}tf(t)\;dt - \frac{d}{dx}\left(x\cdot \int\limits_{0}^{x}f(t)\;dt\right)

=e^x+\frac{d}{dx}\int\limits_{0}^{x}tf(t)\;dt-\left(\int\limits_{0}^{x}f(t)\;dt + x\frac{d}{dx}\int\limits_{0}^{x}f(t)\;dt\right)

\overset{\textbf{FTC}}{=}e^x + xf(x) -\int\limits_{0}^{x} f(t)\;dt - xf(x)

= e^x - \int\limits_{0}^{x}f(t)\;dt

That is,

\frac{d}{dx}f(x)= e^x - \int\limits_{0}^{x}f(t)\;dt\implies f'(0) = 1.

It follows that



\begin{cases} f''(x)=e^x-f(x) \\f(0)=1\\f'(0)=1 \end{cases}\quad\quad\quad(\star\star)


f(x) = \frac{1}{2}(\sin(x)+\cos(x)+e^x).

Fig. 1

Notice the derivation of (\star\star) can be simplified if the generalized Leibniz’s Rule (GLR, see “Deriving Generalized Leibniz’s Integral Rule”) is applied:

\frac{df(x)}{dx} = e^x + \underline{\frac{d}{dx}\int\limits_{0}^{x}(t-x)f(t)\;dt}

\overset{\textbf{GLR}}{=} e^x + \underline{(x-x)f(x)\cdot x'-(0-x)f(0)\cdot 0' + \int\limits_{0}^{x}\frac{\partial}{\partial x}(t-x)f(t)\;dt}

=  e^x + \underline{\int\limits_{0}^{x}\frac{\partial}{\partial x}(t-x)f(t)\;dt}

=e^x+\int\limits_{0}^{x}-1\cdot f(t)\;dt

= e^x-\int\limits_{0}^{x}f(t)\;dt

\implies \frac{d^2f(x)}{dx}=e^x-\frac{d}{dx}\int\limits_{0}^{x}f(t)\;dt\overset{\textbf{FTC}}{=}e^x-f(x).

Fig.2 shows that Omega CAS explorer‘s Maxima engine is both FTC and GLR aware:

Fig. 2

Exercise-1 Given:

f(x) = \int\limits_{0}^{x}t\cdot f(x-t)\;dt+\sin(x)

where f(x) is a continuous function, find f(x).

hint: Let u=x-t, t = x-u; t=0\implies u=x; t=x\implies u=0; \frac{du}{dt}=-1;

f(x) = \int\limits_{x}^{0}(x-u)\cdot f(u)\cdot (-1)\;du + \sin(x)=\int\limits_{0}^{x}(x-u)f(u)\;du+\sin(x).