---
# System prepended metadata

title: 01 Intro. to Portfolio optim.
tags: [Portfolio optimization]

---

# 01 Intro. to Portfolio optim.

###### tags: `Portfolio optimization`

### Portfolio optimization
The goal of portfolio optimization (PO) is to maximize returns and minimize the risk of a portfolio of assets according to modern portfolio theory (Markowitz, 1952)

Given two assets as follows:
$$
\left\{
\begin{array}{l}
\text{Asset 1: } \mu=\mu_1, \sigma^2=\sigma_1^2\\
\text{Asset 2: } \mu=\mu_2, \sigma^2=\sigma_2^2
\end{array}
\right.
$$ We can use a weight vector $[w_1, w_2]^T$ (with $w_1+w_2=1$, and $w_i \geq 0$, $\forall i=1, 2$) to allocate these two assets to have overall mean return $\mu$ and standard devaition $\sigma$ (also known as volatility or risk):
$$
\left\{
\begin{array}{rcllll}
\mu &=& w_1\mu_1+w_2\mu_2 &=& \left[\begin{array}{c}\mu_1 & \mu_2\end{array}\right]\left[\begin{array}{c} w_1 \\ w_2\end{array}\right]\\
\sigma^2 &=& w_1^2\sigma_1^2+w_2^2\sigma_2^2+2w_1w_2\sigma_{12} &=&
\left[\begin{array}{c} w_1 & w_2\end{array}\right]
\left[\begin{array}{cc} \sigma_1^2 & \sigma_{12}\\ \sigma_{21} & \sigma_2^2 \end{array}\right]
\left[\begin{array}{c} w_1 \\ w_2\end{array}\right]\text{, with $\sigma_{12}=\sigma_{21}$}
\end{array}
\right.
$$
Similarly, for $n=3$, we have
$$
\left\{
\begin{array}{rcl}
\mu &=& \left[\begin{array}{c}\mu_1 & \mu_2 & \mu_3\end{array}\right]
\left[\begin{array}{c} w_1 \\ w_2 \\ w_3\end{array}\right]\\
\sigma^2 &=& 
\left[\begin{array}{c} w_1 & w_2 & w_3\end{array}\right]
\left[\begin{array}{ccc}
\sigma_{1}^2 & \sigma_{12} & \sigma_{13}\\
\sigma_{21} & \sigma_{2}^2 & \sigma_{23}\\
\sigma_{31} & \sigma_{32} & \sigma_{3}^2
\end{array}\right]
\left[\begin{array}{c} w_1 \\ w_2 \\ w_3\end{array}\right]
\end{array}
\right.
$$

In general, for $n$ assets, we can extend the above expressions to the following overall return $\mu$ and risk $\sigma$:
$$
\left\{
\begin{array}{rcl}
\mu &=& \boldsymbol{\mu}^T \mathbf{w}\\
\sigma^2 &=& \mathbf{w}^T \Sigma \mathbf{w}
\end{array}
\right.
$$
where $\mathbf{w}=[w_1, \dots, w_n]^T$ (with $\sum_{i=1}^n w_i=1$, and $w_i \geq 0$, $\forall i=1 \cdots n$), $\boldsymbol{\mu}=[\mu_1, \dots, \mu_n]^T$, and $\Sigma$ is the covariance matrix of these $n$ assets. Note that $\boldsymbol{\mu}$ and $\Sigma$ are usually obtained from historical data, and we want to find $\mathbf{w}$ such that a certain objective function is optimized.

In fact, there are a number of objective functions as well as constraints to be satisfied for PO in practice. The most intuitive one is based on minimizing risk with fixed return. That is, given a fixed return $r$, find the weights to minimize the overall variance $\sigma^2$, as follows. 
$$
\min_{\mathbf{w}} \sigma^2=\mathbf{w}^T \Sigma \mathbf{w} \\
s.t. 
\left\{
\begin{array}{l}
\mathbf{w}^T\mathbf{1}=1\\
\boldsymbol{\mu}^T \mathbf{w}=r
\end{array}
\right.
$$
where $\mathbf{1}=[1, \dots, 1]^T$.

Several other commonly used objective functions will be covered in the next sections.