# Calculating $\int_{0}^{\infty}dx\int_{0}^{xz}\lambda^{2}e^{-\lambda(x+y)}dy$

I wish to calculate $$\int_{0}^{\infty}dx\int_{0}^{xz}\lambda^{2}e^{-\lambda(x+y)}dy$$

I compared my result, and the result with Wolfram when setting $\lambda=3$ and I get different results.

What I did:

$$\int_{0}^{\infty}dx\int_{0}^{xz}\lambda^{2}e^{-\lambda(x+y)}dy$$

$$=\lambda^{2}\int_{0}^{\infty}\frac{e^{-\lambda(x+y)}}{-\lambda}|_{0}^{xz}\, dx$$

$$=\lambda^{2}\int_{0}^{\infty}\frac{e^{-\lambda(x+xz)}}{-\lambda}-\frac{e^{-\lambda x}}{-\lambda}\, dx$$

$$=-\lambda(\int_{0}^{\infty}e^{-\lambda(1+z)x}\, dx-\int_{0}^{\infty}e^{-\lambda x}\, dx)$$

$$=-\lambda(\frac{e^{-\lambda(1+z)x}}{-\lambda(1+z)}|_{0}^{\infty}-\frac{e^{-\lambda x}}{-\lambda}|_{0}^{\infty})$$

$$=-\lambda(\frac{1}{\lambda(1+z)}-(\frac{1}{-\lambda}))$$

$$=-\lambda(\frac{1}{\lambda(1+z)}+\frac{1}{\lambda})$$

$$=1-\frac{1}{1+z}$$

I went over the calculation a couple of times and not only that I couldn't find my mistake, I also don't understand how I can end up with $1-e^{\text{something}}$ because the integrals are done from $0$ to $\infty$ and then I get $1$ or $0$ when I set the limits.

-
@BabakSorouh - No, did I use that somewhere ? –  Belgi Dec 31 '12 at 15:13
@Belgi When calculating the exponential limits do you know whether or not $\lambda >0$ and $z>-1$? –  Nameless Dec 31 '12 at 15:15
@BabakSorouh You mean $z=-1$ right? –  Nameless Dec 31 '12 at 15:16
@Nameless: Yes in the power of $e$ when he was trying to put infinity. –  Babak S. Dec 31 '12 at 15:17
To me it seems like Wolfram Alpha is interpreting $xz$ as a variable on its own, but you mean $x$ multiplied by $z$. –  Calle Dec 31 '12 at 15:19

Assuming $\lambda\neq 0$ everything up to

$$I=-\lambda(\int_{0}^{\infty}e^{-\lambda(1+z)x}\, dx-\int_{0}^{\infty}e^{-\lambda x}\, dx)$$ is correct.

If in addtion $z\neq -1$, $$I=-\lambda(\frac{e^{-\lambda(1+z)x}}{-\lambda(1+z)}|_{0}^{\infty}-\frac{e^{-\lambda x}}{-\lambda}|_{0}^{\infty})$$

Finally if $\lambda>0,z>-1$, $$I=-\lambda(\frac{1}{\lambda(1+z)}+(\frac{1}{-\lambda}))=1-\frac{1}{1+z}$$

I ran it through Wolfram Mathematica and the result was this (given the assumptions):

The code:

!( *SubsuperscriptBox[([Integral]), (0), ([Infinity])]( *SubsuperscriptBox[([Integral]), (0), (x\ z)]k^2
E^{(-k) ((x + y))} [DifferentialD]y [DifferentialD]x))

-

Both solutions are "correct" (or equally wrong)- it depends on what integration you preform first. If you first integrate over $dy$, you get your result: $$\frac{z}{1+z} \text{ Assuming: } \lambda + z \lambda > 0 \ \ \& \ \ \lambda > 0$$ If you integrate over $dx$ first, you get WA's answer: $$1-e^{-\lambda x z}$$

This just means the limit of the integral as $x\rightarrow\infty$ does not exist. To understand this, keep in mind the a basic Riemann integration isn't defined over infinite intervals. To define a generalized integral you use the concept of a limit, but in this case the limit simply does not exist, since different paths lead to different results.

-
I did the same in Maple and above answer happened. –  Babak S. Dec 31 '12 at 15:36
@BabakSorouh - The math doesn't lie, software though.. –  nbubis Dec 31 '12 at 15:43
The question is which $\color{#C00000}{x}$ is bound to which? $\displaystyle \int_0^\infty\,\mathrm{d}\color{#C00000}{x} \int_0^{\color{#C00000}{x}z}\lambda^2e^{-\lambda(\color{#C00000}{x}+y)}\,\mathrm‌​{d}y$ –  robjohn Dec 31 '12 at 18:28
@nbubis: Since the integrand is positive, switching the order of integration won't affect the value of the integral. –  robjohn Jan 1 '13 at 13:58
@nbubis: The exponential solution is gotten by misapplying the limits of integration. That is, by decoupling the $x$ in the limit from the $x$ in the integral. We can't simply integrate in $x$ first since $x$ appears in the bounds of integration for the integration in $y$. One clue to the problem is that the answer $1-e^{xz}$ involves one of the variables of integration, which should not occur with definite integrals. –  robjohn Jan 1 '13 at 14:09

Assuming $\lambda>0$ and $z>0$, \begin{align} \int_0^\infty\int_0^{xz}\lambda^2e^{-\lambda(x+y)}\,\mathrm{d}y\,\mathrm{d}x &\stackrel{y\to x(y-1)}=\int_0^\infty\int_1^{z+1}\lambda e^{-\lambda xy}\,\lambda x\mathrm{d}y\,\mathrm{d}x\\ &\stackrel{\hphantom{y\to x(y-1)}}=\int_0^\infty\left(e^{-\lambda x}-e^{-\lambda x(z+1)}\right)\,\lambda\mathrm{d}x\\ &\stackrel{\hphantom{y\to x(y-1)}}=1-\frac1{z+1}\\ &\stackrel{\hphantom{y\to x(y-1)}}=\frac{z}{z+1} \end{align} After looking at Wolfram Alpha

The question on Wolfram Alpha is quite different. There, the upper limit of the inner integration is the variable "$xz$", not the product $x\cdot z$. If we replace the upper limit by $w$, we get \begin{align} \int_0^\infty\int_0^w\lambda^2e^{-\lambda(x+y)}\,\mathrm{d}y\,\mathrm{d}x &=\int_0^\infty\lambda e^{-\lambda x}\,\mathrm{d}x\cdot\int_0^w\lambda e^{-\lambda y}\,\mathrm{d}y\\ &=1\cdot\left(1-e^{-\lambda w}\right)\\ &=1-e^{-\lambda w} \end{align} restoring $w$ to $xz$ gives $1-e^{-\lambda xz}$

-