Deriving joint CDF from joint PDF The joint probability function of $(X,Y)$ is given by:
$$f_{(X,Y)}(x,y) = e^{-x}$$ 
Which is defined for the values:
$$ 0 \le y\le x<\infty$$
$$0\text{ elsewhere}$$
How would I find the cumulative distribution function of $(X,Y)$?
I know that the area that I am integrating in is a infinite triangle(if drawn in a 2d plane) so I set up my integration as:
$$\int_0^\infty \int_y^\infty e^{-x}\,dx\,dy$$
After the inside integral is evaluated I get:
$$\int_0^\infty e^{-y}dy$$
Which then evaluates to 1.
But the answer is supposed to be:
$$ 0,\quad x<0 \quad \text{or} \quad \ y\ <0$$
$$1-e^{-y}-ye^{-x},\quad 0\le y\le x$$
$$1-e^{-x}-xe^{-x},\quad y>x\ge0$$
I have completely no idea how the answer came about and also why are these instances where y is greater than x even though the values specifically state that y is less than x?
 A: If $0\le y\le x$ then
\begin{align}
\Pr(X\le x\ \&\ Y\le y) & = \int_0^y \cdots\cdots \,dv \\[10pt]
& = \int_0^y \int_v^x f_{X,Y}(u,v)\,du\,dv \\[10pt]
& = \int_0^y \int_v^x e^{-u} \, du\,dv
\end{align}
If $0\le x < y$ then
$$
\Pr(X\le x\ \&\ Y\le y) =\Pr(X\le x\ \&\ Y\le x) = \int_0^x \int_v^x f_{X,Y}(u,v) \, du  \, dv.
$$
And finally, if $x<0$ or $y<0$ then $F_{X,Y}(x,y)=0$.
A: A joint CDF $F_{X,Y}(x,y)$ gives the probability $$\Pr[(X \le x) \cap (Y \le y)].$$  Geometrically, what this means is that if you have a joint density $f_{X,Y}(x,y)$, then the CDF gives the total volume under the density over the region $(X \le x) \cap (Y \le y)$.  That is to say, you are "cutting" the surface along $X = x$ and $Y = y$, and then discarding those pieces for which $X > x$ or $Y > y$.  Here is a plot of the density:

Now you can see that if $x < 0$ or $y < 0$, then the point $(x,y)$ is in the L-shaped region to the left of the figure, and there is no volume in that region--the density is zero.  That's the first part of the piecewise function in the answer.  Now, if you're in the region $y > x > 0$, $(x,y)$ is in the flat triangular area just behind the curved wedge.  But the rectangular region $(X \le x) \cap (Y \le y)$ for this point includes part of this wedge, but how much it includes does not depend on $y$ once $y$ is at least as large as $x$.  That's the third part of the piecewise function:  $$F_{X,Y}(x,y) = 1 - e^{-x} - xe^{-x}, \quad y > x > 0.$$  So $F(3,5) = F(3,10) = F(3,51147034)$.  But if you choose a point inside the curved wedge; i.e., $0 < y < x$, then you can see that you're not only cutting away volume to the right, but also some volume to the back.  So that's the second part of the piecewise CDF.
I won't go into more mathematical detail since I mainly wanted to give you a visual, intuitive explanation of what's going on.  I find that this helps greatly when doing the actual computation.
A: Hint: The joint CDF has $X \leq x$ and $Y \leq y$ for $0 \leq y \leq x < \infty$. Consider a fixed $(x_0,y_0)$ to eliminate confusion (each of these will actually be variable in the cumulative distribution function, but I use them to demonstrate the difference between the bounds and the integration variables). So, the bounds for $y$ will be from $0$ to $y_0$ and the bounds for $x$ will be from $y_0$ to $x_0$, since it must always be the case that $x \geq y$. Currently, you are integrating out the variables in the function, which results in a definite value (you have a definite integral right now, which happens to calculate the volume underneath the entire joint density, which is obviously equal to $1$; as Michael Hardy commented, this confirms you are thinking about the situation correctly). Note that you will need several integrals for different cases, but you need the bounds as a different variable than what you are integrating with respect to, i.e., $x$ and $y$. Then, once you have the proper form of the function for each of these cases in terms of $x_0$ and $y_0$, you can write the variables once again as $x$ and $y$ for convenience and readability. Note that when I define a function $f$ with the mapping $x \mapsto x^2$, for example, the important part is what happens to an input when I apply the function, not the notation for the input itself. In other words, I could define the same function as $z \mapsto z^2$.
