An investor can choose to put his money in a savings account ($S$) with a return of $\mu_S=1.05$. Since the bank guarantees this return the investment is risk-free, hence $\sigma_S = 0$. Furthermore, the investor has the possibility to invest in a stock ($A$) with expected return $\mu_A=1.1$ and risk $\sigma_A=0.1$. We summarize this information as $(\mu_S, \sigma_S)= (1.05;0)$ and $(\mu_A, \sigma_A) = (1.1; 0.1)$. The utility function of the investor is $U(\mu,\sigma)=\mu-4\sigma^2, \ (\sigma \geq 0)$. The investor puts a fraction $w_1$ in the savings account and he invests a fraction $w_2$ in the stock. Since we assume he invests the full amount available for investment, we obtain the following restriction for the fractions $w_1$ and $w_2$: $w_1+w_2 = 1$ and $w_1 \geq 0, \ w_2 \geq 0.$ By the use of formulas from statistics (that are outside the scope of this book) the expected return and risk of this portfolio $P=w_1S + w_2A$ can be determined. We provide the result of this calculation:

$$\begin{array}{lll}
\mu&=& 1.05w_1 + 1.1w_2,\\
\sigma &=& 0.1w_2.
\end{array}
$$

We determine the optimal portfolio for this investor.

Since $w_1 = 1 - w_2$ we can rewrite these expressions as

$$\begin{array}{lll}
\mu&=& 1.05 + 0.05w_2,\\
\sigma &=& 0.1w_2.
\end{array}
$$

Since $w_2 =10\sigma$ we can rewrite these two equations into one (linear) equation of $\mu$ and $\sigma$:
\[
\mu = 1.05 +\tfrac{1}{2} \sigma.
\]
Hence, the investor should solve the following constrained maximization problem:

$$
\begin{array}{ll}
\mbox{maximize}&U(\mu,\sigma) = \mu - 4\sigma^2\\
\mbox{subject to}&\mu = 1.05 + \frac{1}{2} \sigma,\\
\mbox{where} &  \sigma \geq 0.
\end{array}
$$

We use the substitution method to solve this problem.

Step 1. The restriction $\mu = 1.05 + \frac{1}{2} \sigma$ is already written as a function.

Step 2. We substitute the restriction into the utility function:

$$\begin{array}{lll}
u(\sigma) &=& U(1.05 + \frac{1}{2} \sigma , \sigma)\\
& = & 1.05 + \frac{1}{2}\sigma -4 \sigma^2, \ (\sigma \geq 0).
\end{array}
$$

Step 3. We determine the maximum of $u(\sigma)$.
Hence, we have to solve the equation$u'(\sigma) = \frac{1}{2} - 8 \sigma = 0$. The only stationary point is $\sigma = \frac{1}{16}$ and since $u''(\sigma) = -8$ it also holds that $u''(\frac{1}{16}) = -8<0$, which means according to the second-order condition for an extremum that $\sigma = \frac{1}{16}$ is a maximum location.

Step 4. We determine the maximum (location) of $U(\mu, \sigma)$.
By plugging $\sigma = \frac{1}{16}$ into the restriction we obtain $\mu = 1.05 + \frac{1}{2} \cdot \frac{1}{16} = \frac{173}{160}$, which gives the maximum location $(\mu,\sigma)=(\frac{173}{160}, \frac{1}{16})$. Now we can also determine the fractions. From $w_2=10\sigma$ it follows that $w_2 =\frac{5}{8}$. Hence, $w_1 =\frac{3}{8}$.