Skip to content
All library documents

Recovering Tangency Portfolio Weights from a Sharpe Ratio Optimization

Article Quant Q&A · Author: Zac

Summary

The document explains how to recover portfolio weights after solving a transformed optimization problem for the maximum Sharpe ratio. In Markowitz portfolio theory, the tangency portfolio is associated with the highest ratio of expected excess return to portfolio risk. A change of variables converts that ratio problem into a quadratic minimization with a normalization constraint on excess return.

The accepted explanation adds a constraint linking the transformed asset vector to a scale variable, then recovers the original weights by dividing the vector by that scale. Another response notes that, under a fully invested budget constraint, the scale can be obtained by normalizing the transformed vector so its weights sum to one. The examples describe the transformation and its practical recovery step, but do not compare optimization assumptions such as short-sale restrictions or demonstrate performance on market data.

Key ideas

  • The tangency portfolio maximizes expected excess return relative to portfolio volatility.
  • A variable transformation turns the Sharpe ratio objective into a quadratic optimization problem.
  • The transformed asset vector must be rescaled to recover portfolio weights.
  • A budget constraint can link the scale variable to the sum of portfolio weights.
  • Constraints such as long-only bounds affect the optimization setup and resulting portfolio.

Tags

Full text
# How can I find the portfolio with maximum Sharpe Ratio - Using Lagrange Multipliers


# How can I find the portfolio with maximum Sharpe Ratio - Using Lagrange Multipliers












In Markowitz' portfolio theory we can construct portfolios with the minimum variance for a given expected return (or vice versa). Across expected risks, this traces out the well-known efficient frontier.

To find the so-called tangency portfolio, we look to solve:

$$\max_x \frac{\mu^T x}{\sqrt{x^T Q x}}$$

Following Tütüncü (section 5.2), this can be reformulated under a change of variables to a simpler quadratic optimisation problem:

$$\min_{y,\kappa} y^T Q y \qquad \text{where} \quad (\mu-r_f)^T y = 1,\; \kappa > 0$$

I've solved the problem and got values for $y$. However.. $\kappa$ is defined in terms of $x$... So, whilst I'm sure this is a stupid question, how do we actually translate the $y$ vector to recover the true portfolio weights $x$??

The only thing I can think of is that I did not include a constraint for $\kappa$. This is for the same reason as above (that it is defined in terms of $x$, and so not available), and because the KKT conditions suggested in this answer also ignore the $\kappa >0$ term.

## Answer by Tim Wilding (score 4, accepted)

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

The trick is in the transformation of the constraints used to solve the optimisation problem. This can be seen in the definition of the set $\chi^+$ in the two lines following equation 5.4 of Tütüncü. So, for example, the usual budget constraint ($e^Tx = 1$) would be replaced by ($e^Tx - \kappa = 0$). After the addition of that constraint, the solution with the maximum Sharpe ratio is $x^* = \frac{\hat{x}}{\hat{\kappa}}$, where $(\hat{x},\hat{\kappa})$ is the solution to the quadratic programming problem (see bottom of page 62).

## Answer by Kingsley Ikani (score 0)

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

H is the hessian matrix

```
f = [0;0;0;0;0;0;0;0;0;0;0];
n = 10;
rf = 0.0082;
ExpReturns =  -0.00591 + 0.002 * (1:10)';

% Optimization problem data
lb = zeros(n+1,1);
ub = inf*ones(n+1,1);
F = ones(n,1);
Aeq = [( AvrReturn- rf)' 0;ones(1,n) -1];
beq = [1; 0];
A = [eye(n),-1*ones(n,1)];
b = zeros(n,1);
[x4 fval4,exitflag,output] = quadprog(H,f,A,b,Aeq,beq,lb,ub)
y = x4(1:n);
k = x4(n + 1);
x = x4/k;
```

## Answer by Tejas Appana (score 0)

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

As you follow through the derivation, you'll note that $y = \lambda \cdot x$. This transformation was created to remove the numerator from the main optimization problem, and reframe it as a boundary condition $(\mu^T - \mathbb{1}^T) \cdot y = 1$.

After you've finished the optimization problem and obtained your y vector, you now have to tackle $x = \frac{y}{\lambda}$. You don't need to keep track of this transformation constant during the problem, because we know that by the nature of portfolio weights, $\mathbb{1}^T\cdot x = 1$, or rather the sum of all weights should equal 1. So all you have to do now, is normalize your y vector - that is, calculate the sum of your values in the y vector, and use that value as the scalar divisor for y to obtain x. $x = \frac{y}{\sum^{len(y)}_{i=1}y_i}$.

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.