# Joint density with uniformly distributed marginals and conditional pdf

$X$ and $Y$ are random variables. The marginal distribution of $X$ is uniformly on $[0,1]$. The conditional distribution $f_{Y|X}$ is $U[x,x+1]$ for $0 \leq x \leq 1$.

Now derive the joint pdf of $X$ and $Y$ and the mean of $Y$.

I got that the joint pdf is simply $1$ if $0\leq x\leq 1$ and $x\leq y\leq x+1$ and for the mean of $Y$ I got $\dfrac{x}{2}$. But I am really unsure.

$$f_{X,Y}(x,y)=f_{Y|X}(y|x)f_X(x)=1, \, x\in[0,1],\, y \in[x, x+1]$$ $$\mathsf E(Y|X=x)=\int_{x}^{x+1}y.1dy=x+\frac{1}{2}\Rightarrow \mathsf E(Y|X)=X+\frac{1}{2}$$ $$\mathsf E Y=\mathsf E(\mathsf EY|X)=\mathsf E(X+\frac{1}{2})=\int_{0}^{1}(x+\frac{1}{2}).1dx=1$$