Problem obtaining a marginal from the joint distribution Suppose $X_1$ and $X_2$ have the joint pdf
$$f_{X_1,X_2}\left(x_1,x_2 \right)=4x_1 x_2,\quad\text{for}\quad 0<x_1<1, 0<x_2<1$$
From that I found the joint pdf of $Y_1=\frac{X_1}{X_2}$ and $Y_2=X_1 X_2$ to be
$$f_{Y_1,Y_2} \left(y_1,y_2 \right)=2 \frac{y_2}{y_1}\quad \text{for}\quad \left(y_1,y_2 \right) \in \mathcal{T}$$
where $\mathcal{T}=\{ \left(y_1,y_2 \right): y_1,y_2>0,y_2<\frac{1}{y_1},y_2<y_1 \}$
That is, in the $ \left(y_1, y_2 \right)$ plane, the area of the pdf is bounded by the 45 degree line and the hyperbola $\frac{1}{y_1}$. Based on that I can easily derive the marginal of $Y_1$ for the two cases


*

*$0<y_1<1$

*$1<y_1<\infty$
But what about the marginal of $Y_2$? $Y_1$ is not bounded above and is bounded below by zero, right? How can I integrate out $Y_1$ if the integral from 0 to infinity diverges? Which begs the question, have I done something wrong in the above? 
 A: Draw pictures of the regions of integration.
The region where $0 \le x_1 \le 1, 0 \le x_2 \le 1,$ and $x_1 x_2 \le y$ (for $0 \le y \le 1$) looks like the shaded part of

The colors denote the varying values of the density $f(x_1,x_2)$, ranging from blue (low) to red (high).
The integral of $f(x_1,x_2)dx_1 dx_2 = 4 x_1 x_2 dx_1 dx_2$ is readily found by integrating separately over the rectangle to the left of the dashed line and the region to its right, which is bounded above by the curve $x_1 x_2 = y$; it gives
$$\Pr(Y_2 \le y) = y^2-2 y^2 \log (y).$$
Here is a plot of this distribution: it is the marginal CDF for $Y_2$.

Differentiate this to obtain the PDF of $Y_2$.

The region where $0 \le x_1 \le 1, 0 \le x_2 \le 1,$ and $x_1 / x_2 \le y$ (for $0 \le y \lt \infty$)  looks like the shaded part of

The lower curve is a portion of the line $x_2 = x_1 / y.$
When $y \gt 1$ the integral of $4 x_1 x_2 dx_1 dx_2$ can be broken into the two triangles shown; when $y \le 1$ only an upper triangle appears.  The marginal CDF of $Y_1$ works out to
$$\Pr(Y_1 \le y) = y^2/2, \ 0 \lt y \le 1; \quad 1 - 1/(2y^2),\ y \ge 1.$$
A partial plot of this marginal CDF for $Y_1$ is

The full plot extends infinitely far to the right.  Differentiate this to obtain the PDF of $Y_1$, the first marginal.
A: Just to add visual input, it is easily found that
$$F_X(x_i) = x_i^2$$
and since for $U_i \sim U(0,1)$
$$F^{-1}(U_i) = X_i \Rightarrow X_i = \sqrt{U_i}$$
the $X's$ are the square roots of uniform RV's in $(0,1)$. They are also independent.So simulate two uniforms, and then take their product. The resulting empirical relative frequency curve is

Now take the CDF of $Y_2 = X_1X_2$
$$F_{Y_2}(y_2) = y^2-2 y^2 \log (y) \Rightarrow f_{Y_2}(y_2) =-4y_2\ln y_2$$
Graph this function in (0,1) to get

More mathematically, we have that $Y_2 = \sqrt {U_1U_2}$ i.e. it is the square root of the product of two independent standard uniform RV's. The density of the product of $n$ standard uniform independent RV's can be found here. . For $n=2$ it is simply 
$$f_{U_1U_2}(u_1u_2) = -\ln(u_1u_2)$$
For $Y_2 =\sqrt{ U_1U_2}$ we immediately obtain by the change of variable formula that
$f_{Y_2}(y_2) =-4y_2\ln y_2$.
