# Probability - Expectation of a random variable question

I was wondering if there is a shortcut or an easy way to calculate the expectation of a certain Random variable which is equal to two random variables with different probabilities.

For example: We are given random variables $X$ and $X$ (the numbers in the brackets are indexes) which have normal Gaussian distributions with $E(X)=E(X)=1$, $Var(X)=Var(X)=1$, and R.V $Y$ and $Y$ which have exponential distributions with parameter $lambda =2$, such that all of the R.V $X,X,Y$ and $Y$ are independent. If we define new random variables $Z$ and $Z$ such that $Z[i]$ equals $X[i]$ with probability $1/3$ and equals $Y[i]$ with probability $2/3$ for $i=1,2$, what is, for example, the expectation of $E(Z)$ and $E(Z\cdot Z)$?

I tried finding the probability distribution of both $Z\cdot Z$ and $Z$ and tried to calculate the respective expectations by integrating which is a rather long and gruesome procedure.

Thanks for any help in advance.

• I assume in my answer that $Z$ and $Z$ are independent. This is not actually specified. Did you mean to put this in the question? – Matt Samuel Oct 4 '15 at 12:02
• Thanks a lot for the answer for the first expectation, and no, I missed one detail: It is given that at any moment, if Z equals X then Z also equals X for sure, and the same goes with Y and Y. In other words, it's like at each moment a robot picks either the vector (X, X) with probability 1/3 and assigns it to the vector (Z, Z) or it picks the vector (Y, Y). – Dylan132 Oct 4 '15 at 12:05
• Then I'll fix the expectation of the product. – Matt Samuel Oct 4 '15 at 12:21

By the law of total expectation we have $$E[Z[i]]=E[E[Z[i]|X[i],Y[i]]]=E[\frac{1}{3}X[i]+\frac{2}{3}Y[i]]=\frac{1}{3}E[X[i]]+\frac{2}{3}E[Y[i]]$$ For the product, $$E[ZZ]=E[E[ZZ|X,Y,X,Y]]=E[\frac{1}{3}XX+\frac{2}{3}YY]=\frac{1}{3}E[X]E[X]+\frac{2}{3}E[Y]E[Y]$$ This should solve your problem.