# 02 Portfolio Optim. for 2 Assets
###### tags: `kkk`
### Portfolio optimization with 2 assets
Given two risky assets as follows:
$$
\left\{
\begin{array}{l}
\text{Asset 1: } \mu=\mu_1, \sigma=\sigma_1\\
\text{Asset 2: } \mu=\mu_2, \sigma=\sigma_2
\end{array}
\right.
$$
We can use a weight vector $[w_1, w_2]^T$, with $w_1+w_2=1$ to allocate these two assets to have overall mean return $\mu$ and variance $\sigma^2$:
$$
\left\{
\begin{array}{rcl}
\mu &=& w_1\mu_1+w_2\mu_2\\
\sigma^2 &=& w_1^2\sigma_1^2+w_2^2\sigma_2^2+2w_1w_2\sigma_{12}
\end{array}
\right.
$$
Instead of using two parameters in the above expression, we can use only a single parameter $w$, with $w_1=w$ and $w_2=1-w$:
$$
\left\{
\begin{array}{rcl}
\mu &=& w\mu_1+(1-w)\mu_2\\
\sigma^2 &=& w^2\sigma_1^2+(1-w)^2\sigma_2^2+2w(1-w)\sigma_{12}
\end{array}
\right.
$$
$$
\begin{array}{rcl}
\frac{d\sigma^2}{dw} & = & 2w\sigma_1^2-2(1-w)\sigma_2^2+2(1-2w)\sigma_{12}\\
& = & 2w(\sigma_1^2+\sigma_2^2-2\sigma_{12})-2\sigma_2^2+2\sigma_{12}\\
& = & 0\\
\end{array}
$$
$$
\Rightarrow
w=\frac{\sigma_2^2-\sigma_{12}}{\sigma_1^2+\sigma_2^2-2\sigma_{12}},
1-w=\frac{\sigma_1^2-\sigma_{12}}{\sigma_1^2+\sigma_2^2-2\sigma_{12}}
$$
Therefore when the minimum variance occurs at the above weights, we have
$$
\mu=\frac{\mu_1(\sigma_2^2-\sigma_{12})}{\sigma_1^2+\sigma_2^2-2\sigma_{12}}+
\frac{\mu_2(\sigma_1^2-\sigma_{12})}{\sigma_1^2+\sigma_2^2-2\sigma_{12}}
=\frac{\mu_1\sigma_2^2+\mu_2\sigma_1^2-\sigma_{12}(\mu_1+\mu_2)}{\sigma_1^2+\sigma_2^2-2\sigma_{12}}
$$
$$
\sigma^2=
\frac{(\sigma_2^2-\sigma_{12})^2\sigma_1^2}{(\sigma_1^2+\sigma_2^2-2\sigma_{12})^2}+
\frac{(\sigma_1^2-\sigma_{12})^2\sigma_2^2}{(\sigma_1^2+\sigma_2^2-2\sigma_{12})^2}+
\frac{2(\sigma_2^2-\sigma_{12})(\sigma_1^2-\sigma_{12})\sigma_{12}}{(\sigma_1^2+\sigma_2^2-2\sigma_{12})^2}
=\frac{\sigma_1^2\sigma_2^2-\sigma_{12}^2}{\sigma_1^2+\sigma_2^2-2\sigma_{12}}
$$ (You need to verify this by yourself!)
We can go one step further to find the equation defining the relationship betweeen $\mu$ and $\sigma$. First of all, we have
$$
w=\frac{\mu_2-\mu}{\mu_2-\mu_1},
1-w=\frac{\mu-\mu_1}{\mu_2-\mu_1}
$$
Therefore
$$
\begin{array}{rcl}
\sigma^2
& = &
\left(\frac{\mu_2-\mu}{\mu_2-\mu_1}\right)^2\sigma_1^2+
\left(\frac{\mu-\mu_1}{\mu_2-\mu_1}\right)^2\sigma_2^2+
2\left(\frac{\mu_2-\mu}{\mu_2-\mu_1}\right)\left(\frac{\mu-\mu_1}{\mu_2-\mu_1}\right)\sigma_{12}\\
& = &
\frac{1}{(\mu_2-\mu_1)^2}
[
(\mu^2-2\mu_2\mu+\mu_2^2)\sigma_1^2+
(\mu^2-2\mu_1\mu+\mu_1^2)\sigma_2^2
-2(\mu^2-(\mu_1+\mu_2)\mu+\mu_1\mu_2)\sigma_{12}
]\\
& = &
\frac{1}{(\mu_2-\mu_1)^2}
[(\sigma_1^2+\sigma_2^2-2\sigma_{12})\mu^2
-2(\mu_2\sigma_1^2+\mu_1\sigma_2^2-(\mu_1+\mu_2)\sigma_{12})\mu
+\mu_2^2\sigma_1^2+\mu_1^2\sigma_2^2-2\mu_1\mu_2\sigma_{12}
]\\
\end{array}
$$
Since $\sigma_1^2+\sigma_2^2-2\sigma_{12} \geq 2(\sigma_1\sigma_2-\sigma_{12}) \geq 0$, the above equation is a hyperbola on the $\sigma-\mu$ plane. It can reduce to a parabola if $\sigma_1^2+\sigma_2^2-2\sigma_{12}=0$.
Note that we can express $\sigma_{12}$ as follows:
$$
\sigma_{12}=\sigma_1\sigma_2\rho_{12},
$$
where $\rho_{12}$ is the correlation coefficient for the return rates of assets 1 and 2, with $-1\leq \rho_{12} \leq 1$. This leads to the following expressions of the overall $\mu$ and $\sigma$:
$$
\left\{
\begin{array}{rcl}
\mu &=& w_1\mu_1+w_2\mu_2\\
\sigma^2 &=& w_1^2\sigma_1^2+w_2^2\sigma_2^2+2w_1w_2\sigma_1\sigma_2\rho_{12}
\end{array}
\right.
$$
Let's discuss 3 cases when $\rho_{12}$ is equal to 1, 0, and -1, respectively.
* When $\rho_{12}=1$, we have
$$
\sigma^2 = w_1^2\sigma_1^2+w_2^2\sigma_2^2+2w_1w_2\sigma_1\sigma_2=(w_1\sigma_1+w_2\sigma_2)^2
\Rightarrow
\left\{
\begin{array}{rcl}
\mu &=& w_1\mu_1+w_2\mu_2\\
\sigma &=& |w_1\sigma_1+w_2\sigma_2|
\end{array}
\right.
$$ As $w_1$ is changing from 0 to 1, the above equations represent a line connecting $(\sigma_1, \mu_1)$ (when $w_1=1$ and $w_2=0$) and $(\sigma_2, \mu_2)$ (when $w_1=0$ and $w_2=1$). So the minimum variance is $\min(\sigma_1^2, \sigma_2^2)$.
* When $\rho_{12}=0$, we have
$$
\sigma^2 = w_1^2\sigma_1^2+w_2^2\sigma_2^2
$$ By using Cauchy-Schwartz inequality, we have
$$
(w_1^2\sigma_1^2+w_2^2\sigma_2^2)(\sigma_1^{-2}+\sigma_2^{-2})\geq(w_1+w_2)^2=1
$$ Therefore the minimum variance can be derived as follows:
$$
\sigma^2 = w_1^2\sigma_1^2+w_2^2\sigma_2^2 \geq (\sigma_1^{-2}+\sigma_2^{-2})^{-1}=\frac{\sigma_1^2\sigma_2^2}{\sigma_1^2+\sigma_2^2}
$$ The equality holds when
$$
w_1^2\sigma_1^2/\sigma_1^{-2}=w_2^2\sigma_2^2/\sigma_2^{-2} \Rightarrow
w_1=\frac{\sigma_2^2}{\sigma_1^2+\sigma_2^2},
w_2=\frac{\sigma_1^2}{\sigma_1^2+\sigma_2^2}
$$ And the corresponding overall $\mu$ can be expressed as
$$
\mu=\frac{\mu_1\sigma_2^2+\mu_2\sigma_1^2}{\sigma_1^2+\sigma_2^2}
$$
* When $\rho_{12}=-1$, we have
$$
\sigma^2 = w_1^2\sigma_1^2+w_2^2\sigma_2^2-2w_1w_2\sigma_1\sigma_2=(w_1\sigma_1-w_2\sigma_2)^2
$$
In this case, we can achieve zero risk by setting
$$
w_1\sigma_1=w_2\sigma_2 \Rightarrow
w_1=\frac{\sigma_2}{\sigma_1+\sigma_2},
w_2=\frac{\sigma_1}{\sigma_1+\sigma_2}.
$$ Therefore the minimum variace is 0, and the corresponding return is $\frac{\sigma_2\mu_1+\sigma_1\mu_2}{\sigma_1+\sigma_2}$.
The plot of efficient frontiers with various values of $\rho_{12}$ when $(\sigma_1, \mu_1)=(0.15, 0.2)$ and $(\sigma_2, \mu_2)=(0.25, 0.3)$ is shown next. In particular, if we restrict $w$ to be within the interval $[0, 1]$, then the feasible area for the efficient frontiers of varying correlation coefficients is a triangle with tips at $(\sigma_1, \mu_1)$, $(\sigma_2, \mu_2)$, and $(0, \frac{\sigma_1\mu_2+\sigma_2\mu_1}{\sigma_1+\sigma_2})$.

And here is another plot for $(\sigma_1, \mu_1)=(0.2, 0.1)$ and $(\sigma_2, \mu_2)=(0.1, 0.3)$.

Exercises
1. In PO for 2 assets, when will the efficient frontier reduce to a straight line?
1. In PO for 2 assets, when will the efficient frontier reduce to a parabola?
1. In PO for 2 assets, when will the overall risk go to zero? What are the weights when this happens?
1. In PO for 2 assets, can you derive the general formula for minimum-variance portfolio?
* What is the minimum variance?
* What is the corresponding return and weights?
1. Given two risky assets as follows:
$$
\left\{
\begin{array}{l}
\text{Asset 1: } \mu=0.2, \sigma=0.1\\
\text{Asset 2: } \mu=0.3, \sigma=0.2
\end{array}
\right.
$$ Under the following conditions, what are the corresponding minimum variances when we achieve minimum-variance portfolio?
* $\rho_{12}=1$
* $\rho_{12}=0$
* $\rho_{12}=-1$
1. Given two risky assets as follows:
$$
\left\{
\begin{array}{l}
\text{Asset 1: } \mu=0.2, \sigma=0.1\\
\text{Asset 2: } \mu=0.3, \sigma=0.2
\end{array}
\right.
$$ And the correlation coefficient of these two assets is $\rho_{12}=0$. We want to perform portfolio optimization with investment weigthing of $w_1$ and $w_2$ for assets 1 and 2, respectively.
* What are the overall $\mu$ (return) and $\sigma$ (volatility) when $w_1=0.4$ and $w_2=0.6$?
* What are the overall $\mu$, overall $\sigma$, and $w_1$ for achieving the minimum-variance portfolio?
1. Given two risky assets as follows:
$$
\left\{
\begin{array}{l}
\text{Asset 1: } \mu=0.2, \sigma=0.1\\
\text{Asset 2: } \mu=0.3, \sigma=0.2
\end{array}
\right.
$$ And the correlation coefficient of these two assets is $\rho_{12}=0.4$. We want to perform portfolio optimization with investment weigthing of $w_1$ and $w_2$ for assets 1 and 2, respectively.
* What are the overall $\mu$ (return) and $\sigma$ (volatility) when $w_1=0.4$ and $w_2=0.6$?
* What are the overall $\mu$, overall $\sigma$, and $w_1$ for achieving the minimum-variance portfolio?