# Variance of combination of random variables (not independent)

I am doing this question.

You have random variables X, Y and Z which have means 1,2,3 respectively and variances 2,4,6 respectively. Also, Cov(X,Y) = Cov(Y,Z) = 1 and Cov(X,Z) = 0. I have to find the mean and variance of U = X-2Y+Z.

Now, I have done the mean of U and found it to be 0, which I hope is correct. However, I am stuck on the variance part - the covariances are messing me up and I don't know how to proceed. Any help? Thanks.

• what is the definition of covariance? – mathreadler Oct 9 '17 at 9:48

The mean follows straight from additivity : $$E[U] = E[X - 2Y + Z] = E[X] - 2E[Y] + E[Z] = 1 - 4 + 3 = 0$$.

The variance, on the other hand, is not so simple, but still doable: $$var(X - 2Y+Z) = E[(X-2Y+Z)^2] - E[X-2Y+Z]^2 \\ = E[X^2 + 4Y^2 + Z^2 - 4XY - 4YZ + 2XZ] - E[X - 2Y + Z]^2 \\ = \color{red}{E[X^2]} \color{green}{ + 4E[Y^2]} \color{orange}{+ E[Z^2]} \color{blue}{- 4E[XY]} \color{brown}{- 4E[YZ]} \color{gray}{+ 2E[XZ]} \\ \color{red}{- E[X]^2} \color{green}{- E[2Y]^2} \color{orange}{- E[Z]^2} \color{blue}{+ 4E[X]E[Y]} \color{brown}{+ 4E[Y]E[Z]} \color{gray}{- 2E[X]E[Z]} \\ = \color{red}{var(X)} + \color{green}{4var(Y)} + \color{orange}{var(Z)} \color{blue}{- 4Cov(X,Y)} \color{brown}{- 4Cov(Y,Z)} \color{gray}{+ 2Cov(X,Z)}$$

where the parts with similar color combine to give the respective part on the next line. Hence, the answer would be $2 + 16 +6-4-4 = 16$. Please check and tell me if this answer is correct.

• Hi, thanks for your help! I understand it now. I think you made a mistake when you took away E[Z]^2 in the 4th line as you put the square in the bracket? – kriskross Oct 9 '17 at 10:31
• Thank you for pointing this out, it was a mistake, now corrected. I am happy to know that you like this answer. If you are satisfied, you may accept this answer and close this question, otherwise you can wait for other answers. – астон вілла олоф мэллбэрг Oct 9 '17 at 10:33
• Also, on the brown part on the 4th line, it is meant to be 4E[Y]E[Z], correct? – kriskross Oct 9 '17 at 10:37
• Yes, thank you once again for pointing it out. – астон вілла олоф мэллбэрг Oct 9 '17 at 10:39

Covariance is bilinear and symmetric, so that:

\begin{aligned}\mathsf{Var}U & =\mathsf{Cov}\left(U,U\right)\\ & =\mathsf{Cov}\left(X-2Y+Z,X-2Y+Z\right)\\ & =\mathsf{Cov}\left(X,X\right)+4\mathsf{Cov}\left(Y,Y\right)+\mathsf{Cov}\left(Z,Z\right)-4\mathsf{Cov}\left(X,Y\right)+2\mathsf{Cov}\left(X,Z\right)-4\mathsf{Cov}\left(Y,Z\right)\\ & =\mathsf{Var}X+4\mathsf{Var}Y+\mathsf{Var}Z-4\mathsf{Cov}\left(X,Y\right)+2\mathsf{Cov}\left(X,Z\right)-4\mathsf{Cov}\left(Y,Z\right)\\ & =2+4\cdot4+6-4\cdot1+2\cdot0-4\cdot1\\ & =16 \end{aligned}