Differentiation Under the Integral Sign
Differentiation under the integral sign is an operation in calculus used to evaluate certain integrals. Under fairly loose conditions on the function being integrated, differentiation under the integral sign allows one to interchange the order of integration and differentiation. In its simplest form, called the Leibniz integral rule, differentiation under the integral sign makes the following equation valid under light assumptions on \(f\): \[\frac{d}{dx} \int_{a}^{b} f(x,t) \,dt = \int_{a}^{b} \frac{\partial}{\partial x} f(x,t) \, dt .\]
Many integrals that would otherwise be impossible or require significantly more complex methods can be solved by this approach.
Contents
General Form
The most general form of differentiation under the integral sign states that: if \(f(x,t)\) is a continuous and continuously differentiable (i.e., partial derivatives exist and are themselves continuous) function and the limits of integration \(a(x)\) and \(b(x)\) are continuous and continuously differentiable functions of \(x\), then \[\frac{\mathrm{d}}{\mathrm{d}x} \int_{a(x)}^{b(x)} f(x,t) \, \mathrm{d}t =f(x,b(x)) \cdot b'(x) - f(x,a(x))\cdot a'(x) + \int_{a(x)}^{b(x)} \frac{\partial}{\partial x} f(x,t) \, \mathrm{d}t.\]
In the case where \(a(x)\) and \(b(x)\) are constant functions, this formula reduces to the simpler form \[\frac{\mathrm{d}}{\mathrm{d}x} \int_{a}^{b} f(x,t) \,\mathrm{d}t = \int_{a}^{b} \frac{\partial}{\partial x} f(x,t) \, \mathrm{d}t .\] This simpler statement is known as Leibniz integral rule.
Examples
Generally, one uses differentiation under the integral sign to evaluate integrals that can be thought of as belonging to some family of integrals parameterized by a real variable. To better understand this statement, consider the following example:
Compute the definite integral \[\int_{0}^{1} \frac{t^{3} - 1}{\ln t} \, dt.\]
This integral appears resistant to standard integration techniques such as integration by parts, u-substitution, etc. We would like to use differentiation under the integral sign to compute it.
How can we choose a function to differentiate under the integral sign? The appearance of \(\ln t\) in the denominator of the integrand is quite unwelcome, and we would like to get rid of it. Thankfully, we know \[\frac{d}{dx} t^x = t^x \ln t,\] so differentiating the numerator with respect to the exponent seems to be what we'd like to do.
Accordingly, we define a function \[g(x) = \int_{0}^{1} \frac{t^x - 1}{\ln t} \, dt .\] In this notation, the integral we wish to evaluate is \(g(3)\). Observe that the given integral has been recast as member of a family of definite integrals \(g(x)\) indexed by the variable \(x\).
By Leibniz integral rule, we compute \[g'(x) = \int_{0}^{1} \frac{\partial}{\partial x} \frac{t^x - 1}{\ln t} \, dt = \int_{0}^{1} \frac{t^x \ln t}{\ln t} \, dt = \frac{t^{x+1}}{x+1} \Bigg\vert_{0}^{1} = \frac{1}{x+1}.\] It follows that \(g(x) = \ln|x+1| + C\) for some constant \(C\).
To determine \(C\), note that \(g(0) = 0\), so \(0 = g(0) = \ln 1 + C = C\). Hence, \(g(x) = \ln|x+1|\) for all \(x\) such that the integral exists. In particular, \(g(3) = \ln 4 = 2\ln 2\). \(_\square\)
In the example, part of the integrand was replaced with a variable and the resultant function was studied using differentiation under the integral sign. This is a good illustration of the problem-solving principle: if stuck on a specific problem, try solving a more general problem.
Another example illustrates the power of this technique in its general form, as one may use it to compute the Gaussian integral.
Compute the definite integral \[\int_{0}^{\infty} e^{-x^2/2} \, dx.\]
Define a function \[g(t) = \left(\int_{0}^{t} e^{-x^2/2} \, dx \right)^2.\] Our goal is to compute \(g(\infty)\) and then take its square root.
Differentiating with respect to \(t\) gives \[g'(t) = 2 \cdot \left(\int_{0}^{t} e^{-x^2/2} \, dx \right) \cdot \left(\frac{d}{dt} \int_{0}^{t} e^{-x^2/2} \, dx \right) = 2e^{-t^2 / 2} \int_{0}^{t} e^{-x^2 / 2} \, dx = 2\int_{0}^{t} e^{-(t^2 + x^2)/2} \, dx.\]
Make the change of variables \(u = x/t\), so that the integral transforms to \[g'(t) = 2 \int_{0}^{1}te^{-(1+u^2)t^2/2}\, du. \] Now, the integrand has a closed-form antiderivative with respect to \(t\): \[g'(t) = -2\int_{0}^{1} \frac{\partial }{\partial t} \frac{e^{-(1+u^2)t^2/2}}{1+u^2} \, du = -2 \frac{d}{dt} \int_{0}^{1} \frac{e^{-(1+u^2)t^2/2}}{1+u^2} \, du.\]
Set \[h(t) = \int_{0}^{1} \frac{e^{-(1+x^2)t^2/2}}{1+x^2} \, dx. \] Then by the above calculation, \(g'(t) = -2h'(t)\), so \(g(t) = -2h(t) + C\). To determine \(C\), take \(t\to 0\) in the equation; since \(g(0) = 0\) and \[h(0) = \int_{0}^{1} \frac{1}{1+x^2} \, dx = \tan^{-1} x\Bigg\vert_{0}^{1} = \frac{\pi}{4},\] it follows that \(0 = -\pi/2 + C \implies C = \pi/2\).
Finally, taking \(t\to\infty\), we conclude \(g(\infty) = -2h(\infty) + \pi/2 = \pi/2\). Thus, \[\int_{0}^{\infty} e^{-x^2/2} \, dx = \sqrt{\frac{\pi}{2} }. \ _\square\]
Let \(a,b, c\) be real with \(c > 0\). Show that
\[\int_{-\infty}^{\infty} e^{-c x^{2}} \operatorname{erf}(a x+b) \, \mathrm{d} x=\sqrt{\frac{\pi}{c}} \operatorname{erf}\left(\frac{b \sqrt{c}}{\sqrt{a^{2}+c}}\right)\]
Let \(a, b, c\) be real with \(c > 0\). Define
\[I(a, b, c)=\int_{-\infty}^{\infty} e^{-c x^{2}} \operatorname{erf}(a x+b) \mathrm{d} x\]
If we set \(u=\sqrt{c}x\) then we find
\[I(a, b, c)=\int_{-\infty}^{\infty} e^{-u^{2}} \operatorname{erf}\left(\frac{a}{\sqrt{c}} u+b\right) \frac{\mathrm{d} u}{\sqrt{c}}=\frac{1}{\sqrt{c}} I\left(\frac{a}{\sqrt{c}}, b, 1\right)\]
So we will focus on determining \(J(a, b) = I(a, b, 1)\). Recall that
\[\operatorname{erf} x=\frac{2}{\sqrt{\pi}} \int_{0}^{x} e^{-t^{2}} \mathrm{d} t \quad \Longrightarrow \quad \operatorname{erf}^{\prime}(x)=\frac{2}{\sqrt{\pi}} e^{-x^{2}}\]
and so, differentiating under the integral sign with respect to \(a\) we find
\[\frac{\partial J}{\partial a}=\int_{-\infty}^{\infty} e^{-x^{2}} \frac{\partial}{\partial a} \operatorname{erf}(a x+b) \mathrm{d} x=\frac{2}{\sqrt{\pi}} \int_{-\infty}^{\infty} x e^{-x^{2}} e^{-(a x+b)^{2}} \mathrm{d} x\]
Completing the square in the exponent we have
\[x^{2}+(a x+b)^{2}=\left(a^{2}+1\right) x^{2}+2 a b x+b^{2}=\left(a^{2}+1\right)\left(x+\frac{a b}{a^{2}+1}\right)^{2}+\frac{b^{2}}{a^{2}+1}\]
Hence
\[\begin{aligned} \frac{\partial J}{\partial a} &=\frac{2}{\sqrt{\pi}} \exp \left(\frac{-b^{2}}{a^{2}+1}\right) \int_{-\infty}^{\infty} x \exp \left[-\left(a^{2}+1\right)\left(x+\frac{a b}{a^{2}+1}\right)^{2}\right] \mathrm{d} x \\ &=\frac{2}{\sqrt{\pi}} \exp \left(\frac{-b^{2}}{a^{2}+1}\right) \int_{-\infty}^{\infty}\left(v-\frac{a b}{a^{2}+1}\right) \exp \left[-\left(a^{2}+1\right) v^{2}\right] \mathrm{d} v \quad\left[v=x+a b /\left(a^{2}+1\right)\right] \\ &=\frac{2}{\sqrt{\pi}}\left(-\frac{a b}{a^{2}+1}\right) \exp \left(\frac{-b^{2}}{a^{2}+1}\right) \int_{-\infty}^{\infty} \exp \left[-\left(a^{2}+1\right) v^{2}\right] \mathrm{d} v \quad\left[\text { using oddness of } v e^{-\left(a^{2}+1\right) v^{2}}\right] \\ &=\frac{2}{\sqrt{\pi}}\left(-\frac{a b}{a^{2}+1}\right) \exp \left(\frac{-b^{2}}{a^{2}+1}\right) \frac{\sqrt{\pi}}{\sqrt{a^{2}+1}} \quad[(i)] \\ &=\frac{-2 a b}{\left(a^{2}+1\right)^{3 / 2}} \exp \left(\frac{-b^{2}}{a^{2}+1}\right) \end{aligned}\]
for \((i)\)
\[\int_{-\infty}^{\infty} e^{-x^{2}} \mathrm{d} x=\sqrt{\pi} \quad \text { and } \quad \Gamma\left(\frac{1}{2}\right)=\sqrt{\pi}\]
Thus, noting \(J(a, b) \rightarrow 0\) as \(a \rightarrow-\infty\), we finally have
\[J(a, b)=-2 b \int_{-\infty}^{a} \frac{x}{\left(x^{2}+1\right)^{3 / 2}} \exp \left(\frac{-b^{2}}{x^{2}+1}\right) \mathrm{d} x\]
We will set \(u^2 = b^{2}/(1 + x^2)\) so that
\[2 u \mathrm{d} u=\frac{-2 b^{2} x}{\left(1+x^{2}\right)^{2}} \mathrm{d} x=\frac{1}{\sqrt{1+x^{2}}} \frac{-2 b^{2} x}{\left(1+x^{2}\right)^{3 / 2}} \mathrm{d} x=\frac{u}{b}\left(\frac{-2 b^{2} x}{\left(1+x^{2}\right)^{3 / 2}} \mathrm{d} x\right)\]
and
\[\mathrm{d} u=\frac{-b x \mathrm{d} x}{\left(1+x^{2}\right)^{3 / 2}}\]
Hence
\[J(a, b)=2 \int_{0}^{b / \sqrt{1+a^{2}}} \exp \left(-u^{2}\right) \mathrm{d} u=\sqrt{\pi} \operatorname{erf}\left(\frac{b}{\sqrt{1+a^{2}}}\right)\]
and
\[I(a, b, c)=\frac{1}{\sqrt{c}} J\left(\frac{a}{\sqrt{c}}, b\right)=\sqrt{\frac{\pi}{c}} \operatorname{erf}\left(\frac{b}{\sqrt{1+a^{2} / c}}\right)=\sqrt{\frac{\pi}{c}} \operatorname{erf}\left(\frac{b \sqrt{c}}{\sqrt{c+a^{2}}}\right)\]
as required
One should also note counterexamples, for which this technique does not work. For instance, suppose one attempts to evaluate \[\int_{0}^{\infty} \frac{\sin x}{x} \, dx\] by making the variable change \(u = x/t\) for some \(t\neq 0\). Then, \[\int_{0}^{\infty} \frac{\sin x}{x} \, dx = \int_{0}^{\infty} \frac{\sin tu}{u} \, du = g(t).\] Differentiating under the integral sign yields \[0 = g'(t) = \int_{0}^{\infty} \cos tu \, du,\] which is absurd. The problem is that the function \(f(x,t) = \sin tx/x\) is not continuously differentiable (consider \(\partial f/\partial t\) when \(x=0\)), which was required in the assumptions set forth above.