# Mean-variance portfolio & quadratic programming

I am somewhat confused when it comes to modern portfolio theory, mean-variance portfolio optimization and its quadratic programming formulation.

## Issue 1: Formulation of mean-variance portfolio optimization

I learned that the mean-variance portfolio is given by the problem:

Minimize with respect to $\mathbf{x}$: $\mathbf{x}^T \mathbf{\Sigma}\mathbf{x}$

Subject to the constraints: $\mathbf{\mu}^T\mathbf{x} \geq r, \mathbf{1}^T\mathbf{x}=1$

where $\mathbf{x}$ is the portfolio and $r$ is the target return

However, on Wikipedia I find that modern portfolio theory involves the following optimization problem:

Minimize with respect to $\mathbf{x}$: $\mathbf{x}^T \mathbf{\Sigma}\mathbf{x} - q\times\mathbf{\mu}^T\mathbf{x}$

Subject to the constraint: $\mathbf{1}^T\mathbf{x}=1$

How are these two formulations identical?

## Issue 2: Form of quadratic programming problem

In most references (among other on Wikipedia) the quadratic programming problem is given by:

Minimize with respect to $\mathbf{x}$: $\frac{1}{2} \mathbf{x}^T Q\mathbf{x} + \mathbf{c}^T \mathbf{x}$

Subject to the constraints: $A\mathbf{x} \leq \mathbf b,$ $E\mathbf{x} = \mathbf d$

However, the R function quadprog::solve.QP solves the following problem:

Minimize with respect to $\mathbf{x}$: $\frac{1}{2} \mathbf{x}^T Q\mathbf{x} - \mathbf{g}^T \mathbf{x}$

Subject to the constraints: $K\mathbf{x} \geq \mathbf m$

Note:

• the sign of c is opposite
• the inequality constraint is opposite
• the equality constraint is missing

How are these two identical? I can accept the sign change for $\mathbf c$ as cosmetic but the rest...

-

## 1 Answer

With respect to issue one, it can be simpler to consider the case where the constraint on the expected return is an equality. In that case, the first problem can be transformed to

Minimize with respect to $\left\{ x,\lambda_{1},\lambda_{2}\right\}$: $x'\Sigma x + \lambda_{1} (\mu'x - r) + \lambda_{2} (1'x - 1)$

by the technique of Lagrangian multipliers, while the second can be transformed to

Minimize with respect to $\left\{ x,\lambda_{2}\right\}$: $x'\Sigma x - q \mu'x + \lambda_{2} (1'x - 1)$

Thus, you could solve the first one and set $q \equiv -\lambda_{1}$ to effectively get the equivalent problem in the second. Since the $r$ is a constant, you can add it's term back in and it wouldn't have any impact on the final optimization (in the second, that is).

In my experience, one can easily switch between a maximize return, minimize risk, or maximize utility framework for simple portfolio optimization problems. However, if you incorporate transaction costs or perform robust optimization or some other sophisticated approach, the efficient frontiers might exhibit some differences. Ultimately, you have to make a decision about which to use (it is probably more common to minimize risk subject to constraints) and just do that consistently when constructing efficient frontiers or portfolio.

With respect to issue two, optimizers are often different in their specifications. You typically will have to adjust your problem to be in the form of whatever the optimizer is. For instance, multiplying your $c$ by $-1$, multiply $A$ and $b$ by -1 each, and adding additional inequality constraints to create equality constraints (because you can express one equality as two inequalities).

-
Thank you so much. This answer really opened my eyes. One quick follow up question? Am I right to assume that portfolio optimization by maximising the returns for a given portfolio variance is not a "convenient" (i.e. linear programming) problem since the constraint is not linear but quadratic? It has to be solved by gradient ascent or similar, right? – Mel Apr 1 '14 at 16:26
The minimize variance or maximize utility approach can easily be cast in terms of a quadratic programming problem, which have been well-studied. As you note, you can't apply quadratic programming to maximizing return given variance because it involves a non-linear constraint. There are a lot of techniques that can do it. Second-order cone programming comes to mind. Most commercial optimizers I've used can do it. There are some open source non-linear optimizers that can as well. – John Apr 1 '14 at 16:47