Densities of random variables and Conditional Expectation Let $X$ denote a random variable such that $P(X=n)=2^{-n}$. Let $Y$ denote a random variable that admits a distribution conditioned by $X=n$ with density $n(1-y)^{n-1}\chi_{[0,1]}(y)$.


*

*Find the distribution of $(X,Y)$.

*Find the density of $Y$.


By now, after developing a little bit the equality below I have found the distribution of the vector $(X,Y)$,
$$F_{(X,Y)}(n,y)=P(X\leq n,Y\leq y)=\sum_{k=1}^nP(Y\leq y/X=k)P(X=k)=\sum_{k=1}^n\frac{1-(1-y)^k}{2^k}$$
But I don't know how to find the density of $Y$. I have the feeling  that maybe all I have to do is calculate $F_Y(y)=\lim_nF_{(X,Y)}(n,y)$ and then derive it, but I'm not sure if that's the right way. How can I find $Y$'s density?
 A: We have $P(X=x) = 2^{-x}$ for $x \ge 1$ and $f_{Y\mid X}(y \mid X=x) = x(1-y)^{x-1} \chi_{[0,1]}(y)$. 
(1) Looking at the density of $Y$ first. By the Law of Total Probability $f_Y(y)$ equals
$$
 \sum_{x=1}^\infty f_{Y\mid X}(y \mid X=x) P(X=x)
= \sum_{x=1}^\infty x(1-y)^{x-1} 2^{-x} \chi_{[0,1]}(y)=
\frac{1}{2} \sum_{x=1}^\infty x \left( \frac{1-y}{2} \right)^{x-1} \chi_{[0,1]}(y)
$$
Note that $\sum_{n=0}^\infty z^{n} =\frac{1}{1-z}$ provided $|z|<1$. As long as we're in the radius of convergence,
$
\sum_{n=1}^\infty nz^{n-1} = \frac{d}{dz} \left( \frac{1}{1-z} \right) = \frac{1}{(1-z)^2}.
$  Therefore,
$$
f_{Y}(y) = \frac{1}{2}  \left( \dfrac{4}{(y+1)^2} \right) \chi_{[0,1]}(y)
= \dfrac{2}{(y+1)^2} \chi_{[0,1]}(y)
$$
You can check this is a valid density . . . it integrates to one.
(2) Now for the joint probability distribution:
$$
f_{Y,X}(y,x) =  f_X(x)\cdot f_{Y \mid X}(y \mid x)  =  \left[2^{-x} \chi_{\{1,2,\dots\}}(x) \right] \cdot \left[x(1-y)^{x-1} \chi_{[0,1]}(y) \right]
$$
This is indeed a valid distribution, for
$$
\sum_{x=1}^\infty \int_{0}^1 2^{-x} x(1-y)^{x-1} \; dy =  \sum_{x=1}^\infty 2^{-x} =1
$$
and
$$
 \int_0^1 \left( \sum_{x=1}^\infty x (1-y)^{x-1} 2^{-x} \right) \; dy
= \int_0^1 \frac{2}{(y+1)^2} \; dy = 1.
$$
i.e. 
$$
\int\left(  \sum_x f(x,y)  \right) \, dy =  \sum_x \left(\int f(x,y) \; dy \right) =1.
$$
