# Tag Info

Following @silencer's comment, your formula for variance is wrong. I would suggest that instead of trying to re-invent the wheel, you just use the formula that everyone else uses. So I'd replace your first indented line with $$w^{*}\equiv argmin\left\{ \frac{1}{2}w'\varSigma w-\lambda\left(w'\mathbf{1}-1\right)\right\}$$ which will give you $$... 1 The derivation is correct and given the formula you should get w^{*'} \vec{1} = 1. My guess is that the inversion of the \Omega matrix is numerically badly conditioned. Instead of implementing the formula as it is, have you tried to calculate \vec{1}^{'} \Omega^{-1} and e^{'} \Omega^{-1} only once and rewrite:$$ w^{*\prime} = \frac{1}{2}\left[ ...