I'm confused a bit with the following problem: As far as i understand, the following problem where

$$\min_{w} \omega^{T}\Sigma\omega$$ $$\textrm{s.t.}\hspace{0.5cm} \omega^{T}\mu=E$$ $$ \omega^{T}\textbf{1}=1 $$

yields the analytical solution $$w^{*}=\frac{\Sigma^{-1}\mu}{1'\Sigma^{-1}\mu} $$ where $w$ represents the vector of optimal portfolio weights.

The derivation of the former appears relatively easy as the constraint in the maximization problem is linear thus i can solve the linear system of equations for the lagrange multipliers, plug them back into my first FOC and solve for the weights vector.

The derivation of the analytical form of the equivalent dual representation where i maximize the portfolio return for a given level of portfolio volatility of the form: $$\max_{w} \omega^{T}\mu$$ $$\textrm{s.t.}\hspace{0.5cm} \omega^{T}\Sigma\omega=\sigma^2$$ $$ \omega^{T}\textbf{1}=1 $$ is not so straight forward to me as i'm stuggeling at the point where i try to solve for the lagrange multipliers given the FOC for the portfolio weights: $$\frac{d{L(\dots)}}{d{\omega}}=\mu-2\lambda_{1}\Sigma\omega-\lambda_{2}\textbf{1}=0$$ $$\frac{d{L(\dots)}}{d{\lambda_{1}}}=\sigma^{2}-\omega^{T}\Sigma\omega=0$$ $$\frac{d{L(\dots)}}{d{\lambda_{2}}}=1-\omega^{T}\textbf{1}=0$$

Here, $\mu$ is the vector of expected returns, $\omega$ the vector of asset weights, $\Sigma$ the covariance matrix, $\lambda_{1}$ and $\lambda_{2}$ the lagrange multipliers for constraints 1 and 2 and $\sigma^2$ is my target variance.

The problem here (at least for me) is that the first derivative for the lagrange multiplier of the variance constraint includes two weight-vectors and thus yields a quadratic expression, for which i can't easily solve the second FOC for the needed lagrange multipliers.. and i'm not sure whether i'm on the right track and if yes, how to solve for the analytical expression of $\omega$.

My question: If i want to maximize expected return given my portfolio variance equals some target variance, how does my solution $w$ change and how to explicitly derive this step-by-step (or where can i find some paper where this derivation has been made)?

EDIT: I spent a few hours yesterday night and came up with the closed form for $\omega$ ignoring the sum of weights equal 100% constraint:

In detail: $$\max_{w} \omega^{T}\mu$$ $$\textrm{s.t.}\hspace{0.5cm} \omega^{T}\Sigma\omega=\sigma^2$$

The Lagrangean is: $$L(\dots)=\omega^{T}\mu+\lambda(\sigma^{2}-\omega^{T}\Sigma\omega)$$

for which the FOCs are: $$\frac{dL(\dots)}{d\omega}=\mu-2\lambda\Sigma\omega=0$$ $$\frac{dL(\dots)}{d\lambda}=\sigma^{2}-\omega^{T}\Sigma\omega=0$$

such that $$(\frac{1}{2\lambda}\Sigma^{-1}\mu)\Sigma(\frac{1}{2\lambda}\Sigma^{-1}\mu)=\sigma^2$$ $$\Rightarrow\frac{1}{4\lambda^2}\mu^{T}\Sigma^{-1}\mu=\sigma^2$$ $$\Rightarrow\frac{1}{2\sigma}\sqrt{\mu^{T}\Sigma^{-1}\mu}=\lambda$$

Pugging back into the first FOC: $$\frac{1}{2}(\frac{1}{\frac{1}{2\sigma}\sqrt{\mu^{T}\Sigma^{-1}\mu}})\Sigma^{-1}\mu=\omega$$ and thus: $$\omega^{*}=\frac{\sigma\Sigma^{-1}\mu}{\sqrt{\mu^{T}\Sigma^{-1}\mu}}$$

For the problem with the sum-of-weights constraint the problem is: $$\max_{w} \omega^{T}\mu$$ $$\textrm{s.t.}\hspace{0.5cm} \omega^{T}\Sigma\omega=\sigma^2$$ $$ \omega^{T}\textbf{1}=1 $$

The Lagrangean reads as: $$L(\dots)=\omega^{T}\mu+\lambda_{1}(1-\omega^{T}\textbf{1})+\lambda_{2}(\sigma^{2}-\omega^{T}\Sigma\omega)$$

The FOCs are: $$\frac{dL(\dots)}{d\omega}=\mu--\lambda_{1}\textbf{1}-2\lambda_{2}\Sigma\omega=0$$ $$\frac{dL(\dots)}{d\lambda_1}=1-\omega^{T}\textbf{1}=0$$ $$\frac{dL(\dots)}{d\lambda_1}=\sigma^{2}-\omega^{T}\Sigma\omega=0$$

From the first FOC we get:

$$\omega =\dfrac{1}{2\lambda_1} \Sigma^{-1} ( \mu - \lambda_2 \mathbf{1}) $$

By multiplying this a) with $\Sigma$ and a second time b) with $\textbf{1}$ and using the second and third FOCs:

