# Mean and variance of uniform distribution where maximum depends on product of RVs with uniform and Bernoulli

I am looking for expressions for the mean and variance of a random variable ($Y$) with continuous uniform distribution where the maximum depends on the product of two independent random variables, one ($X_1$) with Bernoulli distribution and the other ($X_2$) with continuous uniform distribution. The minima of both uniform distributions are zero. I.e.:

$X_1 \sim B(1, p_3/(p_2+p_3))$

$X_2 \sim U(0,m)$

$Y \sim U(0, m-X_1X_2)$

My initial approach to the problem was to define the PDFs for $X_1X_2$ (for $0\leq X_1X_2 \leq m$) and for $Y|X_1X_2$ (for $0\leq Y \leq m-X_1X_2$), and then, using the law of total expectation, to integrate and solve between $0$ and $m$ to find the expression for the mean. I was anticipating using the law of total variance and integrating to find the expression for the variance. However, the PDF for the product of a continuous uniform distribution and Bernoulli distribution is undefined, so this must be the wrong approach.

Can anyone help me to find expressions for the mean and variance of $Y$? Any help would be much appreciated.

You don't need to find the distribution of $Y$ to find the mean and variance.
Use the Law of Iterated Expectation (aka Law of Total Expectation, or the Tower Property).   The independence of $X_1, X_2$ shall also be invoked.
\begin{align}\mathsf E(Y)~&=~\mathsf E(\mathsf E(Y\mid X_1 X_2))\\[1ex] &=~ \mathsf E(\tfrac 12(m-X_1X_2))\\[1ex] &= \tfrac 12(m-\mathsf E(X_1)\mathsf E(X_2))\\[1ex] &=\phantom{\tfrac {m\,p_2}{2\,(p_2+p_3)}}\end{align}
$$\mathsf {Var}(Y)=\mathsf E(\mathsf{Var}(Y\mid X_1X_2))+\mathsf {Var}(\mathsf E(Y\mid X_1X_2))$$
• So, does this mean $Var(Y)=E(\frac{1}{12}(m-X_1X_2)^2) + Var(\frac{1}{2}(m-X_1X_2))$? I am stuck on the next step. Sep 22, 2017 at 14:47
• Use the rules, again. Expand the quadratic term in the expectation, apply Linearity of Expectation, and independence. Recall $\mathsf {Var}(a+bZ)= b^2\mathsf {Var}(Z)$ and apply the Law of Iterated Variance. Sep 22, 2017 at 15:11