Solution (source code)

= Solution

Work in the real <zero-boundary Sobolev space> $X=H_0^1(0,1)$, whose members have square-integrable <weak derivatives> and zero endpoint trace. Define the <bounded bilinear form> and <linear functional>
$$
a(u,v)=\int_0^1(u'v'+uv)\,dx,\qquad
\ell(v)=\int_0^1xv\,dx.
$$
The <weak formulation> is to find $u\in X$ with $a(u,v)=\ell(v)$ for every $v\in X$. <Integration by parts> recovers the differential equation for a smooth solution; conversely, this identity is the definition of its <weak solution>.

Use the full $H^1$ <norm>. The <Cauchy-Schwarz inequality> gives $|a(u,v)|\leq\|u\|_{H^1}\|v\|_{H^1}$ and $|\ell(v)|\leq\|v\|_{H^1}/\sqrt3$. Also $a(v,v)=\|v\|_{H^1}^2$, so $a$ is a <coercive bilinear form> with constant one. The <Lax-Milgram theorem> states that a bounded, coercive bilinear form on a real <Hilbert space> determines a unique weak solution for every bounded linear functional. It therefore applies here.

The equivalent minimization problem is
$$
\boxed{\min_{v\in H_0^1(0,1)}\mathcal E(v),\qquad
\mathcal E(v)=\frac12\int_0^1\bigl((v')^2+v^2\bigr)\,dx-\int_0^1xv\,dx.}
$$
If $u$ is the weak solution, symmetry and $a(u,v-u)=\ell(v-u)$ give
$$
\mathcal E(v)-\mathcal E(u)=\frac12a(v-u,v-u).
$$
This is positive unless $v=u$, proving a unique <global minimizer>. Conversely, differentiating $\mathcal E(u+tv)$ at $t=0$ gives the weak identity. Thus \b[the unique energy minimizer is exactly the unique <weak solution>]. As a check, the classical representative is
$$
\boxed{u(x)=x-\frac{\sinh x}{\sinh1}.}
$$
It satisfies both endpoint conditions and $-u''+u=x$.