# Covariance of product

A question has been asked regarding the Variance of product of dependent variables. I am interested in the case in which $X$ is a vector and $Y$ is a scalar and the two variables are independent.

What is $\mbox{var}(\mathbf{X}Y)$, where $\mathbf{X}\perp Y$?

• The only way to interpret this notation consistently is that "$\mbox{var}(\mathbf{X}Y)$" has to be the vector of variances of the $X_iY$, rather than full variance-covariance matrix. But then the last term on the right side (which is either a matrix or a scalar, depending on whether you think of vectors as being columns or rows) does not match its dimensions. The second question is similarly problematic. Please, then, explain what your notation means. – whuber Feb 13 '15 at 16:22
• Thanks, @whuber. My vectors are column vectors. The notation $\mbox{var}(\mathbf{X}Y)$ refers to the matrix describing the covariances between the rows of $\mathbf{X}Y$. If you call this matrix $\mathbf{C}$, then $\mathbf{C}_{st}$ gives the covariance between $X_sY$ and $X_tY$. Does this make sense? – Vivek Subramanian Feb 13 '15 at 16:26
• It does, but now the terms in your second question have dimensions (from left to right) $1\times 1$, $n\times n$, $n\times n$, and $n\times n$ where $X$ and $Y$ each are of dimension $n$. If instead you wanted to ask about $\text{var}(XY^\prime)$, then $XY^\prime$ would be a matrix with $n^2$ coefficients and its variance-covariance matrix would have $n^4$ entries. There's no way you can make the left and right sides match. – whuber Feb 13 '15 at 16:30
• Right, okay, that makes sense. Let's ignore the second question - I didn't put too much thought into it and just realized that $\mbox{var}(\mathbf{X}^\top\mathbf{Y})$ is simply $\sum{\mbox{var}(X_sY_s)}$, and each entry of the sum can be computed using the formula in the question I link to in my first statement. – Vivek Subramanian Feb 13 '15 at 16:39
• The first question isn't much different from that: the matrix on the left has two kinds of terms of the forms $\text{var}(X_iY)$ (whose values you already know from the previous thread you reference) and $\text{cov}(X_iY, X_jY)$ (whose values can be obtained using the same method described in that thread). – whuber Feb 13 '15 at 16:42

As @whuber pointed out, we can calculate the variance of each entry of $\mathbf{X}Y$ using the formula in the question linked to in my first statement. Thus, $$\mbox{cov}(X_iY, X_iY) = \mbox{var}(X_iY) = \mbox{var}(X_i)\mbox{var}(Y) + \mbox{var}(X_i)\mathbb{E}[Y]^2 + \mbox{var}(Y)\mathbb{E}[X_i]^2$$
Moreover, the covariance between $X_iY$ and $X_jY$ is given by: \begin{align*} \mbox{cov}(X_iY, X_jY) &= \mathbb{E}[X_iX_jY^2] - \mathbb{E}[X_iY]\mathbb{E}[X_jY]\\ &= \mathbb{E}[X_iX_j]\mathbb{E}[Y^2] - \mathbb{E}[X_i]\mathbb{E}[X_j]\mathbb{E}[Y]\mathbb{E}[Y]\\ &= (\mbox{cov}(X_i, X_j) + \mathbb{E}[X_i]\mathbb{E}[X_j])\mathbb{E}[Y^2] -\mathbb{E}[X_i]\mathbb{E}[X_j]\mathbb{E}[Y]^2\\ &= \mbox{cov}(X_i, X_j)\mathbb{E}[Y^2] + (\mathbb{E}[X_i]\mathbb{E}[X_j])(\mathbb{E}[Y^2] - \mathbb{E}[Y]^2)\\ &= \mbox{cov}(X_i, X_j)\mathbb{E}[Y^2] + \mathbb{E}[X_i]\mathbb{E}[X_j]\mbox{var}(Y)\\ &= \mbox{cov}(X_i, X_j)(\mbox{var}(Y) + \mathbb{E}[Y]^2) + \mathbb{E}[X_i]\mathbb{E}[X_j]\mbox{var}(Y) \end{align*}
Note that when we replace $X_jY$ with $X_iY$ in the formula for $\mbox{cov}(X_iY, X_jY)$, we recover the formula for $\mbox{var}(X_iY)$. Thus, we can construct a covariance matrix $\mathbf{C}$ for $\mathbf{X}Y$ where $C_{ij} = \mbox{cov}(X_iY, X_jY)$.