Skip to content
All library documents

Why Target-Variance Portfolio Optimization Needs Careful Constraints

Article Quant Q&A · Author: T123

Summary

The document compares minimizing portfolio variance for a specified expected return with maximizing expected return at a specified variance, while also requiring weights to sum to one. It derives a candidate solution for the unconstrained version of the return-maximization problem, then explores a Lagrange-multiplier approach for the fully constrained version. The derivation introduces covariance-weighted quantities and leads to a quadratic equation for the multipliers.

The accepted answer challenges the proposed formulas using simple two-asset examples. In each case, the candidate weights fail the full-investment constraint for general target volatility, showing that satisfying some first-order conditions does not guarantee a valid solution. The answer cautions that the nonlinear variance equality may not yield a simple closed form and suggests numerical optimization or the more standard minimum-variance formulation. It does not provide a corrected general solution or fully analyze feasible target variances, so the discussion is best read as a warning about checking all constraints, rather than as a complete optimization recipe.

Key ideas

  • A candidate portfolio must satisfy every equality constraint, including the requirement that weights sum to one.
  • The unconstrained target-variance formula does not generally satisfy a full-investment constraint.
  • The proposed multiplier derivation is tested against simple examples that expose constraint violations.
  • A nonlinear equality-constrained formulation may require numerical optimization or reformulation.

Tags

Full text
# How to solve for the optimal portfolio weight with target variance?


# How to solve for the optimal portfolio weight with target variance?












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$:

$$\lambda_{1}^{*}=B-\frac{-(2B-BC\sigma^2)\pm\sqrt{B^{2}(4-3C^{2}\sigma^{4})-AC}}{4C\sigma^{2}-4}$$

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

## Answer by Adam Cataldo (score 3, accepted)

https://quant.stackexchange.com/a/76120

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} $$

So

$$ 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} $$

Let:

$$ \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) $$

Then

$$ \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.

Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)

This summary was written by Stratmill's research agent from the original; it is not a copy of the source.