Covariance Matrix and minimizing variance

covariancelagrange multipliermultivariable-calculuspartial derivativestatistics

Let $X = (X_1 X_2 \cdots X_n)^T$ be $n$ not necessarily independent investment vehicles. Assume each has expected return $\mu$ with covariance matrix $\operatorname{Var}(X)=(\operatorname{Cov}(X_i,X_j))_{i,j}$. What values of $0\leq c_1, \cdots, c_n \leq 1, c_1+\cdots +c_n=1$ minimizes the variance of the variable $Z=c_1X_1+\cdots +c_nX_n$?

Let $c=(c_1 \cdots c_n)$, I know that $Z=cX$ and that $\operatorname{Var}(Z)=c\operatorname{X}c^T=\sum_{i=1}^n\sum_{j=1}^nc_ic_j\operatorname{Cov}(X_i,X_j).$

Let $$f(c_1, \cdots, c_n)=\sum_{i=1}^n\sum_{j=1}^nc_ic_j\operatorname{Cov}(X_i,X_j),$$
then it suffices to find the partial derivatives of $f$:

$$\frac{\partial f}{\partial c_j}=\sum_{k=1}^n2\operatorname{Cov}(X_j,X_k)c_k, \ j=1,\cdots, n$$

But I had troubles finding the minimum of $f$ subjected to the constraint $c_1+\cdots+c_n=1$. I tried using Largange multiplier but it didn't seem to work. Thanks in advance.

Best Answer

Setting up the Lagrange function (For $C_{ij} = Cov(X_i,X_j)$)

$$ \sum_{i=1}^n \sum_{j=1}^n c_i c_j C_{ij} - 2 \lambda \sum_{i=1}^n c_i $$

Taking the derivative w.r.t. $c_i$ and setting it to zero

$$ 2 c_{i} C_{ii} + 2 \sum_{j=1,i \neq j }^n c_j C_{ij} = 2 \lambda $$

Defining the matrix $C$, we can restate the system as $c \cdot C = \lambda \cdot 1_n $ where $1_n$ is the $n$-vector of ones.

Substituting back in the constraint, $c \cdot 1_n = \lambda \, 1_n \cdot C^{-1} \cdot 1_n = 1$ we arrive at the solution

$$ c = \frac{1}{1_n \cdot C^{-1} \cdot 1_n} \times 1_n \cdot C^{-1} $$

So, you can just sum columns of $C^{-1}$ to get the coefficients and normalize them.

Related Question