# Definite integral $\int_0^\infty e^{-y}e^{-xy}y^2dy$

I successfully solved the following integral of $$\int _0^\infty e^{-y}e^{-xy}y^2dy$$ by using partial integration two times, which was pretty hell long, and since solving this integral was not the main issue in the exercise I was doing, I wondered if there's an easier way to integrate it. Is there? Thanks! (btw my result was $$\frac{2}{(x+1)^3}$$)

P.S I am not familiar with gamma functions or anything beyond "common B.SC calculus".

• This integral looks very definite... – user Jan 23 '19 at 21:26
• @user I edited it to include limits to match the stated result. I'll fix the title. – J.G. Jan 23 '19 at 21:31

To prove by induction that $$\int_0^\infty y^n e^{-zy}dy=\frac{n!}{y^{n+1}}$$ (for $$\Re z>0$$), note that $$\int_0^\infty e^{-zy}dy=\frac{1}{z},\,\int_0^\infty y^{n+1} e^{-zy}dy=-\partial_z\int_0^\infty y^{n+1} e^{-zy}dy.$$For your stated problem, you only need to differentiate the base case twice; the induction is in case you want to generalise it.

\begin{align} \int_0^\infty e^{-(1+x)y}y^2dy &= \frac{d^2}{dx^2}\int_0^\infty e^{-(1+x)y}dy \\ &= \frac{d^2}{dx^2}\frac{1}{(1+x)}e^{-(1+x)y}\bigg|_0^\infty \\ &= \frac{d^2}{dx^2}\frac{1}{(1+x)} \\ &= \frac{2}{(1+x)^3} \end{align}

• Thanks! can you please explain the first step? $\int_0^\infty e^{-(1+x)y}y^2dy =\frac{d^2}{dx^2}\int_0^\infty e^{-(1+x)y}dy$ – superuser123 Jan 24 '19 at 7:40
• First, notice that $(1+x)$ is a constant with respect to the integral. Then notice that taking derivatives of the exponential with respect to $(1+x)$ or equivalently $x$ in this case will bring down factors of $y$ $$\frac{d^2}{dx^2}e^{-(1+x)y} = e^{-(1+x)y} y^2$$ So you can say the integral is equal to $\int_0^\infty \frac{d^2}{dx^2}e^{-(1+x)y}dy$. Roughly speaking then, since the integral doesn't depend on $x$, we can then interchange the order of integration and differentiation to get $$\frac{d^2}{dx^2} \int_0^\infty e^{-(1+x)y}dy$$ This method is often referring to as Feynman's trick. – suneater Jan 24 '19 at 8:55
• Why does it bring down the factors of y? I just don't get it :( – superuser123 Jan 24 '19 at 13:01
• Nothing fancy is going on. We're exploiting the properties of a derivative. Recall Calc I. The derivative of an exponential function is equal to the exponential times the derivative of its argument (i.e. chain rule applies). Consider these examples: $$\frac{d}{dx} e^{ax} = a e^{ax}$$ $$\frac{d^2}{dx^2} e^{ax} = a \frac{d}{dx} e^{ax} = a^2 e^{ax}$$ – suneater Jan 24 '19 at 20:43

Since your questions are related to random variables, this answer uses an exponential RV to compute the integral. Note that for an exponential RV, $$Y$$, with pdf $$f(y) = \lambda e^{-\lambda y}, \quad \lambda,y>0,$$ we have $$E[Y] = \frac{1}{\lambda},$$ $$var(Y) = \frac{1}{\lambda^2} \implies E[Y^2] = \frac{2}{\lambda^2}.$$ That is, $$\lambda\int_0^{\infty} y^2 e^{-\lambda y} dy = \frac{2}{\lambda^2} \implies \int_0^{\infty} y^2 e^{-\lambda y} dy = \frac{2}{\lambda^3}.$$ Can you guess $$\lambda$$ in your problem?

• How would you prove $E[Y^2]=2\lambda^{-2}$ without evaluating the integral? (I'm guessing you'd use a moment-generating or characteristic function, but it's worth explaining in your answer.) – J.G. Jan 23 '19 at 21:21
• I am presuming that OP is aware of this relationship. I agree that calculating the variance itself requires evaluation of an integral. One approach is to use MGF to get $E[Y^n] = \frac{n!}{\lambda^n}$ which is quite easy to evaluate. – Math Lover Jan 23 '19 at 21:26

$$I(x) = \int_0^{\infty} e^{-y}e^{-xy}y^2 dy$$

Integration under the integral

$$I(x) = \frac {d}{dx} \int_0^{\infty} e^{-y}y^2(\int e^{-xy}\ dx) dy = \frac {d}{dx}\int_0^{\infty} e^{-y(1+x)}y\ dy$$

And one more time.

$$I(x) = \frac {d^2}{dx^2}\int_0^{\infty} e^{-y(1+x)} dy = \frac {d^2}{dx^2}\frac {1}{1+x} = \frac {1}{2(1+x)^3}$$

Try separating the integral like this $$\int _0^\infty e^{-y(x+1)}y^2dy=\int _0^1 e^{-y(x+1)}y^2dy+\int _1^\infty e^{-y(x+1)}y^2dy$$

you can see that the first integral is a proper one hence the integral converges. For the second one try taking the cases when $$x+1 \lt0$$, $$x+1 =0$$ and $$x+1 \gt0$$

for $$x+1 \gt0$$ from $$\lim_{y\to \infty}\frac{e^{-y(x+1)}y^2}{\frac{1}{y2}}=0$$ this implies that $$\int _1^\infty e^{-y(x+1)}y^2dy\le\int _1^\infty \frac{1}{y^2}dy$$

the last integral converges, from the comparison test so will the integral $$\int _1^\infty e^{-y(x+1)}y^2dy$$

Can you try the other cases?