Weekly maintenance every saturday 03:00 - 06:00 UTC

# Mean - variance optimization. Minimize the risk for a given target return.

Optimization of some function could be very difficult problem
if we are dealing with complex objectives and constraints.
But the **Convex optimization problem** is one of well - known
class of problems which is very useful for finance.

A convex problem has the following form:

Where $ \mathbf{x} \in \mathbb{R}^n$ , and $f(\mathbf{x}), \; g_i(\mathbf{x})$ are convex functions [1].

### Minimization of risk given target return.

In the **portfolio optimization problem** we have some amount of money
to invest in any of $n$ different assets of some set of assets.
We can choose what fraction $w_i,\; i \in \{1, \dots, n\}$,
of our money amount to invest in each asset. The
**portfolio allocation vector** is the vector
$\mathbb{w} \in \mathbb{R}^n$. We have constraint
${\mathbf 1}^T \mathbb{w} =1$ which means
that the components of our vector $\mathbb{w}$ sum up to $1$.
We will assume here the case $w_i \ge 0$, i.e.
all the weights $w_i$ (the components of the vector $\mathbb{w}$)
greater than or equal to $0$.
Also, we will assume that we are investing one unit of money.

The portfolio return is the dot product: $$ R = \mathbf{r}^T \mathbf{w} $$

The portfolio variance can be calculated as: $$ var(R) = \mathbf{w}^T \mathbf{\Sigma} \mathbf{w} $$

Where $\mathbf{r}$ is the vector of stock expected returns, $\mathbf{r} \in \mathbb{R}^n$, $\mathbf{\Sigma}$ is the $n \times n$ covariance matrix calculated for the returns of our asset set, $\mathbf{w}$ is our weight vector.

The variance of portfolio in mean - variance optimization is considered to be the portfolio risk. (Risk is also sometimes given as $std(R) = \sqrt{var(R)}$ ).

The problem of minimization of the risk for a given target return can be defined as:

$$ \begin{split}\begin{equation*} \begin{aligned} & \underset{\mathbf{w}}{\text{minimize}} & & \mathbf{w}^T \mathbf{\Sigma} \mathbf{w} \\ & \text{subject to} & & \\ & & & \mathbf{r}^{T} \mathbf{w} \geq r_0 + 1\\ & & & {w}_i \geq 0, i \in \{ 1, \ldots, n \} \\ & & & \mathbf{1}^{T} \mathbf{w} = 1 \\ \end{aligned} \end{equation*}\end{split} $$

Where $\mathbf{w}$ is our weight vector, $w_i$ is the $i$ - th component of $\mathbf{w}$, $\mathbf{\Sigma}$ is the covariance matrix, $\mathbf{r}$ is the vector of the expected return, $r_0$ is our target excess return.

Here the optimization objective is the portfolio variance,
the first constraint means that the portfolio excess expected return
should be greater than or equal to the value of $r_0$ ,
the second constraint means that all the weights in the portfolio are
greater than or equal to $0$, the third constraint means that
all the weights should sum up to $1$. The covariance matrix should be
the **symmetric positive definite** one.

It is assumed in the mean - variance optimization that the probability distribution
of the stock returns to be the **multivariate normal** one, so the whole
distribution of the portfolio returns also will be the **normal** one.

[1] Boyd, S.; Vandenberghe, L. Convex Optimization (2004).