= Solution
Expand the solution and the forcing in the orthonormal <Sturm-Liouville eigenfunction expansion>. The forcing coefficients are
$$
b_n=\langle y_n,1\rangle_w
=\sqrt2\int_0^1\sin(n\pi t)\,dt
=\frac{\sqrt2[1-(-1)^n]}{n\pi}.
$$
Every $\lambda_n$ is nonzero, so the solution coefficient is $b_n/\lambda_n$. Thus
$$
\boxed{y(x)=\sum_{n=1}^{\infty}\frac{2[1-(-1)^n]}{n\pi(n^2\pi^2-1)}\sin(n\pi\log x)
=\sum_{\substack{n\geq1\\n\text{ odd}}}\frac{4\sin(n\pi\log x)}{n\pi(n^2\pi^2-1)}.}
$$
As an independent check, solving $Y''+Y=-1$ directly with the two endpoint conditions gives
$$
y(x)=\frac{\cos(\log x-\tfrac12)}{\cos(\tfrac12)}-1.
$$
It satisfies both <Dirichlet boundary conditions> and the forced <ordinary differential equation>.
Back to article page