tricky integrating ranges $ x_1-x_2$ So, we know the sum of n i.i.d. exponential(lambda) is $\Gamma(n,\lambda)$. But I am looking at a problem with $X_1-X_2$. 
So I get the joint dist of $z=x_1-x_2$ and $w=x_2$. Then I integrate out w on range $0$ to $\infty$, but does this give me the whole range of $z$? 
I can't figure out how to draw the plot of z vs w axis or or $x_1$ vs $x_2$ to see if the integration is stopped by an axis. 
My friend did an integration for $z<0$ by setting the range $-z$ to $\infty$ dw. If this is right can someone please help me see the motivation for it?
 A: We could use a convolution: the density of $X_3=-X_2$ is easy to find, and we know how to find the density function of a sum. Instead, we will find the cdf. Then differentiation gives the pdf.
We change notation, writing $X$ for $X_1$ and $Y$ for $X_2$.  Let $W=X-Y$. We find the cdf of $W$, that is, the probability that $W\le w$, which is the probability that $Y\ge X-w$.  
Draw the line $y=x-w$. We want the probability of landing above that line.  
First let $w\ge 0$. Draw a picture. The part of the first quadrant that is above the line consists of two parts: (i) the infinite strip above the interval $0\le x\le w$ and (ii) the region above the line, from $x=w$ to $\infty$. The joint density is $f(x,y)=\lambda^2e^{-\lambda x}e^{-\lambda y}$ (first quadrant), and therefore for $w\ge 0$ we have
$$\Pr(W\le w)=\int_{x=0}^w\int_{y=0}^\infty f(x,y)\,dy\,dx+ \int_{x=w}^\infty\int_{y=x-w}^\infty f(x,y)\,dy\,dx.$$
For $w\lt 0$, the geometry is a little different, and simpler, there is no vertical strip, and 
$$\Pr(W\le w)=\int_{x=0}^\infty\int_{y=x-w}^\infty f(x,y)\,dy\,dx.$$
Since we will want to differentiate to get the pdf, we don't really need to do calculate the outer integral, for we can differentiate under the integral sign.
