I am wondering how I can find the vector of Lagrange multipliers $\mu$ for the non-negativity constraint of the following problem:

$$ L(w,\lambda, \mu) = w^{T}\Sigma w - \lambda(w -1) + \mu w $$

So far what I cam up with is, that $\mu$ can be isolated with first order condition $ \frac{\partial L }{\partial w} $:

$$ \Sigma w - \lambda = - \mu $$ $$ \mu = \lambda - \Sigma w $$

Is there a way I can find a explicit solution for $ \mu $?

I have no background in finance nor optimization, every suggestion or comment is appreciated, thanks!

  • $\begingroup$ Is $\mu$ the expected returns vector of the assets? Why do you want to solve this when it's just a given input to the model. you should be interested in $w$ (or $\lambda$) only $\endgroup$
    – develarist
    Apr 14, 2020 at 11:05
  • 1
    $\begingroup$ $\mu$ is the Lagrange multiplier of the positivity constraint (i.e. w > 0) $\endgroup$ Apr 14, 2020 at 13:50

1 Answer 1


You can use Lagrangian only with equal type constaints. There are inqualities in your problem, namely $w \ge 0$ and $w \le 1$. Hence Lagrange method cannot be employed here.

According to tags you added to the question, you are solving Markowitz optimization problem. One of its formulation (maximizing profit and minimizing risk at the same time) is

$$ f = \mu ^T w - \lambda w^T\Sigma w \rightarrow \text{MAX}, $$

subjected to $0 \le w \le 1$ and $\sum w_i =1$. Vector $\mu$ contains expected returns of assets in portfolio, $\Sigma$ is covariance matrix of returns and parameter $\lambda$ is used for setting averse to risk. Higher $\lambda$ means higher risk averse.

This task can be solved by so-called quadratic programming.

However, in practice you can employ MS Excel solver. As a solving method, please select GRG Non-linear. This is so-called gradient method and it can cope with quadratic problem task succesfully (this can be even proven mathematically).

  • $\begingroup$ is there another method that can yield an explicit solution? $\endgroup$ Apr 14, 2020 at 9:00
  • $\begingroup$ @secretsanta: I expanded the answer. Hope this helps. $\endgroup$ Apr 14, 2020 at 9:12
  • $\begingroup$ thanks, I know I can get the dual variables from such a solver I just wanted to see if there is another way $\endgroup$ Apr 14, 2020 at 9:27
  • 1
    $\begingroup$ are you calling $r$ what he is calling $\mu$? $\endgroup$
    – develarist
    Apr 14, 2020 at 11:06
  • 1
    $\begingroup$ @secretsanta: As I mentioned in my answer, Lagrangian method can be used only for optimization with constraints in form of equalities. In your cae $\mu w$ means condition $w=0$ which does not make sense. $\endgroup$ Apr 14, 2020 at 16:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.