Consider the function (coming from a joint probability density): $$ f(x,y) = \frac{1}{y}e^{-y-\frac{x}{y}}. $$

I want to evaluate the definite integral (marginal): $$ F(x) = \int_0^\infty f(x,y)\,dy. $$

It is very hard to find a primitive in $y$, so what I did was the following workaround: $$ \int f(x,y)\,dx = -e^{-y-\frac{x}{y}}. $$

So if we let $g(x,y):= -e^{-y-\frac{x}{y}}$, we can write: $$ f(x,y) = \frac{\partial g}{\partial x}(x,y). $$

Therefore: $$ F(x) = \int_0^\infty \frac{\partial g}{\partial x}(x,y)\,dy. $$

Now the trick was: can we move the derivation out of the integral? Under what assumptions? If that were the case, we could write: $$ F(x) = \frac{d}{dx} \int_0^\infty g(x,y)\,dy, $$

which can be calculated in terms of Bessel functions:

$$ F(x) = \frac{d}{dx} \int_0^\infty -e^{-y-\frac{x}{y}}\,dy = -\frac{d}{dx} \big(2\sqrt{x}\,K_1(2\sqrt{x})\big). $$

Deriving: $$ F(x) = K_0(2\sqrt{x}) - \frac{1}{\sqrt{x}}\,K_1(2\sqrt{x})+K_2(2\sqrt{x}). $$

(The last two passages according to Wolfram Alpha, for $x\ge 0$.) The $K_n$ should be the "modified Bessel functions of the 2nd kind".

I would like to ask:

  • Is it "legal" to carry the derivative out of the integral sign?
  • Are the last two (Wolfram Alpha) passages correct?
  • Is there any other way of obtaining $F(x)$? What is the result?


  • $\begingroup$ Thanks! At least one passage is then correct. Interesting thread, that one, btw. $\endgroup$ – geodude Feb 28 '14 at 22:00
  • $\begingroup$ Does anyone know how to calculate the following integral? - No. Not anyone knows how to calculate this integral. :-) $\endgroup$ – Lucian Feb 28 '14 at 22:03
  • $\begingroup$ Or does "not anyone" mean "nobody"? Quantifiers in English are cumbersome... $\endgroup$ – geodude Feb 28 '14 at 22:08

Following the analysis here:

$$\begin{align} F(x) &= \int_0^{\infty} \frac{dy}{y} e^{-y-\frac{x}{y}}\end{align}$$

Sub $u=y+\frac{x}{y}$, then

$$y = \frac12 \left (u \pm \sqrt{u^2-4 x}\right )$$ $$dy = \frac12 \left ( 1 \pm \frac{u}{\sqrt{u^2-4 x}} \right ) du$$


$$\begin{align}F(x) &= \frac1{4 x} \int_{\infty}^{2 \sqrt{x}} du \left ( 1 - \frac{u}{\sqrt{u^2-4 x}} \right )\left (u + \sqrt{u^2-4 x}\right ) e^{-u} \\ &+ \frac1{4 x} \int_{2 \sqrt{x}}^{\infty} du \left ( 1 + \frac{u}{\sqrt{u^2-4 x}} \right )\left (u - \sqrt{u^2-4 x}\right )e^{-u}\\ &= 2 \int_{2 \sqrt{x}}^{\infty} du \frac{e^{-u}}{\sqrt{u^2-4 x}}\\ &= 2 \int_0^{\infty} dv \, e^{-2 \sqrt{x} \cosh{v}}\\ &= 2 K_0(2 \sqrt{x})\end{align}$$

By using recurrence relations for the $K_n$, we see that the above simple expression is equivalent to the one derived using differentiation under the integral sign.


What you have described is differentiation under the integral sign and the only assumption (I believe) is that $g$ and $\frac{\partial g}{\partial x}$ are continuous.


$\newcommand{\bbx}[1]{\,\bbox[15px,border:1px groove navy]{\displaystyle{#1}}\,} \newcommand{\braces}[1]{\left\lbrace\,{#1}\,\right\rbrace} \newcommand{\bracks}[1]{\left\lbrack\,{#1}\,\right\rbrack} \newcommand{\dd}{\mathrm{d}} \newcommand{\ds}[1]{\displaystyle{#1}} \newcommand{\expo}[1]{\,\mathrm{e}^{#1}\,} \newcommand{\ic}{\mathrm{i}} \newcommand{\mc}[1]{\mathcal{#1}} \newcommand{\mrm}[1]{\mathrm{#1}} \newcommand{\on}[1]{\operatorname{#1}} \newcommand{\pars}[1]{\left(\,{#1}\,\right)} \newcommand{\partiald}[3][]{\frac{\partial^{#1} #2}{\partial #3^{#1}}} \newcommand{\root}[2][]{\,\sqrt[#1]{\,{#2}\,}\,} \newcommand{\totald}[3][]{\frac{\mathrm{d}^{#1} #2}{\mathrm{d} #3^{#1}}} \newcommand{\verts}[1]{\left\vert\,{#1}\,\right\vert}$ \begin{align} &\bbox[5px,#ffd]{\int_{0}^{\infty}{1 \over y} \exp\pars{-y - {x \over y}}\dd y} \\[5mm] = &\ \int_{0}^{\infty}{1 \over y} \exp\pars{-\root{x}\bracks{% {y \over \root{x}} + {\root{x} \over y}}}\,\dd y \\[5mm] \stackrel{y\ =\ \root{x}\expo{\theta}}{=}\,\,\,& \int_{-\infty}^{\infty}{1 \over \root{x}\expo{\theta}} \expo{-2\root{x}\cosh\pars{\theta}}\,\, \pars{\root{x}\expo{\theta}}\,\dd\theta \\[5mm] = &\ 2\int_{0}^{\infty} \expo{-2\root{x}\cosh\pars{\theta}}\,\,\dd\theta = \bbx{2\on{K}_{0}\pars{2\root{x}}} \\ & \end{align} $\ds{\on{K}_{\nu}}$ is a Modified Bessel Function. The last result is given by the DLMF Bessel Library.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.