Solution (source code)

= Solution

Use the <zero-boundary Sobolev space> $V=H_0^1(0,1)$ with $\|v\|_V=\|v'\|_{L^2}$. The <Poincaré inequality> $\|v\|_{L^2}\le\pi^{-1}\|v'\|_{L^2}$ makes this a complete <Hilbert space> norm. The <weak formulation> is
$$
a(u,v)=\int_0^1[p(x)u'(x)v'(x)+q(x)u(x)v(x)]\,dx=\ell(v),\qquad\ell(v)=\int_0^1f(x)v(x)\,dx.
$$
Assume $p,q$ are measurable and satisfy the supplied bounds almost everywhere. The <Cauchy-Schwarz inequality> and <Poincaré inequality> give
$$
|a(u,v)|\le\left(p_1+\frac{q_1}{\pi^2}\right)\|u'\|_{L^2}\|v'\|_{L^2}.
$$
Because $p\ge p_0>0$ and $q\ge0$,
$$
a(v,v)=\int_0^1[p(v')^2+qv^2]\,dx\ge p_0\|v'\|_{L^2}^2.
$$
This is the <coercive variable-coefficient Dirichlet form>. If $f\in L^2(0,1)$, then $|\ell(v)|\le\pi^{-1}\|f\|_{L^2}\|v\|_V$; more generally one may assume $f\in H^{-1}(0,1)=V'$. Some such source regularity is necessary to invoke the theorem. All hypotheses of the <Lax-Milgram theorem> now hold, with \b[coercivity constant $p_0$ and boundedness constant $p_1+q_1/\pi^2$], giving the unique <weak solution> and every conforming <Galerkin method> approximation. This argument does not require a pointwise derivative of $p$.