$$\frac{1}{(2\lambda_1)^2}(\mu -\lambda_2\textbf{1} )^{T}\Sigma^{-1}(\mu-\lambda_2 \textbf{1})=\sigma^2$$ $$\Rightarrow\omega^{T}\mu=\lambda_{1}+2\lambda_{2}\sigma^2$$ and $$\frac{1}{2\lambda_1}\mathbf{1}^{T}\Sigma^{-1}(\mu -\lambda_2\textbf{1} )=1 $$ $$\Rightarrow\omega^{T}\mu=\frac{1}{2\lambda_1}(\mu^{T}\Sigma^{-1}\mu-\lambda_{1}\mu^{T}\Sigma^{-1}\textbf{1})$$

Notation from here onwards: $$A=\mu^{T}\Sigma^{-1}\mu$$ $$B=\mu^{T}\Sigma^{-1}\textbf{1}$$ $$C=\textbf{1}^{T}\Sigma^{-1}\textbf{1}$$

Combining the two equations by $\omega^{T}\mu$ and eliminating $(2\lambda_1)$: $$\lambda_{1}+2\lambda_{2}\sigma^2=\frac{1}{2\lambda_{2}}(A-\lambda_{1})$$

Now using $\omega$ from the first FOC again and multiply both sides with $\textbf{1}$ we get: $$B-\lambda_{1}C=2\lambda_{2}$$

We can substitute this now for $2\lambda_{2}$ in the equation above and get the quadratic expression: $$\lambda_{1}^{2}(C^{2}\sigma^{2}-C)+\lambda_{1}(2B-BC\sigma^2)+(B^{2}\sigma^{2}-A)=0$$

for which we get the messy solution(s): $$\lambda_{1}^{*}=\frac{-(2B-BC\sigma^2)\pm\sqrt{B^{2}(4-3C^{2}\sigma^{4})-AC}}{2C(C\sigma^{2}-1)}$$

We then solve for $\lambda_{1}$, and $\omega$:


and finally: $$\omega^{*}=\frac{1}{\frac{-(2B-BC\sigma^2)\pm\sqrt{B^{2}(4-3C^{2}\sigma^{4})-AC}}{2C\sigma^{2}-2}}(\Sigma^{-1}\mu-(\frac{-(2B-BC\sigma^2)\pm\sqrt{B^{2}(4-3C^{2}\sigma^{4})-AC}}{4C\sigma^{2}-4})\Sigma^{-1}\textbf{1})$$

My questions now: Is this expression correct? For which values is the expression under the square root positive? Is there a mathematical reasoning, which $\lambda_{2}^{*}$ to use (w.r.t. the $\pm$-sign)?

Thank you again for your help :-) Yours Thomas

  • $\begingroup$ @nbbo2 thanks for your comment. I thought I wrote that.. 🤔 $\endgroup$
    – T123
    Jul 8, 2023 at 14:30
  • $\begingroup$ Section 1.2 of this is related to your question and I think answers it but I didn't go over it carefully. columbia.edu/~mh2078/FoundationsFE/MeanVariance-CAPM.pdf $\endgroup$
    – mark leeds
    Jul 9, 2023 at 15:29
  • $\begingroup$ @markleeds thanks for the link and the comment. I'm not sure but I guess I'm not clear in my question. I will rewrite it tomorrow, hopefully it becomes a bit clearer what I'm trying to ask. $\endgroup$
    – T123
    Jul 9, 2023 at 18:30
  • $\begingroup$ @T123: I think I understand your question now but I read it incorrectly the first time which caused me to find something not relevant. My mistake. $\endgroup$
    – mark leeds
    Jul 10, 2023 at 2:56
  • 2
    $\begingroup$ Your expression is correct, see equation 2.3 in arxiv.org/pdf/1310.3396.pdf $\endgroup$ Jul 11, 2023 at 10:29

1 Answer 1


Answer to updated question:

The new expression for $\omega^*$ is also not correct. To see why let:

$$ \begin{split} \mu &:= \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \textbf{1} \\ \Sigma &:= \begin{bmatrix} 2 & 0\\ 0 & 2 \end{bmatrix} \\ \end{split} $$

In this case,

$$ \Sigma^{-1} = \begin{bmatrix} \frac{1}{2} & 0\\ 0 & \frac{1}{2} \end{bmatrix} $$


