# Portfolio Risk-Return

I have a question on risk-return portfolios.

How do I go about calculating up to 200 opportunity sets by varying the weights of three assets for each portfolio $$w_1$$,$$w_2$$ and $$w_3$$ given:

Mean return of each asset: $$\mu = [0.4, 0.17, 0.19]^T$$ as constant expected return

Standard deviation of each asset: $$\sigma = [0.2, 0.1, 0.1]^T$$

Correlation matrix: $$\rho = \begin{bmatrix} 1 & -0.2 & -0.4 \\ -0.2 & 1 & -0.5 \\ -0.4 & -0.5 & 1 \end{bmatrix}$$

• what is an 'opportunity set'? Do you mean 200 different portfolios all located on the Markowitz efficient frontier?
– Attack68
Mar 17, 2019 at 6:53
• Hi Attace68 - yes correct, that is what I mean. I will update the question to make it clearer. Thanks. Mar 17, 2019 at 7:41

The Markowitz Efficient Frontier can be characterised by the portfolio with lowest variance of portfolio valuation, for a given return. That is you have the objective function:

$$\min_w f(w) = w^T \Sigma w, \quad s.t. \quad \delta^T w = 1, \quad \mu^T w = r, \quad where \quad \Sigma = \sigma^T \rho \sigma,$$

(If you prohibit short selling there is a further constraint: $$w \geq 0$$)

Using Lagrange Multipliers the above formulation is analytically solvable for $$r$$ (with only equality constraints).

$$L(w) = f(w) - \lambda_1 (\delta^T w -1) - \lambda_2 (\mu^T w - r)$$ $$\nabla_w L = \nabla_w f -\lambda_1 \delta - \lambda_2 \mu = 2 \Sigma w -\lambda_1 \delta - \lambda_2 \mu$$ $$\nabla_{\lambda}L = \begin{bmatrix} -\delta^T w+1 \\ - \mu^Tw+r \end{bmatrix}$$

Setting all derivatives to zero (Karush-Kuhn-Tucker conditions) gives the linear system;

$$\begin{bmatrix} 2\Sigma & -\delta & -\mu \\ -\delta^T & 0 & 0 \\ \mu^T & 0 & 0 \end{bmatrix} \begin{bmatrix} w \\ \lambda_1 \\ \lambda_2 \end{bmatrix} = \begin{bmatrix} 0 \\ -1 \\ -r \end{bmatrix}$$

Therefore you can vary $$r$$, the targeted return and yield the weights for each efficient portfolio solving the above linear system.

If you prohibit short selling you need to use an optimisation solver due to the inequality constraint.

• Perfect, thankyou so much! I've completed a numerical example for one portfolio and can validate the result perfectly. Now C++ for the 200 portfolios to chart. Mar 17, 2019 at 23:57