# Find the covariance matrix of a vector of random variables

If $X$ and $Y$ are independent and identical gaussian random variables with $\mu=0$ and $\sigma^2=1$, how can I calculate the covariance matrix of the following vector:

$$Z=\begin{pmatrix} X+2Y\\ 1-X-Y\\ 2X-Y \end{pmatrix}$$

I tried to start by writing $E(Z)$, the vector contaning the mean values of $Z$:

$$E(Z)=\begin{pmatrix} 0\\ 1\\ 0 \end{pmatrix}$$

And, by definition, I wrote $\operatorname{cov}(Z)=E((Z-E(Z)(Z-E(Z))^T))$, and

$$\operatorname{cov}(Z)=E\begin{pmatrix} Z_1^2 & Z_1Z_2 & Z_1Z_3\\ Z_2Z_1 & Z_2^2 & Z_2Z_3\\ Z_3Z_1 & Z_3Z_2 & Z_3^2 \end{pmatrix}$$

with $Z_1=N(0,5), Z_2=N(-1,2), Z_3=N(0,5)$

But I how do I go further? I mean, how do I find the covariance between $Z_1$ and $Z_2$? Can I say they are independent?

## 2 Answers

$\newcommand{\c}{\operatorname{cov}}$ $$Z=\begin{bmatrix} X+2Y\\ 1-X-Y\\ 2X-Y \end{bmatrix}$$ You can use the fact that covariance is linear in each variable separately, thus: \begin{align} \c(X+2Y, 1 - X - Y) = {} & \c(X, 1-X-Y) + 2\c(Y,1-X-Y) \\[10pt] = {} & \Big( \c(X,1) - \c(X,X) - \c(X,Y)\Big) \\ & {} + \Big(2\c(Y,1) - 2\c(Y,X) - 2\c(Y,Y)\Big) \\[10pt] = {} & \text{etc.} \end{align}

You can also use matrix algebra.

$$\begin{bmatrix} Z_1 \\ Z_2 \\ Z_2 \end{bmatrix} = \begin{bmatrix} 0 \\ 1 \\ 0 \end{bmatrix} + \begin{bmatrix} \phantom{-}1 & \phantom{-}2 \\ -1 & -1 \\ \phantom{-}2 & -1 \end{bmatrix} \begin{bmatrix} X \\ Y \end{bmatrix}$$ Write this as $Z = MW,$ where $M$ is that $3\times2$ matrix. Then we have $$\c(MW) = M \Big( \c W\Big) M^T$$ and $\c W$ is the $2\times2$ identity matrix.

We have that$$\operatorname{cov}(Z)=E\{(Z-E(Z))(Z-E(Z))^T\}=E\left\{\begin{bmatrix}(X+2Y)^2&(X+2Y)(-X-Y)&(X+2Y)(2X-Y)\\(X+2Y)(-X-Y)&(X+Y)^2&(-X-Y)(2X-Y)\\(X+2Y)(2X-Y)&(-X-Y)(2X-Y)&(2X-Y)^2\end{bmatrix}\right\}=\begin{bmatrix}5&-3&0\\-3&2&-1\\0&-1&5\end{bmatrix}$$