Q:

If $X \sim U(0,1)$ and $Y \sim U(0,X)$, what is the joint distribution of $(X,Y)$?

Problem: Let $X  \sim U(0,1)$, $Y \sim U(0,X)$. Which is the joint distribution $f(x,y)$?
Attempt: $$\mathbb P(X \leq a, Y \leq b) = \mathbb E(\mathbb P (Y \leq b \mid X=x \leq a)) = \int_0^a \frac b x \, dx $$ which is of course a problem!
Thanks!

A:

For the two random variables the joint distribution is obtained by integrating the joint probability density over the rectangle $[0,a] \times [0,b]$.  Note that the density is zero when $y > x$ and outside the rectangle $[0,1]\times [0,1]$.
If $b \geqslant a$, then
$$F(a,b) = \int_0^a \left( \int_0^x \frac{1}{x} \, dy\right) \, dx = a$$
otherwise, if $b < a$, then
$$F(a,b) = \int_0^b \left( \int_0^x \frac{1}{x} \, dy\right) \, dx + \int_b^a \left( \int_0^b \frac{1}{x} \, dy\right) \, dx = b + b \log(a/b)$$

