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.
Can someone please help me understand where I am mistaken ?
 A: 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.
A: 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}$
A: 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))
