# Variance of a compound random variable.

Let $$Y$$ be such a random variable, that :

$$Y = \begin{cases} 1, & \mbox{if } X \le 1/2 \\ X, & \mbox{if } X>1/2 \end{cases}$$

where $$X$$ has uniform distribution on $$[0,1]$$.

My solution:

$$F_Y(t)=P(Y \le t) = P(1 \le t, X \le1/2)+P(X \le t, X>1/2)=1/2P(1 \le t)+1/2 F_X(t)$$.

So, CDF of $$Y$$:

$$F_y(t) = \begin{cases} 0, & \mbox{if } t <0 \\ 1/2 \cdot t, & \mbox{if } t \in [0,1) \\ 1, & \mbox{if } t \ge 1 \end{cases}$$

PDF of $$Y$$ :

$$f_y(t) = \begin{cases} 0, & \mbox{if } t <0 \wedge t\ge 1 \\ 1/2 , & \mbox{if } t \in [0,1) \end{cases}$$

$$E(Y)= \int_{0}^{1}\frac{1}{2}\cdot y dy$$

I know, how to finish it, if the above is correct.

There is a mistake when you said that $$P(X \le t, X>1/2)=1/2 F_X(t)$$. This is not true. Otherwise the architecture of the argument is a good way to go indeed.
• So, I have $P(X \le t, X>1/2)=P(X \le t, 1-X \le 1/2)=P(X \le t)(1-P(X \le 1/2))=P(X \le t)(1-F_X(1/2))$ – pawelK Dec 5 '19 at 18:18
• Wow, be careful, you act as if $X$ is independent of itself! obviously this is never the case. Product formula works only when variables are independent. – justt Dec 5 '19 at 18:19
• What do you think about this ? : $E(Y)= \int_{0}^{\frac{1}{2}} 1 dx +\int_{\frac{1}{2}}^{1} x dx$. – pawelK Dec 5 '19 at 18:24