# How to construct a risk parity Portfolio by fixing the portfolio volatility on a desired level?

I would like to get the weights of a risk parity portfolio (equal risk contribution). Therefore I use following formulas:

$$\sigma(w)=\sqrt{w' \Sigma w}$$

$$\sigma_i(w)= w_i \times \partial_{w_i} \sigma(w)$$

$$\sigma(w)=\sum_{i=1}^n \sigma_i(w)$$

$$c(w)= \frac{\Sigma w}{\sqrt{w' \Sigma w}}$$

$$\underset{w}{\arg \min} \sum_{i=1}^N [\frac{\sqrt{w^T \Sigma w}}{N} - w_i \cdot c(w)_i]^2$$

probably I need to calculate and then scale the portfolio volatility $$\sigma(w)$$ on a desired value, e.g. $$\sigma(w)$$=5%, but I dont know how to do it. Thanks for your help already! Best

your goal is to find the weight vector, $$w$$, which minimized your "utility" function $$\sum_{i}^{N} [\frac{\sqrt{w^{T}\Sigma w}}{N} - w_i\cdot c(w_i))] ^{2}$$. A general approach is to use gradient descent algo to find the optimal vector. What gradient descent does is it assumed finding best possible solution on each direction (in your case in each $$w_i$$) is equivalent to find a global best minimizer. And if you noticed, the whole$$\sqrt{w^{T}\Sigma w}$$ is just 5% as you specified.
There are lots of documentation on how to perform gradient descent online, but the general idea is to initialize a random vector of your desired variable ($$w_i$$), and until convergence, choose an index from 1 to n and a step size $$a$$, update $$w_i$$ to $$w_i - a *$$derivatives of utility function w.r.t $$w_i$$.