Numerical Methods for a Constrained Ratio-of-Quadratic-Forms Portfolio Problem
Summary
The document considers minimizing a ratio of two quadratic forms in portfolio weights, subject to a weights-sum equality constraint. It gives the Lagrangian derivatives with respect to the weights and multiplier, then explains why the denominator’s dependence on the weights makes the system difficult to simplify into a direct closed-form solution. The suggested approach is numerical.
Two routes are described: minimize the objective directly while enforcing the linear equality constraint, or solve the coupled first-order conditions as a root-finding problem for both the weights and multiplier. The examples identify standard numerical optimization and root-solving tools, but provide no implementation, convergence analysis, or comparison of outcomes. The advice is therefore a practical starting point rather than a full algorithm. Any numerical application still depends on suitable inputs and on the optimizer finding a valid solution; the document does not discuss how to handle problematic matrices, multiple stationary points, or numerical stability.
Key ideas
- The objective is a ratio of quadratic forms constrained by a weights-sum equality.
- Because the denominator depends on the weights, the derivatives do not yield an easy stated closed-form solution.
- One option is direct constrained numerical minimization.
- Another option is root-finding on the weight and multiplier first-order conditions.
- The document does not assess convergence, solution uniqueness, or numerical stability.
Tags
Full text
# Portfolio Optimization Problem
# Portfolio Optimization Problem
I have the following expression for which I wish to find the $\vec{w}$ which minimizes it:
$$ L = \frac{\vec{w}^TA\vec{w}}{\vec{w}^TB\vec{w}} - \lambda(\vec{w}^T\vec{1} - 1) $$
The partial derivates with respect to $\vec{w}$ and $\lambda$ are as follows
\begin{align*} \frac{\partial L}{\partial \vec{w}} &= \frac{2(\vec{w}^TB\vec{w})A\vec{w}-2(\vec{w}^TA\vec{w})B\vec{w}}{(\vec{w}^TB\vec{w})^2} - \lambda \\ \frac{\partial L}{\partial \lambda} &= -\vec{w}^T\vec{1} + 1 \end{align*}
But I'm having a hard time simplifying these to get the minimizing value of $\vec{w}$. Any insights?
## Answer by Pontus Hultkrantz (score 1)
https://quant.stackexchange.com/a/70880
Due to the $\vec w^TB\vec w$ in the denominator, you have to solve this problem numerically, either as a direct minimization with a constraint, or by finding the roots of the two Lagrangian equations after taking partial derivatives.
- Direct minimization with linear equality constraint
$$ min_\vec{w} \left(\frac{\vec{w}^TA\vec{w}}{\vec{w}^TB\vec{w}}\right) \quad s.t. \quad\vec{w}^T \vec{1}-1 = 0. $$ In Python this can be done e.g. using scipy.optimize.minimize with equality constraint argument specified.
- Alternatively, solve the lagrangian system of equations
$$ \frac{\partial L}{\partial \vec{w}} = 0 \\ \frac{\partial L}{\partial \lambda} = 0, $$ by finding the vector $\vec{w}$ and the value of $\lambda$ that solves the two equations (root finding). In Python this can be done using scipy.optimize.root.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.