$$ A = B = C = \textbf{1}^T \Sigma^{-1}\textbf{1} = 1 $$

This lets us simplify $\omega^*$ to:

$$ \omega^* = \frac{2\sigma^2 - 2}{\sigma^2 - 2 \pm \sqrt{3 - 3\sigma^4}} \left(1 + \frac{2 - \sigma^2 \pm \sqrt{3 - 3\sigma^4}}{4\sigma^2-4} \right)\Sigma^{-1}\textbf{1} $$


$$ \alpha(\sigma) := \frac{2\sigma^2 - 2}{\sigma^2 - 2 \pm \sqrt{3 - 3\sigma^4}} \left(1 + \frac{2 - \sigma^2 \pm \sqrt{3 - 3\sigma^4}}{4\sigma^2-4} \right) $$


$$ \omega^* = \alpha(\sigma)\Sigma^{-1}\textbf{1} $$

Since $\left(\omega^*\right)^T\textbf{1} = 1$,

$$ \begin{split} & \left(\alpha(\sigma)\Sigma^{-1}\textbf{1}\right)^T\textbf{1} = 1 \\ \Rightarrow \quad& \alpha(\sigma)\textbf{1}^T\Sigma^{-1}\textbf{1} = 1 \\ \Rightarrow \quad& \alpha(\sigma) = 1 \\ \end{split} $$

So the constraint $\left(\omega^*\right)^T\textbf{1} = 1$ is voilated for any $\sigma$ that's not a zero of the equation $\alpha(\sigma) - 1$.

Note, while there may be a closed-form solution to this problem, it's not clear that there is, because of the nonlinear constraint this problem formulation introduces. If you can't find a closed-form solution, you may need to resort to a numerical solution using a nonlinear programming method, or reformulate the problem, like the original quadratic programming problem you referenced, where you minimize the variance rather than maximize the expected return.

Answer to original question:

(The original question asked if

$$\omega^* = \frac{\sigma\Sigma^{-1}\mu}{\sqrt{\mu^T\Sigma^{-1}\mu}}$$

was a solution the same problem. My answer to that previous question is below, in case it helps anyone else.)

This expression is not correct. To see why, consider this example. Let:

$$ \begin{split} \mu &:= \begin{bmatrix} 1 \\ 1 \end{bmatrix} = \textbf{1} \\ \Sigma &:= \begin{bmatrix} 1 & 0\\ 0 & 1 \end{bmatrix} = I \\ \end{split} $$

Note that $$ \Sigma^{-1}\mu = I^{-1}\textbf{1} = I \textbf{1} = \textbf{1} $$

So $$ \begin{split} \omega^* &= \frac{\sigma\Sigma^{-1}\mu}{\sqrt{\mu^T\Sigma^{-1}\mu}} \\ &= \frac{\sigma\textbf{1}}{\sqrt{\mu^T\textbf{1}}} \\ &= \frac{\sigma\textbf{1}}{\sqrt{\textbf{1}^T\textbf{1}}} \\ &= \frac{\sigma\textbf{1}}{\sqrt{2}} \\ &= \frac{\sigma}{\sqrt{2}} \textbf{1} \end{split} $$

But then:

$$ \begin{split} 1−(\omega^*)^T\textbf{1} &= 1 - \frac{\sigma}{\sqrt{2}} \textbf{1}^T\textbf{1} \\ &= 1 - \frac{\sigma}{\sqrt{2}} 2\\ &= 1 - \frac{2\sigma}{\sqrt{2}} \\ \end{split} $$

For any $\sigma \neq \frac{\sqrt{2}}{2}$:

$$ 1−(\omega^*)^T\textbf{1} \neq 0 $$

So the third Lagrangian condition is not satisfied in general.

  • $\begingroup$ Yes, you are right, it misses the full investment constraint. I already have a solution for both constraints and will post an update later!.. And there is a sigma missing in your optimal omega.. $\endgroup$
    – T123
    Jul 14, 2023 at 4:42
  • $\begingroup$ Good catch. I corrected this. $\endgroup$ Jul 14, 2023 at 4:48
  • $\begingroup$ Hi @Adam I've updated my question. Would you mind posting your current answer into a comment so we don't lose it? $\endgroup$
    – T123
    Jul 14, 2023 at 8:19
  • 1
    $\begingroup$ I tried to answer your new question, and I kept the answer to your question around as an addendum, in case it helps someone else. (I thought putting it in a comment would make it quite hard to read!) $\endgroup$ Jul 15, 2023 at 13:29
  • $\begingroup$ thank you again for your answer, I really appreciate it. I also found that this equation doesn't give me a sum of weights that are equal to one. I'm sure I made a mistake somewhere. Do you have an idea where I need to correct it? $\endgroup$
    – T123
    Jul 16, 2023 at 9:07

Your Answer

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

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