Today, at the end of the class, there were some questions about this exercise. I want to provide some intuition of why we have a negative weight.
Note that we are asked to create a portfolio with an expected return of 4% by combining an asset with an expected return of 5% and an asset with an expected return of 8%. Note that both assets have an expected return higher than the one we want; hence, positive weights will not work (the portfolio will always be between 5% and 8%). Remember that returns are a measure of what we get in a year (or other time measure) over what we invested. In this exercise, we need to invest everything (weights sum up to one) so the only way to reduce the return is to force ourselves to give back in one year some cashflow (instead of receiving). In other words, we need to go short (negative weights).
The math is the same as always:
\(8 w_A+5(1-w_A) = 4 \Rightarrow w_A=-\dfrac{1}{3}\)
Note that weights must be equal to one, so if we short one stock, we buy more of the other. Then, to obtain an expected return below 5, we short the high-expected return and go long on the short-expected return stock.
If we need an expected return over 8%, we do the opposite. In this case, we would like to borrow a lot to invest in A. One way of borrowing is to short stock B.