# Minimizing the variance of weighted sum of two random variables with respect to the weights

Suppose $X$ and $Y$ are two random variables. I would like to see if the solution to $$\min_w \quad \mathrm{Var}(wX+(1-w)Y)$$ can be negative.

I know that \begin{align*} &\mathrm{Var}(wX+(1-w)Y) \\ &= w^2 \mathrm{Var} X + 2w(1-w)\mathrm{Cov}(X,Y) + (1-w)^2 \mathrm{Var}Y \\&= w^2 (\mathrm{Var} X - 2\mathrm{Cov}(X,Y) + \mathrm{Var}Y) + 2w(\mathrm{Cov}(X,Y) - \mathrm{Var}Y) + \mathrm{Var}Y \end{align*} Since $$\mathrm{Var} X - 2\mathrm{Cov}(X,Y) + \mathrm{Var}Y \geq \mathrm{Var} X - 2\sqrt{\mathrm{Var} X \, \mathrm{Var} Y}+ \mathrm{Var}Y \geq 0,$$ the minimizer is $$w^*=-\frac{\mathrm{Cov}(X,Y) - \mathrm{Var}Y}{\mathrm{Var} X - 2\mathrm{Cov}(X,Y) + \mathrm{Var}Y}$$

So if I am correct so far, the problem of whether $w^*$ can be negative becomes whether it can be true that $$\mathrm{Cov}(X,Y) - \mathrm{Var}Y > 0?$$

Thanks!

-
@DilipSarwate: Thanks! How is that possible? – Tim Dec 9 '11 at 23:18
It can't be negative, but it could be $0$ if $X=Y$. – Robert Israel Dec 9 '11 at 23:20

Yes, of course. For example, try $X = t Y$ where $t > 1$.

-

$$\mathrm{Var}(wX+(1-w)Y) = w^2 (\mathrm{Var} X - 2\mathrm{Cov}(X,Y) + \mathrm{Var}Y) + 2w(\mathrm{Cov}(X,Y) - \mathrm{Var}Y) + \mathrm{Var}Y$$ is a quadratic function of $w$ whose minimum value occurs, as you noted, at $$-\frac{\mathrm{Cov}(X,Y) - \mathrm{Var}Y}{\mathrm{Var} X - 2\mathrm{Cov}(X,Y) + \mathrm{Var}Y}$$ which is negative if $\mathrm{Cov}(X,Y) > \mathrm{Var}Y.$

Note that $\mathrm{Var}(wX+(1-w)Y)$ has value $\mathrm{Var}Y$ at $w = 0$ and value $\mathrm{Var} X$ at $w = 1$. Suppose $\mathrm{Var} X > \mathrm{Var} Y$. Then $w^*$ must be smaller than $1$. In fact, $$w^* < 0 ~~\mathrm{if}~~ \frac{\mathrm d}{\mathrm dw}\mathrm{Var}(wX+(1-w)Y)\biggr|_{w=0} > 0, ~~\mathrm{i.e.\ if}~\mathrm{Cov}(X,Y) - \mathrm{Var}Y > 0.$$ A similar analysis can be done to figure out the conditions under which $w^* > 1$.

So, when $\mathrm{Var} X > \mathrm{Var} Y$, what does it mean to have $\mathrm{Cov}(X,Y) > \mathrm{Var}Y$? Equivalent ways of saying the same thing are that $(X-Y)$ and $Y$ are positively correlated or that $$\rho_{X,Y} > \sqrt{\frac{\mathrm{Var} Y}{\mathrm{Var} X}}.$$

The minimum value of $\mathrm{Var}(wX+(1-w)Y)$ is positive unless $Y = aX+b$ for some real numbers $a$ and $b$ in which case the minimum value of variance is $0$.

-