# Finding variance using the matrix method [closed]

If the random variables $X,Y$ and $Z$ have means: $$\bar{x}=2 \;\;\; \bar{y}=-3 \;\;\; \bar{z}=4$$ and variances $$\operatorname{Var}(x)=1 \;\;\; \operatorname{Var}(Y)=5 \;\;\; \operatorname{Var}(Z)=2$$ and co-variance $$\operatorname{Cov}(X,Y)= -2\;\;\; \operatorname{Cov}(X,Z)=-1\;\;\;\operatorname{Cov}(Y,Z)=1$$ Find

1. Mean of $W=3X-Y+2Z$
2. The variance of $W=3X-Y+2Z$ using the matrix method

## closed as off-topic by StubbornAtom, Mostafa Ayaz, Strants, Namaste, Key FlexJul 31 '18 at 0:37

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question is missing context or other details: Please improve the question by providing additional context, which ideally includes your thoughts on the problem and any attempts you have made to solve it. This information helps others identify where you have difficulties and helps them write answers appropriate to your experience level." – StubbornAtom, Mostafa Ayaz, Strants, Namaste, Key Flex
If this question can be reworded to fit the rules in the help center, please edit the question.

• Welcome to MSE. For a proficient interaction, please take a few minutes to learn MathJax: math.meta.stackexchange.com/questions/5020/…. Also providing the attempt that you've made would be much appreciated. – xbh Jul 30 '18 at 16:25

## Hint

$$E[aX+b] = aE[X]+b$$ $$\operatorname{Var}[aX+bY] = \mathbf{v}^T\mathbf{M}\mathbf{v}$$ where $\mathbf{v} = \left(\begin{matrix}a\\b\end{matrix}\right)$ and $\mathbf{M}$ is the matrix of covariance defined (in the case two variables) as $$\left(\begin{matrix}\operatorname{Var}[X]&\operatorname{Cov}[X,Y]\\\operatorname{Cov}[Y,X]&\operatorname{Var}[Y]\end{matrix}\right)$$

## Solution

The fist question is the easiest, from the linearity of the mean you can simply add together the means with their respective coefficientent given by the formula for $W$, mainly $$E[W] = E[3X-Y+2Z] = 3E[X]-E[Y]+2E[Z] = 3(2)-(-3)+2(4) = 17$$ The second, given the formula above is to be solved by simple matrix multiplication. In our case $$\mathbf{v} = \left(\begin{matrix}3\\-1\\2\end{matrix}\right)\;\;\;\mathbf{M}=\left(\begin{matrix}\operatorname{Var[X]}&\operatorname{Cov[X,Y]}&\operatorname{Cov[X,Z]}\\\operatorname{Cov[Y,X]}&\operatorname{Var[Y]}&\operatorname{Cov[Y,Z]}\\\operatorname{Cov[Z,X]}&\operatorname{Cov[Z,Y]}&\operatorname{Var[Z]}\end{matrix}\right) = \left(\begin{matrix}1&-2&-1\\-2&5&1\\-1&1&2\end{matrix}\right)$$ Then we calculate the variance of $W$ as $$\operatorname{Var}[W] = \operatorname{Var}[3X-Y+2Z] = \underbrace{\left(\begin{matrix}3&-1&2\end{matrix}\right)\left(\begin{matrix}1&-2&-1\\-2&5&1\\-1&1&2\end{matrix}\right)}_{\text{first multiplication}}\left(\begin{matrix}3\\-1\\2\end{matrix}\right)$$ let's do first the underbraced multiplication $$\left(\begin{matrix}3&-1&2\end{matrix}\right)\left(\begin{matrix}1&-2&-1\\-2&5&1\\-1&1&2\end{matrix}\right) = \left(\begin{matrix}3&-9&6\end{matrix}\right)$$ and now let's do the second multiplication $$\left(\begin{matrix}3&-9&6\end{matrix}\right)\left(\begin{matrix}3\\-1\\2\end{matrix}\right)=30$$ So in the end we have that $$\operatorname{Var}[W]=30$$

• Please note that $\mathbb E(aX+b)=a\cdot \mathbb E(X)+\color{red}b$ – callculus Jul 30 '18 at 17:08
• @callculus Ops, my bad! Thank you – Davide Morgante Jul 30 '18 at 17:09
• Is there any difference between Cov(Y,X) and Cov (X,Y) ?@DavideMorgante – Eric kioko Jul 30 '18 at 18:30
• No, covariance is symmetric! $$Cov[X,Y]=Cov[Y,X]$$ – Davide Morgante Jul 30 '18 at 18:31
• @DavideMorgante Thanks. So from the hint above I'm supposed to get the determinant of the matrix or? Kindly shed some light I'm new to the matrix method. – Eric kioko Jul 30 '18 at 18:47