I have a question regarding finding the following joint distribution.
Let $p \sim U[0,1]$, standard uniform distribution.
The random variable $X$ is defined as $X = 2$ with probability $p$ and $X = 0$ with probability $(1-p)$.
The random variable $Y$ is defined as $Y = 4p$.
The question is to find the $cov(X,Y)$ and the joint distribution of $X$ and $Y$
This is what I have done so far:
Since $p \sim U[0,1]$, then $Y \sim U[0,4]$ since $Y = 4p$. Then I used the formula $$Cov(X,Y) = E(XY) - E(X)E(Y) $$ In this case, $E(X)=2p$ and $E(Y)=2$. However, I get stuck when attempting to find $E(XY)$ along with the the joint distribution. Any suggestion or help would be extremely appreciated!!
When approaching this kind of questions your main tools are Bayes rule and the law of total expectation and total probability. Notice that the data about X in the question is infact about the conditioned RV X|p For the covariance apply the law of total expectation: $E[XY]=E[E[XY|p]]=E[E[X4p|p]]=E[4pE[X|p]]=E[8p^2]=8(0.25+\frac{1}{12})=\frac{8}{3}$ and notice that $E[X]=E[E[X|p]]=E[2p]=1$ For the PDF, first apply the Bayes rule: $f_{X,Y}(a,b)=P(X=a|Y=b)f_{Y}(b)$ The PDF of $Y$ is known as you mentioned that it follows the distribution $U(0,4)$. Then, $P(X=0|Y=b)=1-0.25b,P(X=2|Y=b)=0.25b$.