# Lagrange optimization of vectors with two constraints

I hope here is he correct place to ask my question. I am trying to develop a portfolio strategy with three assets (one of which is risk free). For this I need to determine a vector of weights (w) and maximize the return. However, I want that the volatility/variance of the portfolio is set to a predetermined level (constraint 1) and that the sum of the weights is 1 (second constraint). I found the following formula:

$\max_{L=w, \lambda_1, \lambda_2} = w' \mu + \lambda_1 (\sigma_{target}^2 - 0.5 w'\Sigma w) + \lambda_2 * (1 - w'\textbf{1})$

Can anyone help me solve this problem? I work with R. Is there any package that can help me with this?

• quant.stackexchange.com – Rodrigo de Azevedo Mar 14 '18 at 15:36
• Differentiate wrt to the vector $w$ and set to zero. This will give you an expression for $w$ in terms of the $\lambda$s. Put this into the two constraints to get expressions for the $\lambda$s. – user121049 Mar 14 '18 at 15:43