# 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;$

i.e.,

$\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$.

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

Given

$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)$

Hence,

$\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.$