Determining PDF and CDF of multivariable function If $X$ and $Y$ are independent and identically distributed RVs with pdfs $f_X(x)=e^{-x}U(x)$ and $f_Y(y)=e^{-y}U(y)$, find the PDF of $Z$ if:
a. $Z=X-Y$
b. $Z=\min(X,Y)/\max(X,Y)$
$U$ represents the unit step function.
For the first part, I tried looking at the range of values that $y$ could be, and I got $y\geq x-z$ since $x-y \leq z$ for $F_Z(z)$. I set up my CDF integral to be
$$\int_0^\infty\int_0^{z+y}e^{-x-y} dx dy$$ 
and got $F_Z(z)= 1-e^{-z}/2$. I differentiated this to get my PDF, which is $e^{-z}/2$. This answer is incorrect, and I'm not sure what I did wrong.
For the second part, I again tried looking at the range of values that $y$ could be, and I got $y \leq zx$ where $0 \leq z \leq 1$. I set up my CDF integral to be 
$$\int_0^\infty \int_0^{y/z}e^{-x-y} dx dy$$ 
and got $F_Z(z)= 1-\frac {z} {z+1}$. I differentiated this to get $\frac {-1} {(z+1)^2}$. This answer is also incorrect. I'm not sure what to do on either of these two problems at this point.
 A: a) Your CDF integral is almost correct. 
It should be:$$P\left(X-Y\leq z\right)=\int_{0}^{\infty}\int_{0}^{\infty}\left[x\leq y+z\right]e^{-x-y}dxdy=\int_{0}^{\infty}\int_{0}^{\max\left(0,y+z\right)}e^{-x-y}dxdy$$For calculation you must discern the cases $z\geq0$ and $z<0$.
I haven't looked at b) but there is a good chance that you made a similar mistake there.
A: Just expanding drhab's answer.
For the first case you should consider when, for any given $z\in \Bbb R$, when $Y > X-z$. When $z>0$ you have the situation depicted below.

Thus, for $z>0$,
\begin{eqnarray}
F_Z(z) &=& \int_0^{+\infty}\int_0^{z+y} e^{-x-y} dx dy=\\
&=&1-\frac12 e^{-z}.
\end{eqnarray}
For $z<0$ you can look at the figure below.

Then you can compute, in such interval, e.g. as
\begin{eqnarray}
F_Z(z) &=& \int_{0}^{+\infty}\int_{x-z}^{+\infty} e^{-x-y} dy dx=\\
&=&\frac12 e^{z}.
\end{eqnarray}
Differentiation yields
$$\boxed{f_Z(z) = \frac12 e^{-|z|}}.$$

As for the second question, consider that, if $X>Y$ you need to consider the event $Y<zX$; whereas, if $X<Y$, your event becomes $Y>\frac1{z}X$.
It is thus immediate to conclude that, for $z>1$,
$$F_Z(z) = 1.$$
For $0<z<1$, consider then the shaded area in the figure below.

Therefore, for $0<z<1$,
\begin{eqnarray}
F_Z(z) &=&1- \int_0^{+\infty} \int_{zx}^{\frac{x}{z}} e^{-x-y}dy dx=\\
&=&\frac{2z}{1+z}.
\end{eqnarray}
And, finally, by differentiation
$$\boxed{f_Z(z) = \frac2{(1+z)^2}}, \ \ 0<z<1.$$
