We consider the same situation as in Example 1. However, we now solve it in a different, more direct way.

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 by putting this information directly into the utility function:
\[U(w_1,w_2)=1.05w_1+1.1w_2-4(0.1w_2)^2.\]

Since the fractions satisfy the restrictions $w_1+ w_2=1$ and $w_1\geq 0,w_2\geq 0$, the investor has the following constrained maximization problem:

$$\begin{array}{ll}
\mbox{maximize}&U(w_1,w_2) = 1.05w_1 + 1.1w_2 - 4(0.1w_2)^2\\
\mbox{subject to}&w_1 + w_2 =1,\\
\mbox{where} &  w_1 \geq 0 \ \mbox{and} \ w_2 \geq 0.
\end{array}
$$

Again, we solve this constrained maximization problem by the substitution method.

Step 1. We rewrite the restriction to $w_1 = 1- w_2$.

Step 2. We substitute the equation from Step 1 into the utility function:

$$\begin{array}{lll}
u(w_2) &=& U(1-w_2,w_2) \\
&=& 1.05(1-w_2)+1.1w_2 - 4(0.1w_2)^2\\
&=&1.05+0.05w_2 - 0.04w_2^2, \ (0 \leq w_2 \leq 1).
\end{array}
$$

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

Step 4. We determine the maximum (location) of $U(w_1,w_2)$.
By plugging $w_2=\frac{5}{8}$ into $w_1=1-w_2$ it follows that $w_1=\frac{3}{8}$, which implies that $(w_1,w_2)=(\frac{3}{8},\frac{5}{8})$ is a maximum location.

Obviously, this is the same location as found in Example 1.