Solution (source code)

= Solution

For every nonzero-risk portfolio,
$$
\frac{\mathbb E X_1-(1+r)X_0}
{\sqrt{\operatorname{Var}(X_1)}}
=\frac{\theta^Tq}{\sqrt{\theta^TV\theta}}
\leq\sqrt{q^TV^{-1}q}.
$$
Equality holds precisely for
$$
\boxed{\theta=\lambda V^{-1}q,\qquad\lambda>0}.
$$
The maximum is therefore $\sqrt{q^TV^{-1}q}$. For each resulting mean, part (a) shows that this portfolio has the least possible variance, so every maximizer lies on the <mean-variance efficient ray>.