# Determine the joint pdf from the conditional distribution and marginal distribution of one of the variables

Have this question I think I'm doing right, but I am unsure:

Let $(X,Y)$ be a random vector characterized as follows. The marginal density $f_X(x)=2x$ for $0 \le X \le 1$ and the conditional distribution of Y given X=x is uniformly distributed in [0,x]. Find the joint pdf f(x,y) and marginal density $f_Y$.

From this, I took the conditional probability to be $$f_{Y|X}(y|x)=\frac{1}{x}$$ for $0 \le y \le x$ and from there calculated $$f_{XY}(x,y) = f_{Y|X}(y|x)*f_X(x)=\frac{1}{x}*2x=2$$ I know pdfs can have values greater than 1, but this seems off to me.

For the marginal distribution of y, I know to integrate the pdf over all values of x, so I did this: $$f_Y(y)=\int_0^y 2dx = 2y$$ for $0 \le y \le 1$. I can't imagine that this is correct. Thank you for your help!

So, the marginal distribution of $Y$ is given by the following integral
$$\int_y^1 2 \ dx=2(1-y)$$
if $0\leq y\leq 1$.
Your work is correct except for forgetting to indicate the regions where the pdf is zero, for example by noting, $$f_{Y|X}(y|x)=\frac{1}{x}\mathbf{1}_{0\le y\le x}$$ then, $$f_{XY}(x,y) = f_{Y|X}(y|x)*f_X(x)=\frac{1}{x}\mathbf{1}_{0\le y\le x}\,\cdot\,2x\mathbf{1}_{0\le x\le 1}=2\cdot\mathbf{1}_{0\le x\le 1}\cdot\mathbf{1}_{0\le y\le x}$$ As a check, integrate this over all $x,y$ and you will find that it comes out to $1$ as required. The range of integration you used to calculate the marginal $f_Y(y)$ is incorrect. $$f_Y(y)=\int_0^1f_{XY}(x,y)dx = \int_y^12dx =2(1-y)$$ since the pdf is zero for $x<y$.