Solution (source code)

= Solution

Assume $\sigma\ne0$ and the usual <Brownian filtration>, so the single-risky-asset market is a <complete market>. With <market price of risk> $\kappa=(\mu-r)/\sigma$, the normalized <state-price density> is
$$
\boxed{\zeta_t=\exp[-rt-\kappa W_t-\tfrac12\kappa^2t]},\qquad
d\zeta_t=-r\zeta_t\,dt-\kappa\zeta_t\,dW_t.
$$
The <Itô formula> shows that $\zeta_tw_t$ is a <local martingale> for a <self-financing portfolio>. For nonnegative admissible wealth it is a <supermartingale>, yielding the <state-price budget constraint>
$$
\mathbb E[\zeta_Tw_T]\leq w.
$$
Every integrable nonnegative terminal claim with equality is attainable in the <complete market>, by the <Brownian martingale representation theorem>. Its wealth process is $w_t=\zeta_t^{-1}\mathbb E[\zeta_TX\mid\mathcal F_t]\geq0$.

The <Inada conditions> $u'(0+)=\infty$ and $u'(\infty)=0$, together with strict <concavity>, make $I=(u')^{-1}$ a decreasing map from $(0,\infty)$ onto $(0,\infty)$. Pointwise optimization of $u(x)-y\zeta_Tx$ gives \b[the optimal terminal wealth]
$$
\boxed{w_T^*=I(y\zeta_T),\qquad
\mathbb E[\zeta_TI(y\zeta_T)]=w,}
$$
with scalar multiplier $y>0$. The question assumes a multiplier giving the required budget; utility expectations must also be well defined.

For any admissible terminal wealth $X$, the supporting-line inequality for a <concave function> gives
$$
u(X)-u(w_T^*)\leq u'(w_T^*)(X-w_T^*)
=y\zeta_T(X-w_T^*).
$$
Taking expectations and using the <state-price budget constraint> proves \b[optimality]:
$$
\boxed{\mathbb Eu(X)\leq\mathbb Eu(w_T^*)+
y(\mathbb E[\zeta_TX]-w)\leq\mathbb Eu(w_T^*).}
$$
Strict <concavity> makes the optimal terminal wealth unique up to almost-sure equality.