# Marginal distribution from joint distribution

Let X be a random variable $$X$$ with distribution $$f_X(x) = \begin{cases} 2x & x \in [0, 1] \\ 0 & \text{else} \end{cases}$$. Given $$X = x$$, suppose the conditional distribution of $$Y$$ is uniform on $$[0, 1/x]$$. We wish to find the marginal distribution of $$Y$$. My thinking is the following. Find the joint distribution as $$f_{X, Y}(x, y) = f_{Y | X}(y | x) f_X(x)$$ We have $$f_{Y | X} ( y | x) = \begin{cases} x & y \in [0, 1/x] \\ 0 & \text{else} \end{cases}$$ So $$f_{X, Y}(x, y) = \begin{cases} 2x^2 & 0 \leq y \leq 1 /x, 0 \leq x \leq 1 \\ 0 & \text{else} \end{cases}$$ Then integrate this with respect to $$x$$ $$f_Y(y) = \int_{-\infty}^{\infty} f_{X, Y}(x, y) \: dx = \int_0^{1/y} 2x^2 \: dx = \frac{2}{3y^3}$$ However, this isn't a valid probability distribution as it doesn't integrate to 1. What's wrong with this reasoning?

• $x$ is bounded by $1/y$ and by $1$. Commented Sep 29, 2021 at 6:21

Since $$f_{X, Y}(x, y) = 0\ \text{ unless }\ 0 \leq y \leq 1 /x,\, 0 \leq x \leq 1$$ we can invert the order of the constraints into $$f_{X, Y}(x, y) = 0\ \text{ unless }\ 0 \leq y,\, 0 \leq x \leq \min\{1,y^{-1}\}$$ Thus $$f_Y(y)=\int f_{X,Y}(x,y)\,\text dx=\int_0^{\min\{1,y^{-1}\}} 2x^1\,\text dx=\begin{cases} 2/3 &\text{if }y<1\\ 2y^{-3}/3 &\text{if }y>1\end{cases}$$ with $$\int_1^\infty 2y^{-3}/3\,\text dy= 1^{-2}/3=1/3$$
• Thankyou! I had the bounds wrong for $x$ in the integral Commented Sep 30, 2021 at 0:30