Solution (source code)

= Solution

Put $b=(1+r)w_0$, $a=\mu-(1+r)p$ and $d=m-b$. The terminal mean and variance are $b+\theta^{\mathsf T}a$ and $\theta^{\mathsf T}V\theta$. A nonsingular <covariance matrix> is positive definite. If $a\ne0$, define $D=a^{\mathsf T}V^{-1}a>0$. The <Lagrange multiplier> equations for the fixed-mean constraint give $2V\theta=\lambda a$, and thus
$$
\boxed{\theta^*=\frac{m-b}{D}V^{-1}a,\qquad
\operatorname{var}(w_1)^*=\frac{(m-b)^2}{D}.}
$$
For a direct global proof, every feasible portfolio is $\theta^*+h$ with $a^{\mathsf T}h=0$, so its variance is $d^2/D+h^{\mathsf T}Vh$, minimized uniquely at $h=0$. If $a=0$, only $m=b$ is feasible and its minimum variance is zero, attained by the all-bank portfolio; no other required mean is achievable.